How to detect that all sent (MovePT) motion has executed?

There are times when we transition RMP from MOVING to STOPPED/IDLE. On some of those occasions, I want to wait for the transition to finish and wait for all the motion to have finished executing (so that I know that the motor is not moving).

What’s the best way to know that all my MovePT() motion has executed?
The documentation doesn’t specifically answer my question. Here are some ideas I have:

Do you have a recommendation?

MotionDoneGet() for a quick evaluation.
MotionDoneWait() to simply hold until it is complete There is an overload for this which takes a timeout so you don’t hang indefinitely.

1 Like

If your MovePT finishes normally, you can do something like:

ptID = MotionIdGet() // or you can set it here with MotionIdSet()
wait for motion to complete…
check to see that MotionIdExecutingGet() matches ptID.

if you get a TRIGGERED_MODIFY during motion, it will change the executing MotionID to 0.

If you are using interrupts and waiting for a MOTION_DONE interrupt, when you get it you can use InterruptMotionIDGet().

1 Like