When the operator requests CNC Abort, I set the Abort inputs of the interpolator and preprocessing function blocks.
My questions are:
Does SMC_Interpolator.bAbort only stop/reset the interpolator, or should it also stop the motion currently being executed by SMC_ControlAxisByPos?
Can SMC_ControlAxisByPos remain Busy after the interpolator has been aborted?
If bAvoidGaps = TRUE, could SMC_ControlAxisByPos still be trying to reach the last fSetPosition using the fGapVelocity / fGapAcceleration / fGapDeceleration settings after the interpolator has stopped?
What is the recommended sequence for safely aborting a running CNC program?
For example, should the sequence be something like:
Stop / Abort Interpolator
Disable SMC_ControlAxisByPos
Execute MC_Stop for all physical axes
Wait until all axes reach standstill
Abort/reset preprocessing blocks and CNC queues
Reset CNC state
Re-enable axis controllers
Or is there a recommended CODESYS CNC method for performing a complete CNC Abort?
I would especially like to understand why SMC_ControlAxisByPos.bBusy can occasionally remain TRUE and continue moving the axis even though the interpolator and preprocessing blocks have already been aborted.
CODESYS SoftMotion CNC is being used with real EtherCAT servo axes.
Any explanation about the correct abort/stop sequence would be appreciated.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I would recommend to first execute a stop (input bSlowStop or bQuickStop of the interpolator). Only when the interpolator has stopped you should abort the interpolator and preprocessing FBs. BTW., a new rising edge of the execute input should suffice.
In case preprocessing is done in a different task: take care to write the abort signal to a local variable in the path and interpolation task and use this local copy. (Otherwise, some preprocessing FBs might see an abort and others not, in the same cycle of the task.)
Best regards,
Georg
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi kishan, Georg's point about stopping the interpolator first is the key one, and it also explains the symptom you are seeing. Aborting the interpolator only stops the interpolator itself, it doesn't reach down the chain and tell ControlAxisByPos to give up. That block just keeps doing its own job: as long as bEnable is TRUE it keeps driving the axis toward the last setpoint it received, and with bAvoidGaps enabled it will keep chasing that last fSetPosition even after the interpolator has gone quiet, which is exactly why it can still look busy and the axis can keep moving for a bit after the abort. It tends to go idle only once its input stops changing or you disable it, so an abort upstream doesn't clear its Busy on its own.
What worked for me on a similar setup was to sequence it in stages instead of firing all the aborts at once: QuickStop the interpolator, wait until it has actually stopped, then disable ControlAxisByPos, and only then issue MC_Stop on the physical axes and wait for standstill before touching the preprocessing chain and resetting the CNC state. The cross-task point matters too β if your preprocessing runs in another task, latch the abort in the interpolation task's local variable, otherwise some blocks can see it a cycle later than others and you get exactly this kind of intermittent behaviour.
One thing I would add: try the whole abort sequence in simulation first with the drives disabled, and don't let the program logic be the only thing standing between the operator and a moving axis β the safety stop needs to stay independent of all of this.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello,
I am working with CODESYS SoftMotion CNC using a preprocessing chain, SMC_Interpolator, and SMC_ControlAxisByPos for controlling the CNC axes.
I have noticed an issue when aborting CNC execution.
When I execute the Abort command, I abort both the CNC preprocessing blocks and SMC_Interpolator.
Normally the CNC process stops correctly.
However, occasionally after the abort:
SMC_Interpolator has already been aborted.
CNC preprocessing has also been aborted/reset.
But SMC_ControlAxisByPos.bBusy remains TRUE.
The corresponding physical axis can still continue moving for some distance.
This does not happen every time.
My basic sequence is similar to:
G-code / CNC preprocessing
β
SMC_Interpolator
β
Transformation
β
SMC_ControlAxisByPos
β
SoftMotion Axis
When the operator requests CNC Abort, I set the Abort inputs of the interpolator and preprocessing function blocks.
My questions are:
Does SMC_Interpolator.bAbort only stop/reset the interpolator, or should it also stop the motion currently being executed by SMC_ControlAxisByPos?
Can SMC_ControlAxisByPos remain Busy after the interpolator has been aborted?
If bAvoidGaps = TRUE, could SMC_ControlAxisByPos still be trying to reach the last fSetPosition using the fGapVelocity / fGapAcceleration / fGapDeceleration settings after the interpolator has stopped?
What is the recommended sequence for safely aborting a running CNC program?
For example, should the sequence be something like:
Or is there a recommended CODESYS CNC method for performing a complete CNC Abort?
I would especially like to understand why SMC_ControlAxisByPos.bBusy can occasionally remain TRUE and continue moving the axis even though the interpolator and preprocessing blocks have already been aborted.
CODESYS SoftMotion CNC is being used with real EtherCAT servo axes.
Any explanation about the correct abort/stop sequence would be appreciated.
Hi kishan,
I would recommend to first execute a stop (input bSlowStop or bQuickStop of the interpolator). Only when the interpolator has stopped you should abort the interpolator and preprocessing FBs. BTW., a new rising edge of the execute input should suffice.
In case preprocessing is done in a different task: take care to write the abort signal to a local variable in the path and interpolation task and use this local copy. (Otherwise, some preprocessing FBs might see an abort and others not, in the same cycle of the task.)
Best regards,
Georg
Hi kishan, Georg's point about stopping the interpolator first is the key one, and it also explains the symptom you are seeing. Aborting the interpolator only stops the interpolator itself, it doesn't reach down the chain and tell ControlAxisByPos to give up. That block just keeps doing its own job: as long as bEnable is TRUE it keeps driving the axis toward the last setpoint it received, and with bAvoidGaps enabled it will keep chasing that last fSetPosition even after the interpolator has gone quiet, which is exactly why it can still look busy and the axis can keep moving for a bit after the abort. It tends to go idle only once its input stops changing or you disable it, so an abort upstream doesn't clear its Busy on its own.
What worked for me on a similar setup was to sequence it in stages instead of firing all the aborts at once: QuickStop the interpolator, wait until it has actually stopped, then disable ControlAxisByPos, and only then issue MC_Stop on the physical axes and wait for standstill before touching the preprocessing chain and resetting the CNC state. The cross-task point matters too β if your preprocessing runs in another task, latch the abort in the interpolation task's local variable, otherwise some blocks can see it a cycle later than others and you get exactly this kind of intermittent behaviour.
One thing I would add: try the whole abort sequence in simulation first with the drives disabled, and don't let the program logic be the only thing standing between the operator and a moving axis β the safety stop needs to stay independent of all of this.