Skip to content

Commit ad8668a

Browse files
authored
Merge pull request #235 from RobotControlStack/feat/robotiq
feat: add robotiq support
2 parents 45377c7 + 89c7d81 commit ad8668a

File tree

9 files changed

+129
-1
lines changed

9 files changed

+129
-1
lines changed

.github/workflows/ci.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ jobs:
7171
# Python extensions
7272
- rcs_xarm7
7373
- rcs_realsense
74-
# - rcs_robotiq
74+
- rcs_robotiq2f85
7575
- rcs_tacto
7676
- rcs_usb_cam
7777
runs-on: ubuntu-latest

docs/extensions/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,5 @@ rcs_realsense
1212
rcs_usb_cam
1313
rcs_tacto
1414
rcs_robotics_library
15+
rcs_robotiq2f85
1516
```

docs/extensions/overview.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ RCS comes with several supported extensions:
3030
- **rcs_usb_cam**: Support for generic USB webcams.
3131
- **rcs_tacto**: Integration with the Tacto tactile sensor simulator.
3232
- **rcs_robotics_library**: Integration with the Robotics Library (RL).
33+
- **rcs_robotiq2f85**: Integration with the Robotiq 2F-85 Gripper.
3334

3435
## Creating Extensions
3536

docs/extensions/rcs_robotiq2f85.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# RCS Robotiq2F85 Extension
2+
3+
This extension provides support for Robotiq 2F-85 Gripper in RCS.
4+
5+
## Installation
6+
7+
```shell
8+
pip install -ve extensions/rcs_robotiq2f85
9+
```
10+
11+
Get the serial number of the gripper with this command:
12+
```shell
13+
udevadm info -a -n /dev/ttyUSB0 | grep serial
14+
```
15+
16+
Provide the necessary permission:
17+
```shell
18+
chmod 777 /dev/ttyUSB0
19+
```
20+
21+
## Usage
22+
```python
23+
from rcs_robotiq2f85 import RobotiQGripper
24+
25+
gripper = RobotiQGripper('<YOUR_SERIAL_NUMBER>')
26+
gripper.reset()
27+
gripper.shut()
28+
print(gripper.get_normalized_width())
29+
```
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# RCS Robotiq 2F-85 Gripper Hardware Extension
2+
Extension to use the Robotiq 2F-85 Gripper with rcs.
3+
4+
## Installation
5+
```shell
6+
pip install -ve .
7+
```
8+
9+
Get the serial number of the gripper with this command:
10+
```shell
11+
udevadm info -a -n /dev/ttyUSB0 | grep serial
12+
```
13+
14+
Provide the necessary permission:
15+
```shell
16+
chmod 777 /dev/ttyUSB0
17+
```
18+
19+
## Usage
20+
```python
21+
from rcs_robotiq2f85 import RobotiQGripper
22+
23+
gripper = RobotiQGripper('<YOUR_SERIAL_NUMBER>')
24+
gripper.reset()
25+
gripper.shut()
26+
print(gripper.get_normalized_width())
27+
```
28+
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
[build-system]
2+
requires = ["setuptools"]
3+
build-backend = "setuptools.build_meta"
4+
5+
[project]
6+
name = "rcs_robotiq2f85"
7+
version = "0.6.2"
8+
description="RCS RobotiQ module"
9+
dependencies = [
10+
"rcs>=0.6.2",
11+
"2f85-python-driver @ git+https://github.com/PhilNad/2f85-python-driver.git",
12+
]
13+
readme = "README.md"
14+
maintainers = [
15+
{ name = "Tobias Jülg", email = "tobias.juelg@utn.de" },
16+
]
17+
authors = [
18+
{ name = "Tobias Jülg", email = "tobias.juelg@utn.de" },
19+
]
20+
requires-python = ">=3.10"
21+
license = { text = "AGPL-3.0-or-later" }
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
__version__ = "0.6.2"
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
from rcs._core.common import Gripper
2+
from Robotiq2F85Driver.Robotiq2F85Driver import Robotiq2F85Driver
3+
4+
5+
class RobotiQGripper(Gripper):
6+
def __init__(self, serial_number):
7+
super().__init__()
8+
self.gripper = Robotiq2F85Driver(serial_number=serial_number)
9+
10+
def get_normalized_width(self) -> float:
11+
# value between 0 and 1 (0 is closed)
12+
return self.gripper.opening / 85
13+
14+
def grasp(self) -> None:
15+
"""
16+
Close the gripper to grasp an object.
17+
"""
18+
self.set_normalized_width(0.0)
19+
20+
def open(self) -> None:
21+
"""
22+
Open the gripper to its maximum width.
23+
"""
24+
self.set_normalized_width(1.0)
25+
26+
def reset(self) -> None:
27+
self.gripper.reset()
28+
29+
def set_normalized_width(self, width: float, _: float = 0) -> None:
30+
"""
31+
Set the gripper width to a normalized value between 0 and 1.
32+
"""
33+
if not (0 <= width <= 1):
34+
msg = f"Width must be between 0 and 1, got {width}."
35+
raise ValueError(msg)
36+
abs_width = width * 85
37+
self.gripper.go_to(opening=float(abs_width), speed=150.0, force=30.0)
38+
39+
def shut(self) -> None:
40+
"""
41+
Close the gripper.
42+
"""
43+
self.set_normalized_width(0.0)

pyproject.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,4 +214,8 @@ version_files = [
214214
"extensions/rcs_tacto/pyproject.toml:version",
215215
"extensions/rcs_tacto/src/rcs_tacto/__init__.py:__version__",
216216
"extensions/rcs_tacto/pyproject.toml:\"rcs>=(.*)\"",
217+
218+
"extensions/rcs_robotiq2f85/pyproject.toml:version",
219+
"extensions/rcs_robotiq2f85/src/rcs_robotiq2f85/__init__.py:__version__",
220+
"extensions/rcs_robotiq2f85/pyproject.toml:\"rcs>=(.*)\"",
217221
]

0 commit comments

Comments
 (0)