Hello Guest it is March 28, 2024, 06:26:07 PM

Author Topic: How do I stop the pauses in motion while setting output signals?  (Read 989 times)

0 Members and 1 Guest are viewing this topic.

I have a tool changer on my CNC. When I move in to position to release the tool I would like to move the spindle up while commanding the drawbar output. Currently the drawbar pushes the tool holder out about 1/2" causing the tool rack to flex. If I am able to move while the drawbar is being engaged I could prevent this flexing.

My code looks like:
Code: [Select]
...
local DrawbarOPEN = mc.mcSignalGetHandle(inst, mc.OSIG_OUTPUT1)
...
mc.mcCntlGcodeExecuteWait(0, "G00 G91 X2")
mc.mcSignalSetState(DrawbarOPEN, 1)
c.mcCntlGcodeExecuteWait(0, ""G00 G91 Z.5")
...

The 3 lines do the following
slide the tool holder in to the tool holder fork
Open the drawbar
Move up to where the drawbar is clear

I would like to combine the open drawbar step and move up to where the drawbar is clear. right now after each line of code there is a noticeable pause.

Is there any way of smoothing out these motions?

I am using a smooth stepper, and the PC is a 3ghz i5.

Offline Graham Waterworth

*
  • *
  •  2,668 2,668
  • Yorkshire Dales, England
    • View Profile
Re: How do I stop the pauses in motion while setting output signals?
« Reply #1 on: June 25, 2020, 08:29:12 PM »
Sounds like the drawbar needs adjusting, if it has an open switch it could be you set it to trigger sooner and start a move on the signal.
Without engineers the world stops
Re: How do I stop the pauses in motion while setting output signals?
« Reply #2 on: June 25, 2020, 08:45:09 PM »
Hi,
the API CntlGcodeExecuteWait(....), does just exactly as described, it waits until the move is complete BEFORE the next line of code is read.

CntlGcodeExecute(.....) does not wait. It will issue a motion command to the trajectory planner and on receipt of a successful transfer
to the planner the API function will return to the Gcode interpreter and the next line of code will be read and executed WITHOUT waiting for the previous
motion command to complete. Note the move will happen once the trajectory planner issues the PVT data to the motion buffer but in the mean time
more Gcode or other API functions are executing.

It may be that if you use the alternative execution API that the operations will execute smoothly rather than discontinuously  as at the moment.

Craig
'I enjoy sex at 73.....I live at 71 so its not too far to walk.'
Re: How do I stop the pauses in motion while setting output signals?
« Reply #3 on: June 26, 2020, 10:13:29 AM »
Thanks, I am using the CntlGcodeExecuteWait commands on purpose.

The issue is that the commands:
Code: [Select]
mc.mcSignalSetState(DrawbarOPEN, 1)
c.mcCntlGcodeExecuteWait(0, "G00 G91 Z.5")
need to happen at the same time

after
Code: [Select]
mc.mcSignalSetState(DrawbarOPEN, 1)
There is about 1/2 second pause, so in this instance the drawbar opening takes about 1 second (mine is pneumatic, set to Columbo's specs at 90psi, pushing the drawbar down .5"). The drawbar pushes down during that 1/2 second pause, then it starts to lift and the pushing stops while the drawbar is still opening, when Z is .5 inches up. I then rapid up to clear the tool holder. I find there is a pause between every command. (I also see this happening when I call a loop, at the end of a loop, in a normal cutting cycle)

I thought this would set the DrawbarOPEN bit, which I assume takes millseconds to do, and as best I can tell by listening to the solenoid click, there is a pause after every step.

So the 3 lines go: move in to tool holder fork, pause, open drawbar, pause, raise spindle, pause

What I want is: move in to tool holder fork, pause, open drawbar while raising spindle, pause

During a cutting cycle everything runs nice and smooth, unless I call a loop where there is a slight pause at the end of the loop.

I need the command:
Code: [Select]
c.mcCntlGcodeExecuteWait(0, "G00 G91 Z.5", mc.mcSignalSetState(DrawbarOPEN, 1))
But nothing like that exists that I can find
Re: How do I stop the pauses in motion while setting output signals?
« Reply #4 on: June 26, 2020, 02:26:27 PM »
You could try the following. M64 P1 will turn on output 1. It might reduce the delay a bit
Code: [Select]
mc.mcCntlGcodeExecuteWait(inst, "G00 G91 X2\nM64 P1\nG00 G91 Z.5")