Skip to main content

RobotiqGripper

Inherits from: object Communicates with the gripper directly, via socket with string commands, leveraging string names for variables. Attributes: ACT (str): Activate (1 while activated, can be reset to clear fault status) GTO (str): Go to (will perform go to with the actions set in pos, for, spe) ATR (str): Auto-release (emergency slow move) ADR (str): Auto-release direction (open(1) or close(0) during auto-release) FOR (str): Force (0-255) SPE (str): Speed (0-255) POS (str): Position (0-255), 0 = open STA (str): Status (0 = is reset, 1 = activating, 3 = active) PRE (str): Position request (echo of last commanded position) OBJ (str): Object detection (0 = moving, 1 = outer grip, 2 = inner grip, 3 = no object at rest) FLT (str): Fault (0=ok, see manual for errors if not zero)

init

RobotiqGripper.__init__()
Initialize a new RobotiqGripper instance.

connect

RobotiqGripper.connect(hostname: str, port: int, socket_timeout: float = 2.0) -> None
Connect to a gripper at the given address.
Arguments
hostname (str)
str
required
Hostname or ip.
port (int)
int
required
Port.
socket_timeout (float)
float
Timeout for blocking socket operations.
Returns
returns
None

disconnect

RobotiqGripper.disconnect() -> None
Close the connection with the gripper.
Returns
returns
None

activate

RobotiqGripper.activate(auto_calibrate: bool = True)
Reset activation flag and reactivate gripper, clearing previous fault flags.
Arguments
auto_calibrate (bool)
bool
Whether to calibrate the minimum and maximum positions based on actual motion.

is_active

RobotiqGripper.is_active()
Check if the gripper is active.
Returns
bool
True if gripper is active.

get_min_position

RobotiqGripper.get_min_position() -> int
Get the minimum position the gripper can reach (open position).
Returns
int
int
Minimum position value.

get_max_position

RobotiqGripper.get_max_position() -> int
Get the maximum position the gripper can reach (closed position).
Returns
int
int
Maximum position value.

get_open_position

RobotiqGripper.get_open_position() -> int
Get what is considered the open position for gripper (minimum position value).
Returns
int
int
Open position value.

get_closed_position

RobotiqGripper.get_closed_position() -> int
Get what is considered the closed position for gripper (maximum position value).
Returns
int
int
Closed position value.

is_open

RobotiqGripper.is_open()
Check if the current position is considered as being fully open.
Returns
bool
True if gripper is fully open.

is_closed

RobotiqGripper.is_closed()
Check if the current position is considered as being fully closed.
Returns
bool
True if gripper is fully closed.

get_current_position

RobotiqGripper.get_current_position() -> int
Get the current position as returned by the physical hardware.
Returns
int
int
Current position value.

get_grip_detected

RobotiqGripper.get_grip_detected() -> bool
Get the current object status as returned by the physical hardware.
Returns
ObjectStatus
bool
Current object status.

auto_calibrate

RobotiqGripper.auto_calibrate(log: bool = True) -> None
Attempt to calibrate the open and closed positions by slowly closing and opening the gripper.
Arguments
log (bool)
bool
Whether to print the results to log.
Returns
returns
None
Raises
RuntimeError
If calibration fails due to an object or other error.

move

RobotiqGripper.move(position: int, speed: int, force: int) -> Tuple[bool, int]
Send commands to start moving towards the given position, with specified speed and force.
Arguments
position (int)
int
required
Position to move to [min_position, max_position]
speed (int)
int
required
Speed to move at [min_speed, max_speed]
force (int)
int
required
Force to use [min_force, max_force]
Returns
returns
Tuple[bool, int]

move_and_wait_for_pos

RobotiqGripper.move_and_wait_for_pos(position: int, speed: int, force: int) -> Tuple[int, ObjectStatus]
Send commands to move to position with specified speed and force, then wait for completion.
Arguments
position (int)
int
required
Position to move to [min_position, max_position]
speed (int)
int
required
Speed to move at [min_speed, max_speed]
force (int)
int
required
Force to use [min_force, max_force]
Returns
returns
Tuple[int, ObjectStatus]
Raises
RuntimeError
If failed to set variables for move.

open

RobotiqGripper.open()
Open the gripper to minimum position with maximum speed and force.

close

RobotiqGripper.close()
Close the gripper to maximum position with maximum speed and force.

get_tool_center_wrt_arm

RobotiqGripper.get_tool_center_wrt_arm()
No docstring provided.