Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ jobs:
# Python extensions
- rcs_xarm7
- rcs_realsense
# - rcs_robotiq
- rcs_robotiq2f85
- rcs_tacto
- rcs_usb_cam
runs-on: ubuntu-latest
Expand Down
1 change: 1 addition & 0 deletions docs/extensions/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@ rcs_realsense
rcs_usb_cam
rcs_tacto
rcs_robotics_library
rcs_robotiq2f85
```
1 change: 1 addition & 0 deletions docs/extensions/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ RCS comes with several supported extensions:
- **rcs_usb_cam**: Support for generic USB webcams.
- **rcs_tacto**: Integration with the Tacto tactile sensor simulator.
- **rcs_robotics_library**: Integration with the Robotics Library (RL).
- **rcs_robotiq2f85**: Integration with the Robotiq 2F-85 Gripper.

## Creating Extensions

Expand Down
29 changes: 29 additions & 0 deletions docs/extensions/rcs_robotiq2f85.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# RCS Robotiq2F85 Extension

This extension provides support for Robotiq 2F-85 Gripper in RCS.

## Installation

```shell
pip install -ve extensions/rcs_robotiq2f85
```

Get the serial number of the gripper with this command:
```shell
udevadm info -a -n /dev/ttyUSB0 | grep serial
```

Provide the necessary permission:
```shell
chmod 777 /dev/ttyUSB0
```

## Usage
```python
from rcs_robotiq2f85 import RobotiQGripper

gripper = RobotiQGripper('<YOUR_SERIAL_NUMBER>')
gripper.reset()
gripper.shut()
print(gripper.get_normalized_width())
```
28 changes: 28 additions & 0 deletions extensions/rcs_robotiq2f85/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# RCS Robotiq 2F-85 Gripper Hardware Extension
Extension to use the Robotiq 2F-85 Gripper with rcs.

## Installation
```shell
pip install -ve .
```

Get the serial number of the gripper with this command:
```shell
udevadm info -a -n /dev/ttyUSB0 | grep serial
```

Provide the necessary permission:
```shell
chmod 777 /dev/ttyUSB0
```

## Usage
```python
from rcs_robotiq2f85 import RobotiQGripper

gripper = RobotiQGripper('<YOUR_SERIAL_NUMBER>')
gripper.reset()
gripper.shut()
print(gripper.get_normalized_width())
```

21 changes: 21 additions & 0 deletions extensions/rcs_robotiq2f85/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
[build-system]
requires = ["setuptools"]
build-backend = "setuptools.build_meta"

[project]
name = "rcs_robotiq2f85"
version = "0.6.2"
description="RCS RobotiQ module"
dependencies = [
"rcs>=0.6.2",
"2f85-python-driver @ git+https://github.com/PhilNad/2f85-python-driver.git",
]
readme = "README.md"
maintainers = [
{ name = "Tobias Jülg", email = "tobias.juelg@utn.de" },
]
authors = [
{ name = "Tobias Jülg", email = "tobias.juelg@utn.de" },
]
requires-python = ">=3.10"
license = { text = "AGPL-3.0-or-later" }
1 change: 1 addition & 0 deletions extensions/rcs_robotiq2f85/src/rcs_robotiq2f45/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__version__ = "0.6.2"
43 changes: 43 additions & 0 deletions extensions/rcs_robotiq2f85/src/rcs_robotiq2f45/hw.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
from rcs._core.common import Gripper
from Robotiq2F85Driver.Robotiq2F85Driver import Robotiq2F85Driver


class RobotiQGripper(Gripper):
def __init__(self, serial_number):
super().__init__()
self.gripper = Robotiq2F85Driver(serial_number=serial_number)

def get_normalized_width(self) -> float:
# value between 0 and 1 (0 is closed)
return self.gripper.opening / 85

def grasp(self) -> None:
"""
Close the gripper to grasp an object.
"""
self.set_normalized_width(0.0)

def open(self) -> None:
"""
Open the gripper to its maximum width.
"""
self.set_normalized_width(1.0)

def reset(self) -> None:
self.gripper.reset()

def set_normalized_width(self, width: float, _: float = 0) -> None:
"""
Set the gripper width to a normalized value between 0 and 1.
"""
if not (0 <= width <= 1):
msg = f"Width must be between 0 and 1, got {width}."
raise ValueError(msg)
abs_width = width * 85
self.gripper.go_to(opening=float(abs_width), speed=150.0, force=30.0)

def shut(self) -> None:
"""
Close the gripper.
"""
self.set_normalized_width(0.0)
4 changes: 4 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -214,4 +214,8 @@ version_files = [
"extensions/rcs_tacto/pyproject.toml:version",
"extensions/rcs_tacto/src/rcs_tacto/__init__.py:__version__",
"extensions/rcs_tacto/pyproject.toml:\"rcs>=(.*)\"",

"extensions/rcs_robotiq2f85/pyproject.toml:version",
"extensions/rcs_robotiq2f85/src/rcs_robotiq2f85/__init__.py:__version__",
"extensions/rcs_robotiq2f85/pyproject.toml:\"rcs>=(.*)\"",
]
Loading