A simple robotiq gripper driver based on pymodbus.
pip install -e .from robotiq_gripper import RobotiqModBusGripper
gripper = RobotiqModBusGripper(
# For Robotiq 2F-85, the standard width is 0.085m (for Robotiq 2F-140, it is 0.140m), you can adjust it according to your gripper
width=0.085,
# Make sure your serial port and slave ID are correct. These two are common default values.
port='/dev/ttyUSB0',
slave_id=9
)
gripper.activate()
gripper.move(0.04) # Move to 0.04m
gripper.open() # Open the gripper fully
gripper.close() # Close the gripper fully
pos = gripper.get_position()
print(f"Current position: {pos} m")