Giter Club home page Giter Club logo

python-rhp12rn-controller's Introduction

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:

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:

from rhp12rn import RHP12RNAConnector

connector = RHP12RNAConnector(device="/dev/ttyUSB0", baud_rate=57600, dynamixel_id=1)
connector.connect()
...
connector.disconnect()

RHP12RNAConnector instances can also be used as context managers:

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:

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 https://emanual.robotis.com/docs/en/platform/rh_p12_rna/ or https://emanual.robotis.com/docs/en/platform/rh_p12_rn/. 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:

import time
from rhp12rn import RHP12RN

rhp12rn = 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:

from rhp12rn import find_grippers
found_grippers = find_grippers(device="/dev/ttyUSB0")

python-rhp12rn-controller's People

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.