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

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 -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

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-0.1.0.tar.gz (9.1 kB view details)

Uploaded Source

Built Distribution

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

threefg15-0.1.0-py3-none-any.whl (9.0 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for threefg15-0.1.0.tar.gz
Algorithm Hash digest
SHA256 7ced806ad2f93e66014bbb3c1a5d548e1cba4b6bd8548ffeccb310521b7b574a
MD5 0f7b9b71bb1c053cf6085a241619e6cf
BLAKE2b-256 3f172e6407adea7d28a27b2a860ff1360c55c9c4b2b56b889b9788a515d9cb45

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for threefg15-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 19716495afac85ee2df493ad37b98b2c4e1632d5b5a5ff8296fd19930a27e6c9
MD5 3612cd41c19e18fddf77ea358225047e
BLAKE2b-256 9b34ab9dd64e669e75c90cd54f901fed5516d1f85b366918c09285a52da6a213

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