Skip to content

get_zones

Runs at once Any mode Open to every client

Return the safety zones in force. A zone describes the cell around the robot, not the arm: an allowed zone is a space the robot must stay inside, a forbidden one a space it must stay out of. The robot checks the tool centre point and the gripper's tool spheres against every enabled zone: the planner before each EXEC move, keeping the zone's margin, and the safety monitor on the measured pose, once a sphere is more than 5 mm past the zone's surface (<safety_monitor><zone_tolerance> in config/system.xml). In freedrive a zone can push back as a wall you feel.

It asks the robot for what is in force now and moves nothing.

Syntax

robot.get_zones()

Arguments

None.

Returns

dict

A dict with four keys: - cell: the active cell's name, from config/system.xml <active_cell>; "" means no zones. - zones: one dict per zone of the cell file, disabled ones included: name; shape ("box", "prism", "cylinder", "sphere" or "plane"); kind ("allowed" or "forbidden"); reaction ("stop": the error Z_<name>:ZONE_VIOLATION stops the robot; "warn": a live Z_<name>:ZONE_WARNING); checks ("tool": the tool centre point and the tool spheres; "tcp": the point only); margin (m, the planner's clearance); enabled; haptic (a wall in freedrive); freedrive ("warn" or "stop": the reaction when pushed through by hand); geometry, in metres in the base frame (box: min, max; prism: vertices, z_min, z_max; cylinder: p1, p2, radius, rounded; sphere: center, radius; plane: point, normal). - tool_spheres: [x, y, z, radius] per tool sphere, in metres, in the tool frame. - haptic_walls: the <haptic_walls> policy of config/system.xml: enabled, stiffness (N/m), damping (N s/m), max_force (N), breakthrough (m), velocity_tau (s), zone_mass_scaled, joint_walls, joint_max_torque (Nm), joint_breakthrough (deg).

Examples

zones = robot.get_zones()
[z["name"] for z in zones["zones"] if z["enabled"]]
Usage restrictions never refused

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

It never answers with an error code.

In Python, the call raises:

  • RobotTimeout: The robot did not answer within 5 s.
  • RobotConnectionError: The client is not connected.

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:

{"id": "c1", "cmd": "get_zones", "args": []}

See also