Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/timschneider42/dynamixel-api
Python controller for the RH-P12-RN gripper
https://github.com/timschneider42/dynamixel-api
dynamixel gripper gripper-control python rhp12rn rhp12rna robotis
Last synced: 16 days ago
JSON representation
Python controller for the RH-P12-RN gripper
- Host: GitHub
- URL: https://github.com/timschneider42/dynamixel-api
- Owner: TimSchneider42
- License: mit
- Created: 2021-11-24T11:34:48.000Z (about 3 years ago)
- Default Branch: master
- Last Pushed: 2024-12-04T14:29:27.000Z (18 days ago)
- Last Synced: 2024-12-04T15:30:53.765Z (18 days ago)
- Topics: dynamixel, gripper, gripper-control, python, rhp12rn, rhp12rna, robotis
- Language: Python
- Homepage:
- Size: 160 KB
- Stars: 1
- Watchers: 1
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# python-rhp12rn-controller
Python controller for the ROBOTIS RH-P12-RN and RH-P12-RN(A) grippers.
## Installation
This package can be installed via pip:
```bash
pip install git+https://github.com/TimSchneider42/python-rhp12rn-controller.git
```## Usage
First, create a `RHP12RNConnector` or `RHP12RNAConnector` instance depending on your gripper model and call the `connect()` function to establish a serial connection to the gripper:
```python
from rhp12rn import RHP12RNAConnectorconnector = RHP12RNAConnector(device="/dev/ttyUSB0", baud_rate=57600, dynamixel_id=1)
connector.connect()
...
connector.disconnect()
````RHP12RNAConnector` instances can also be used as context managers:
```python
with RHP12RNAConnector(device="/dev/ttyUSB0", baud_rate=57600, dynamixel_id=1) as connector:
...
```The `connector` object allows reading and writing of arbitrary addresses of the gripper's control table:
```python
print(connector.read_field("torque_enable"))
connector.write_field("torque_enable", 1)
print(connector.read_field("torque_enable"))
```
For a comprehensive list of its entries, refer to or .
Alternatively, all entries are listed in `rhp12rn_connector.py` and `rhp12rna_connector.py`.
Note that the motors have to be disabled (`"torque_enabled"` has to be set to 0) for EEPROM values to be written, while RAM values can be written at any time.For convenience, the `RHP12RN` class provides direct access to the most commonly used fields:
```python
import time
from rhp12rn import RHP12RNrhp12rn = RHP12RN(connector)
rhp12rn.torque_enabled = True
rhp12rn.goal_position = 1.0
time.sleep(3.0)
rhp12rn.torque_enabled = False
```For a full example of the usage of this package, refer to `example/open_close.py`.
### Finding the correct baud rate and Dynamixel ID
If the baud rate and/or Dynamixel ID is unknown, the `find_grippers` method can be used to find those parameters by performing a full sweep. It can be invoked as follows:
```python
from rhp12rn import find_grippers
found_grippers = find_grippers(device="/dev/ttyUSB0")
```