robotiq2f — Robotiq 2F-85 Gripper Driver for Python
A pure-Python, ROS-free driver for the Robotiq 2F-85 (2F85) two-finger adaptive gripper, talking Modbus RTU over USB. It finds the gripper by serial number, activates it, reads its status, and controls its motion.
Fork of PhilNad/2f85-python-driver.
- No ROS, no C++ to compile — just
pip installand import. - Finds the serial port by the device's serial number, so it survives replugging.
- Optional background status polling, so reading state doesn't block on Modbus.
- Compensates for fingertip motion when planning grasps (see TCP offset).
Installation
Requires Python 3.10 or newer.
pip install robotiq2f
Or from a checkout:
git clone https://github.com/RobotControlStack/robotiq2f.git
cd robotiq2f
pip install -ve .
To access the serial port, add yourself to the dialout group, then log out and back in:
sudo adduser $USER dialout
As a temporary alternative that is reset when the gripper is replugged:
sudo chmod 666 /dev/ttyUSB0
Finding your gripper
Lists every /dev/ttyUSB* device with its serial number:
python -m robotiq2f
> /dev/ttyUSB0 DAANTG8W
# the following command also works
udevadm info -a -n /dev/ttyUSB0 | grep serial
The serial number is what you pass to Robotiq2F85(serial_number=...).
Usage
from robotiq2f import Robotiq2F85
# Initialize the driver with the gripper's serial number
gripper = Robotiq2F85(serial_number="DAANTG8W")
# Reset the gripper
gripper.reset()
# Move to fully open (85 mm) at 150 mm/s with up to 235 N
gripper.go_to(opening=85, speed=150, force=235)
# Individual properties
print(gripper.opening) # current opening in mm
print(gripper.current) # motor current in mA
print(gripper.is_moving) # still travelling?
print(gripper.object_detected) # did it stop on an object?
print(gripper.is_activated, gripper.in_fault)
# Or the whole state in one read
status = gripper.read_status()
print(status.opening, status.goal_opening, status.moving, status.fault.overheating)
With async_control=True (the default) a background thread polls the gripper, so these reads are
served from cache instead of blocking on Modbus. See Robotiq2FStatus and GripperFault for the
full set of fields.
TCP offset
Ever had the gripper collide with the table when closing onto a small object? Because of how the gripper is built, the fingertips move away from the base frame as it closes. If your Tool Center Point sits on the fingertips, that shifts the TCP exactly when you need it placed precisely.
tcp_Z_offset(desired_opening) returns how far the TCP travels along the gripper's Z+ axis going from the current opening to the desired one, so the robot can pre-compensate before grasping an object of known thickness.
Development
pip install -ve . && pip install --group dev
make format # isort + black
make checkformat # verify formatting without changing files
make lint # ruff + mypy
make test # pytest
Limitations
Linux only — the serial-port lookup shells out to udevadm, which could be extended to other platforms.
Only the Robotiq 2F-85 is supported, via Robotiq2F85. It inherits from a (for now empty) Robotiq2F base class meant to hold the behaviour shared across the 2F family, once the model-specific calibration constants for other members (e.g. the 2F-140) are parameterized.
License
Release files for robotiq2f 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| robotiq2f-0.2.0.tar.gz | 11.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| robotiq2f-0.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 20.8 kB
Release files / robotiq2f-0.2.0.tar.gz
| Download URL | robotiq2f-0.2.0.tar.gz |
|---|---|
| Size | 11.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
66a1a0e2e965f1b867cc5a4b4f3396a4c0c5521cfb8e25b817b1ab68a6ba64b0
|
|
BLAKE2b-256 checksum How to use checksums |
1297805fc08f3e25ab922ba3479283d037485e5ee33761f728ddc937e61924d0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.15
|
Release files / robotiq2f-0.2.0-py3-none-any.whl
| Download URL | robotiq2f-0.2.0-py3-none-any.whl |
|---|---|
| Size | 9.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9ac6c6f50ad239a3ee070a2399e47492abd4cfce98ffc3d98075d038c3482d5a
|
|
BLAKE2b-256 checksum How to use checksums |
709bdf4431b0481c68a7755ecb99626ac575411d87e657596918ea21a82f106a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.15
|