Skip to content

move_gripper

Queued EXEC mode Enabled Homed Takes control

Move the gripper's jaws to a position, as a queued command. The position is on the gripper's own scale, not in millimetres: 0 is the fully open end and 255 the fully closed end, as the gripper found them when it was calibrated, and the scale runs evenly in between. open_gripper() and close_gripper() use 1 and 254. A part between the jaws stops them, and they keep pressing on it with current.

Otherwise it behaves like them. The command waits in the queue like a move, but the robot starts the jaws as soon as it has sent the moves queued before it, so jaws and arm can move at the same time. It has settled when the jaws are within 5 of the target, or when the gripper steadily reports that they reached it or that something stopped them; gripper_result() then says which.

Syntax

robot.move_gripper(position, speed=None, current=None, timeout=120.0, **options)

Arguments

Name Type Default Description
position int required The target, from 0 (fully open) to 255 (fully closed). A fraction is dropped: 127.9 is sent as 127.
speed int | None None How fast the jaws move, from 0 (slowest) to 255 (fastest) on the gripper's scale. None means 100.
current int | None None The gripper motor's current limit while the jaws move and hold, in mA: they press with up to this current, and a stop against something is reported once they press with most of it. None means 200 mA. At most the current limit in the gripper's configuration.
timeout float 120.0 Seconds to wait for the jaws to settle, in sync mode only.
**options Any each setting's own Settings for this move only. Each one you leave out takes its default: speed = 100 % accel = 100 % duration = none (the speed decides) profile = "ruckig" jerk = 100 % ramp_fraction = 0.25 blend = 0 blend_mode = "exact_velocity" blend_continuity = "c1" ik_solver = "pinocchio" singularity_strategy = "stop" samples = automatic dry_run = False

Returns

str

The command id. The call returns once the robot has accepted the command; call wait_gripper_move_complete() to wait until the jaws have settled. In sync mode the call returns when they have settled.

Examples

robot.move_gripper(128)
robot.wait_gripper_move_complete()
robot.move_gripper(200, speed=50, current=300)
robot.wait_gripper_move_complete()

Further details

Note

The gripper has one target at a time. A gripper command that starts before the previous one has settled replaces it, and the previous one fails with SUPERSEDED. Call wait_gripper_move_complete() between two gripper commands.

Further details

Warning

The jaws move with force and press on whatever stops them. Keep hands away from them. stop(), disable() and an error stop the jaws where they are.

Usage restrictions 15 codes

This command is added to the robot's motion queue. The robot accepts it only when it is ready for motion (EXEC mode, enabled and homed), from the client that holds control or when no client does. Otherwise, the robot refuses it with one of:

  • [6010] Command not allowed now — the message names the mode or state it needs
  • [6101] Control held by another client — another client holds control; the message names it
  • [5002] Program aborted — an earlier move failed; clear errors first
  • [6004] Invalid motion options — a setting is unknown, out of range, or refused for a single move
  • [6011] Motion queue full

Once accepted, the move can still fail before it starts:

  • [2304] Gripper did not settle — the jaws had neither reached the target nor reported an object in time: 5 s at speed 100 or faster, and longer the lower speed is (about 30 s at speed 15). The commands queued after it still run
  • [5110] Invalid curve arguments — position or speed is outside 0 to 255, or current is below 1 mA or above the current limit in the gripper's configuration
  • [6020] Gripper command replaced — another gripper command started before this one settled and replaced its target. The commands queued after it still run
  • [6023] No gripper — the robot has no CAN gripper; nothing is queued
  • [6024] Gripper in motor mode — the gripper is in motor mode (set_gripper_ctrl_mode()); nothing is queued
  • [5001] Trajectory planning failed
  • [3201] Trajectory not taken by RTI

A move that has started can end early with:

  • [5003] Command cancelled — an earlier move failed, or the robot left EXEC mode
  • [5004] Command stopped — stop() was called
  • [5005] Move did not settle — only with set_completion_policy("strict")

In Python, a refusal raises CommandRejected; its number is the code above. A failure after the robot accepted the move is raised by wait_idle() as MotionFailed, or by this call itself in sync mode as CommandRejected. No answer raises RobotTimeout; no connection, RobotConnectionError. ValueError: position, speed or current cannot be read as a whole number, for example the text "half". Nothing is sent.

Protocol

A client that does not use robotclient sends this over the TCP command protocol (port 29000) for the example above:

{"id": "c1", "cmd": "move_gripper", "args": [128]}

See also