Skip to content

is_reachable

Runs at once Any mode Open to every client

Check whether the arm can reach a pose, without moving it. The robot searches for joint angles that put the tool centre point at the pose, within 0.2 mm and 0.5 degrees, with every joint inside its software limits. It starts from near, then from 128 fixed points spread over the joint range, so a pose always gets the same answer. Of the solutions it finds, it returns the one closest to near that keeps the arm's parts apart by the planner's self-collision margin. It also checks the pose against the enabled safety zones that stop the robot, margins included. A pose out of reach takes around 50 ms to refuse.

It checks the end pose only. A move_joints() to the joints returned can still be refused for its path, which can cross a safety zone or bring two parts of the arm too close. move_pose() searches only near where the arm stands, so it can refuse a pose this call finds reachable.

Syntax

robot.is_reachable(x, y, z, rx, ry, rz, near=None, *, angle_unit='rad')

Arguments

Name Type Default Description
x float required Position along the base X axis, in metres.
y float required Position along the base Y axis, in metres.
z float required Position along the base Z axis, in metres.
rx float required Turn about the base X axis, in radians, or degrees with angle_unit="deg". The orientation is R = Rx(rx) Ry(ry) Rz(rz).
ry float required Turn about the tool's new Y axis, in the same unit.
rz float required Turn about the tool's own Z axis, in the same unit.
near Sequence[float] | None None Joint angles in degrees, one per joint, J1 first: the solution closest to them is preferred. None means the arm's measured angles now.
angle_unit str 'rad' "rad" or "deg": the unit of rx, ry and rz. near is in degrees either way.

Returns

dict

A dict: reachable: True when joint angles inside the limits reach the pose. joints: those joint angles in degrees, J1 first, or None when the pose is out of reach. allowed: True when the pose is reachable, outside every stopping safety zone and clear of self-collision. zone: the name of a stopping safety zone the pose is in, or None. self_collision: the two parts of the arm that come too close, such as "upper arm and tool", when every solution found does so; joints is then the closest of those. Otherwise None.

Examples

x, y, z, rx, ry, rz = robot.get_pose()
answer = robot.is_reachable(x, y, z - 0.05, rx, ry, rz)
answer["allowed"]
robot.move_joints(*answer["joints"])
robot.wait_idle()
Usage restrictions 4 codes

This command runs at once; it is not queued. The robot accepts it in any mode and state, from every client.

It answers with one of these codes when it does not carry the command out:

  • [6022] Client too old for pose commands — only a raw client that sends no "protocol": 2
  • [6003] Invalid arguments — a value is not a finite number, or near does not have one angle per joint
  • [6019] No robot model — the robot software could not load the arm's model, so it cannot search
  • [7004] Self-collision model not built — self-collision checking is on, but its model could not be built from the geometry files

In Python, a code above raises CommandRejected; its number is the code. The call raises:

  • CommandRejected: The robot refused it; the code says why (see Errors).
  • RobotTimeout: The robot did not answer within 5 s.
  • RobotConnectionError: The client is not connected.
  • ValueError: angle_unit is neither "rad" nor "deg", or a value is not a number. Nothing is sent.
  • TypeError: A value is None, or near is not a sequence of numbers. Nothing is sent.

If the connection drops while the call waits for the robot's answer, it raises CommandRejected with the code CONNECTION_LOST (DISCONNECTED after disconnect()); while it waits for the robot's status, RobotConnectionError.

Like every immediate command, it also answers BAD_ARGS when a raw client sends a value the robot cannot read at all, and INTERNAL when it fails inside the robot.

Protocol

A client that does not use robotclient sends this over the TCP command protocol (port 29000) for the example above, with the tool at the standard start pose (get_pose() returning [0.0, 0.2617, 0.2329, -2.0944, 0.0, -1.5708]):

{"id": "c1", "cmd": "is_reachable", "args": [0.0, 0.2617, 0.1829, -2.0944, 0.0, -1.5708], "protocol": 2}

See also