Skip to content

wait_idle

Runs in the client Sends nothing to the robot

Wait until every command this client queued has finished. It waits for this client's queued commands only: the moves, delays and gripper commands the robot accepted from it and has not yet answered as done. A command is done when it has finished, as set_completion_policy() defines it, or when it has failed. Another client's commands are not waited for.

A queued command can fail after the robot accepted it: the robot cannot plan it (for example JOINT_LIMIT), stop() cancels it (STOPPED), or an earlier command failed or the robot left EXEC mode (ABORTED). The call reports every such failure since its last call, then forgets them, so a program that ran only part of its moves does not go on unnoticed. This client's stop() discards the failures not yet reported, and a failure a call already raised (a sync-mode command, wait_motion_complete(), wait_gripper_move_complete()) is not reported again. A command the robot refused when it was sent is not among them: its own call raised CommandRejected. When the connection is lost, the commands still running count as failed, with the code CONNECTION_LOST, or DISCONNECTED after disconnect().

Syntax

robot.wait_idle(timeout=None, raise_on_error=True)

Arguments

Name Type Default Description
timeout float | None None Seconds to wait at most. None waits as long as it takes; 0 checks once without waiting.
raise_on_error bool True True raises MotionFailed when a command failed; False returns the failures instead.

Returns

list[dict]

The failures since the last call, in the order they arrived: a dict each, with id (the id the queued call returned), code and message, and the error catalog's number, title and fix when the robot sent them. An empty list when every command finished, and always with raise_on_error=True.

Examples

robot.move_joints(90, -105, 165, 0, -30, 180)
robot.move_joints(90, -100, 160, 0, -30, 180)
robot.wait_idle()
robot.move_joints(90, -105, 165, 0, -30, 180)
failures = robot.wait_idle(timeout=60, raise_on_error=False)

Exceptions

  • MotionFailed: With raise_on_error=True, a command failed. Its failures holds the list described under Returns.
  • RobotTimeout: A command had not finished after timeout. The failures seen so far stay for the next call.

See also