Jog-while-pause changes to motion
what it is
An enhancement to the motion pause handling to:
- enable jog moves during auto pause (in coordinated mode, that is
axes, not joints)
- un-pausing will return to the position where 'pause' was hit, then
continue the auto run
- hitting 'step' will just return to the pause position and stop
- otherwise, 'pause' and 'step' should behave as before
- inputting jog offsets and feeds happens through HAL pins
- feed override keeps working during jog moves in pause mode as usual.
- automatic return moves cane be paused or 'feed held' just alike.
- provide the primitives to record a jog history during pause, and
replay it for return (could be done in HAL or Python)
the intent is to provide a stopgap solution to the 'pause, jog away, clean
swarf, continue' issue
to provide the basis for other scenarios
what it doesnt provide:
- a complete 'jog solution' including keyboard jog, MPG support, your
daughter's kinect etc. All it does is provide the HAL hooks to provide
these features, but it doesnt do so by itself. This is experimental,
and needs some shakeout. Until then, some HAL plumbing is
needed, it isnt yet clear to me how jogging in coordinated mode fits
in the overall picture.
- touchoff during pause. This is a fundamental restriction in current linuxcnc
and forcing the issue would have some serious side effects.
- MDI during pause. As far as the rest of linuxcnc is concerned,
jog-while-paused is not visible - it all looks like a loooong pause.
This modification assures that at resume happens at the point where
where 'pause' was hit.
- jog moves during spindle-synced moves. These changes rely on
the current 'pause' capabilities.
How to try it out
Pull
http://git.mah.priv.at/gitweb/emc2-dev.git/shortlog/refs/heads/jog-while-paused-preview1
and build
cd configs/sim/axis
linuxcnc jog-while-pause9.ini
execute, hit pause somewhere
press 'pause-offset-enable'
change some offset
press 'pause-offset-enable' again
press 'step' to return to pause point
press 'pause' again to continue
Integration notes
I assume here you want to build a jog-while-paused support
component, for instance for an MPG. I use 'IPP' to mean the 'inital
pause position', which is the pose where the pause request was honored
and state changed from running to paused.
Status pins:
- motion.pause-state, s32, one of:
- 0 = running - 'not paused'
- 1 = pausing - looking for the first pausable motion (e.g. not spindle-synced)
- 2 = paused in initial pause position
- 3 = paused, but in offset to IPP (return move needed on resume)
- 4 = jogging - currently executing a move due to a valid offset
- applied
- 5 = returning - currently executing a return move to initial pause position
- 6 = pausing for step - short temporary state while executing a step
- motion.pause-at-motion, s32: the motion type at which the pause
request was honored.
- 0 = invalid (not paused/paused in offset)
- 1 = traverse linear move
- 2 = feed linear move
- 3 = arc
- 4 = toolchange move
- 5 = probing
- 6 = indexrotary
- motion.pause-offset-in-range: bit - the value of the pause-offset-*
pins would result in a move not violating machine
- constraints. Updated during states 1 and 2.
- motion.in-position: existing motion pin signifying the end of a
- motion has been reached and no further motions are pending.
Control pins:
- motion.pause-jog-feed: feed for jog moves
- motion.pause-offset-x..motion.pause-offset-w: offset value to be
- applied to the IPP as long as pause-offset-enable is true
- motion.pause-offset-enable: apply pause-offset-* to generate a move
- to the target position. when the move completes, motion.in-position
- becomes true. Deasserting pause-offset-enable before the target is
- reached causes an immediate stop of motion.
Pause, Resume and Step:
- the Axis 'Pause' button causes transition to the paused state at
next chance (EMC_TASK_PLAN_PAUSE NML message).
- The Axis 'Resume from pause' (clicking pause button in paused state)
causes transition to the running state (EMC_TASK_PLAN_RESUME NML message).
- The Axis 'Step' button resumes the pause for the current motion if
paused in the initial pause position. If not in the initial pause
position, it triggers a return move. (EMC_TASK_PLAN_STEP NML message).
- The joint jog requests (EMC_AXIS_JOG NML message) are currently ignored.
HAL flows:
- apply an offset:
- apply desired offset values to pause-offset*
- In state = 1 or 2:
- if pause-offset-in-range is true, enable pause-offset-enable ->
move starts, state changes to 4 (jogging)
- stop current jog: disable pause-offset-enable, curent jog move in
progress stops immediately.
- end of jog move reached: keep pause-offset-enable applied until
motion.in-position becomes true.
- continuous jogging: keep pause-offset-enabled - any change to
pause-offset-* will be honored by a corresponding linear move
immediately.
- for pause, step, resume from HAL use halui.program.pause,
halui.program.resume, halui.program.step
Python notes:
for recording/replaying jog history: to determine the current pause point, use the linuxcnc module and
query linuxcnc.stat.position when state is 1 or 2.
Some example supporting code can be found in configs/sim/axis/gladevcp-jwp.py .
Changes in behaviour:
The DRO values for velocity, and distance-to-go are set to zero during
a pause, and thereafter reflect velocity and DTG of the jog moves. On
resume the velocity and DTG values of the initial paused move are restored.
Programming notes
The basic approach is to employ an alternate motion queue - on pause,
motion control is switched to the alternate queue, and arbitrary moves
can be executed. Switchback to the primary motion queue happens on
'resume'; if the current pose doesnt match where execution was paused, a
linear move to the pause point is executed. Then primary motion
queue execution continues as before.
WRT pause, the externally significant change is that 'paused' isnt
just an emcmotStatus flag anymore, but the state of the pause FSM (see
enum pause_state in mot_priv.h). Any state other than 'not paused' is
nonzero which is compatible with current task assumptions.
The semantics of 'step' are now such that if paused on the inital
pause position, a return move to the initial pause position is
executed. That seemed the most logical step to me.
While this implementation relies on the current pause behavior, the
underlying mechanism could be used to for more advanced backout
strategies, like retracting during a threading move.