A Python library for communicating with RH56DFTP devices (tactile hand)
Project description
plusml-rh56dftp Python Library
A Python library for communicating with RH56DFTP devices (tactile hand) via Modbus TCP, developed by plusml.
Features
- Easy-to-use API for communicating with RH56DFTP tactile hand devices
- Support for reading and writing registers
- Built-in logging system for monitoring all operations
- Comprehensive register definitions including force, current, temperature, and error data
- Support for tactile data acquisition from all fingers and palm
- Modular design for easy extension
Installation
From PyPI (Recommended)
You can install the library directly from PyPI using pip:
pip install plusml-rh56dftp
From Source
You can also install the library from the GitHub repository:
git clone https://github.com/plus-m-r/RH56DFTP_teach.git
cd RH56DFTP_teach
pip install -e .
From Local Package
After building the package, you can install it from the generated wheel file:
pip install dist/plusml-rh56dftp-0.1.0-py3-none-any.whl
Requirements
- Python 3.7 or higher
- pymodbus 3.11.3
Usage
Basic Usage
# First install the library: pip install plusml-rh56dftp
from RH56DFTP.RH56DFTP_TCP import RH56DFTP_TCP
# Initialize connection to the tactile hand
try:
# Replace with your device's IP address and port
client = RH56DFTP_TCP(host="192.168.123.210", port=6000)
print("โ
Connected successfully to tactile hand")
# Read device ID
hand_id = client.get("HAND_ID")
print(f"๐ค Hand ID: {hand_id}")
# Write to a register (if supported)
success = client.set("HAND_ID", 2)
print(f"๐ง Set HAND_ID to 2: {success}")
# Read force values from fingers
for finger in range(6):
force = client.get(f"FORCE_ACT({finger})")
print(f"โ Finger {finger} force: {force} g")
# Close connection properly
client.close()
print("๐ Connection closed")
except Exception as e:
print(f"โ Error: {e}")
Register Categories
The library provides predefined register names organized by function:
Device Configuration
HAND_ID: Device ID (1-254)REDU_RATIO: Baud rate settingCLEAR_ERROR: Clear errors commandSAVE: Save configuration to flashRESET_PARA: Restore factory settings
Finger Force Data (Read-only)
FORCE_ACT(0): Pinky finger forceFORCE_ACT(1): Ring finger forceFORCE_ACT(2): Middle finger forceFORCE_ACT(3): Index finger forceFORCE_ACT(4): Thumb bending forceFORCE_ACT(5): Thumb rotation force
Actuator Data (Read-only)
CURRENT(0-5): Actuator current values (mA)ERROR(0-5): Actuator error codesTEMP(0-5): Actuator temperature values (ยฐC)
Tactile Data (Read-only)
- Various tactile data registers for all fingers and palm
- 3x3, 12x8, and 10x8 matrix configurations
- 16-bit integer values (0-4096)
Register Configuration
Register definitions are located in the Register/config/configFTP directory:
ftp_registers.py: Main register configurationftp_registers_keys.py: Register name constants
The library automatically loads these configurations during initialization.
Logging
The library includes a built-in logging system that records:
- All
getandsetoperations with timestamps - Connection status and errors
- Register addresses and values
Logs are saved to rh56dftp.log and also printed to the console with the format:
YYYY-MM-DD HH:MM:SS - RH56DFTP - LEVEL - MESSAGE
Project Structure
RH56DFTP_teach/
โโโ RH56DFTP/ # Main library code
โ โโโ RH56DFTP_base.py # Abstract base class
โ โโโ RH56DFTP_base.pyi # Type hints for base class
โ โโโ RH56DFTP_TCP.py # TCP implementation
โ โโโ RH56DFTP_TCP.pyi # Type hints for TCP implementation
โ โโโ __init__.py # Package initialization
โโโ Register/ # Register configuration
โ โโโ config/ # Configuration files
โ โ โโโ configFTP/ # FTP register configs
โ โโโ RegisterKey/ # Register name constants
โ โโโ RegisterSet/ # Register classes
โโโ connect.py # Example connection script
โโโ LICENSE # MIT License file
โโโ README.md # This file
โโโ pyproject.toml # Modern package configuration
โโโ setup.py # Package setup (legacy)
โโโ requirements.txt # Dependencies
Development
Building the Package
To build the package for distribution (recommended method):
python -m build
This will generate:
dist/plusml-rh56dftp-0.1.0.tar.gz(source distribution)dist/plusml-rh56dftp-0.1.0-py3-none-any.whl(wheel distribution)
License
MIT License
Repository
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file plusml_rh56dftp-0.1.1.tar.gz.
File metadata
- Download URL: plusml_rh56dftp-0.1.1.tar.gz
- Upload date:
- Size: 20.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b2cab3a12290b10a0c8b11b143e6180ae4cc04aabd23bd99b6ed1db5384be992
|
|
| MD5 |
690f81a10d41185ade5f4e48a0ee1d09
|
|
| BLAKE2b-256 |
2a937b9ce37551dff26d1730ff09fc53f2c51850983c0cffd868cb210ea8c4d7
|
File details
Details for the file plusml_rh56dftp-0.1.1-py3-none-any.whl.
File metadata
- Download URL: plusml_rh56dftp-0.1.1-py3-none-any.whl
- Upload date:
- Size: 23.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5baeb0c0870df59d155dbacb86ee87ca5de3be281a57b28db729291e7e6fbc3e
|
|
| MD5 |
4e1f77441285364d0d2a7b340026057c
|
|
| BLAKE2b-256 |
391d7bb18b085530a3c560db3c9505ebc074b50225cf3f12d94430fdffcdcba9
|