Skip to main content

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 setting
  • CLEAR_ERROR: Clear errors command
  • SAVE: Save configuration to flash
  • RESET_PARA: Restore factory settings

Finger Force Data (Read-only)

  • FORCE_ACT(0): Pinky finger force
  • FORCE_ACT(1): Ring finger force
  • FORCE_ACT(2): Middle finger force
  • FORCE_ACT(3): Index finger force
  • FORCE_ACT(4): Thumb bending force
  • FORCE_ACT(5): Thumb rotation force

Actuator Data (Read-only)

  • CURRENT(0-5): Actuator current values (mA)
  • ERROR(0-5): Actuator error codes
  • TEMP(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 configuration
  • ftp_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 get and set operations 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

https://github.com/plus-m-r/RH56DFTP_teach

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

plusml_rh56dftp-0.1.5.tar.gz (21.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

plusml_rh56dftp-0.1.5-py3-none-any.whl (24.4 kB view details)

Uploaded Python 3

File details

Details for the file plusml_rh56dftp-0.1.5.tar.gz.

File metadata

  • Download URL: plusml_rh56dftp-0.1.5.tar.gz
  • Upload date:
  • Size: 21.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for plusml_rh56dftp-0.1.5.tar.gz
Algorithm Hash digest
SHA256 f4a2c9f4d0d287e9a3e641760d75fdaad9c0e74dd87d6f012eba3f50fae697e4
MD5 9a5e2d9edf643e51b2c964298e69646b
BLAKE2b-256 488582091abea9f2d22123e83153e15198bc637ee83cb098c6f3531d256586f5

See more details on using hashes here.

File details

Details for the file plusml_rh56dftp-0.1.5-py3-none-any.whl.

File metadata

File hashes

Hashes for plusml_rh56dftp-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 c55af8c686270a3b0e96534bf5c09a1f0dc823f7522919f9c9183a90c42d018a
MD5 f84e159af76d62f71f33c4f65fa9ddbd
BLAKE2b-256 88717e95ea5dda9b595155bafc8397e30066f44de0fe65528af8a4b5f4cf5b70

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page