Skip to main content

Python driver and CLI for the OnRobot 3FG15 gripper via Modbus TCP/RTU

Project description

OnRobot 3FG15 Gripper Python Package

Build and Test License: MIT repo size

Overview

This package provides a Python driver and command-line interface (CLI) for controlling the OnRobot 3FG15 gripper. It supports communication over Modbus TCP and RTU protocols, enabling precise control over the gripper's 3-finger parallel mechanism, including external and internal gripping modes. The package also supports object detection features integrated into the gripper.

Package Features

  • Python driver for OnRobot 3FG15 gripper
  • Command-line interface (CLI) with subcommands for RTU and TCP communication to control all functions of the gripper
  • Support for Modbus TCP and Modbus RTU protocols
  • Object detection and grip force/diameter control

Communication Modes and Pin Connections

The gripper can be controlled via two Modbus communication modes:

  • Modbus TCP: Connect via Ethernet using the Modbus TCP protocol.
  • Modbus RTU: Connect via serial interface (RS-485) using Modbus RTU protocol.

Pin connections for the gripper electrical interface (female M8x8 connector):

  • Pin 1: RS485+
  • Pin 2: RS485-
  • Pin 3: GND
  • Pin 7: +24V

Requirements

Software

  • Python 3.8 or higher
  • pymodbus library for Modbus communication
  • typer library for CLI interface

Hardware

  • OnRobot 3FG15 Gripper
  • Modbus interface (USB-RS-485 for RTU with a supported baudrate of 1 000 000, most Modbus TCP<->RTU interface wont work with such high baudrates!)

Installation

Install the package using pip:

$ pip install threefg15

# or for local development/usage
$ git clone https://github.com/RBEGamer/OnRobot3FG15
$ cd OnRobot3FG15
$ pip install -e .

Usage

Importing the Driver

from threefg15.core import ThreeFG15

Example Python Code

For further examples and minimal demo code, refer to the src/examples folder.

from threefg15.core import ThreeFG15RTU, ThreeFG15TCP, GripType, ThreeFG15Status

# Initialize gripper with Modbus TCP or RTU connection
gripper = ThreeFG15TCP(ip_address="192.168.0.10", port=502)
gripper = ThreeFG15RTU(serial_port="/dev/tty.usbserial-A5052NB6")
# Open the gripper
gripper.open()
# Gripper opened to: 143.0 mm

# Close the gripper with specified force
gripper.close(force=50)
# Gripper closed to: 148.8 mm

# Check object detection status
detected = gripper.is_object_detected()
print(f"Object detected: {detected}")

print(f"Object detected: {gripper.get_status()}")
# Final status: ThreeFG15Status(busy=False, grip_detected=True, force_grip_detected=True calibration_ok=True)

Command Line Interface (CLI)

The CLI provides two subcommands for communication modes:

  • rtu: Use Modbus RTU over serial
  • tcp: Use Modbus TCP over Ethernet

RTU Usage Example

threefg15-cli rtu --serial-port /dev/ttyUSB0

TCP Usage Example

threefg15-cli tcp --ip 192.168.1.10 --port 502

Replace parameters such as IP address, port, serial port, and baud rate according to your setup.

The cli application offers the following commands:

  • open [force], close [force], move <diam_mm> [force]
  • griptype <external|internal>
  • stop
  • flex <diam_mm> [force], flexopen [force], flexclose [force]
  • limits, force
  • status, detect

License

This software is released under the MIT License, see LICENSE.


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

threefg15-1.0.1.tar.gz (9.5 kB view details)

Uploaded Source

Built Distribution

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

threefg15-1.0.1-py3-none-any.whl (9.2 kB view details)

Uploaded Python 3

File details

Details for the file threefg15-1.0.1.tar.gz.

File metadata

  • Download URL: threefg15-1.0.1.tar.gz
  • Upload date:
  • Size: 9.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.13

File hashes

Hashes for threefg15-1.0.1.tar.gz
Algorithm Hash digest
SHA256 fa9ee9b601f9507ac8cb26dd809154c29ca1541c06d73577f1b07e538e3d217e
MD5 49d74ce7bda94314056152f69e43ac86
BLAKE2b-256 b56b57bea3afa5edb79d3ef7e4a6c2b064146614982eee8f144bc095976d8eb7

See more details on using hashes here.

File details

Details for the file threefg15-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: threefg15-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 9.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.13

File hashes

Hashes for threefg15-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e2eece1f97c76c19caaa1ecb123030ae31b76e71baabe898d04b9eaac07a9679
MD5 d52829e1511157f5aafe47b6267121b0
BLAKE2b-256 e3e2be83d73554bb0d9c60e98ee77335ec23aa644a0199dcd4d6d203797965bc

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