Pause and Continue

Pausing the robot’s movement can be useful to react to external events during program execution. When a pause command is sent, the robot decelerates along its current path until it comes to a complete stop. While paused, new instructions can still be registered, but they will only be executed once the pause signal is revoked.

Pausing the Robot’s Movement

To pause the robot, the pause_motion() command must be called, which takes an optional timeout parameter to define the maximum time the robot is given to settle. If no explicit value is defined, it will default to 5 seconds. The pause_motion() method will only return after the robot has come to a stop or will raise an error in case of a failure to stop in due time. It can be send either in standstill or while the robot is moving:

robot.move_ptp(HOME).result()
robot.move_ptp(ZERO)
do_some_work()
robot.pause_motion()

Note that the motion instruction to the ZERO pose is called asynchronously, which allows a pause during movement. The do_some_work() method is a placeholder, which in this case only waits until the robot starts moving.

After invoking pause_motion() the execution of new motion instructions (in this case a motion to the VERTICAL pose) is blocked. However, they are added to the instruction queue.

robot.pause_motion()
vertical_command = robot.move_ptp(VERTICAL)
do_some_work()
robot.continue_motion()
vertical_command.result()

Only after the continue_motion() command is called, the robot continues the execution of all queued motion instructions, which means it first moves to the ZERO pose and afterwards to the VERTICAL pose.

Here is an example of how to use the pause and continue methods:

Definition of the Pause and Continue Methods

The pause and continue methods are defined in the PauseContinueTrait: