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.0.tar.gz (9.4 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.0-py3-none-any.whl (9.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: threefg15-1.0.0.tar.gz
  • Upload date:
  • Size: 9.4 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.0.tar.gz
Algorithm Hash digest
SHA256 162f1038cf75a563eb74f19d8fab1eee668add4fb1c9923160fd7ed393b5299e
MD5 6a0393c9650887bb3fc21d29ba7e4881
BLAKE2b-256 83848ce7def97525e426645a4aa15fdd6659484518346c96c64a6b6542d71d6d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: threefg15-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 9.1 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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 450df9c31bfd49d9b4fa40011d8d4bc909c4e09793e1c0013722124de25827d5
MD5 1e2226bc39200b826b70ddffd3895141
BLAKE2b-256 ce0f94119754d0ea8bd6b81bf01598d54f8c1545ccb85b794fa48d52a3e623f5

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