Skip to main content

Quick Start

import time
from xensegripper import XenseGripper

gripper = XenseGripper.create(mac_addr="d672f584b17a")
try:
# 0 mm = closed, 85 mm = open
gripper.set_position(40, vmax=80, fmax=27)
time.sleep(1)

status = gripper.get_gripper_status()
print(status)

# Synchronous move: returns after reaching the target or timing out
ok = gripper.set_position_sync(70, vmax=80, fmax=27, timeout=5.0)
print("reached:", ok)
finally:
# Close the DDS client and release resources
gripper.release()

SAFE mode​

gripper = XenseGripper.create(mac_addr="d672f584b17a")
try:
with gripper.mode(XenseGripper.ControlMode.SAFE, serial_number="OP000064"):
gripper.set_control_param(stiffness=0.35)
gripper.set_position(30)
finally:
gripper.release()

In SAFE mode, motion is primarily controlled by the controller parameters; set_position() only sets the target position. The previous mode is restored when the with block exits. If you call enable_mode manually, always call disable_mode() before the application exits.

Always pass serial_number explicitly when entering SAFE mode. Call gripper.release() before the program exits regardless of the control mode used.