Skip to main content

Lingxi Force Control Edition Python SDK

1. Introduction

The Gloria-D Force Control Edition SDK is a Python development toolkit for controlling the Lingxi Gloria-D Force Control Edition parallel two-finger gripper. The Force Control Edition has built-in torque sensing and feedback mechanisms, allowing precise control of the applied torque during gripping. It is suitable for scenarios with strict gripping-force requirements (such as grasping fragile items, manipulating flexible objects, etc.).

1.1 Key Features

Core Capabilities
  • Torque Control: Supports precise torque setting in the range of 0 to 1000 (1000 corresponds to the servo's maximum torque of 35 kg·cm), enabling compliant grasping
  • Position Control: Supports opening-width setting with millimeter-level precision
  • Force Feedback Reading: Reads load feedback in real time to determine the gripping state
  • Multi-Model Compatibility: Supports 50 mm / 100 mm gripper models
  • Status Reading: Acquires sensor data such as position, speed, load, voltage, and temperature in real time

2. Environment Setup

2.1 Dependency Installation

  • Python 3.10 or later
  • pyserial
pip install pyserial

2.2 Hardware Connection

  1. Connect the gripper to the computer via a serial adapter board (USB-TTL / RS485)
  2. Confirm the serial port number:
    • Windows: Check in Device Manager, e.g. COM5
    • Linux: /dev/ttyUSB0
    • macOS: /dev/tty.usbserial-xxx
  3. Ensure the gripper is properly powered

3. Quick Start

from Gloria_D import BusServo

# Create connection (default baud rate 1000000)
servo = BusServo(port='COM5', baudrate=1000000, verbose=True)

try:
# Check servo connection
err = servo.ping(1)
if err == 0:
print("Gripper connected successfully")
else:
print(f"Connection error, error code: {err}")

# Control the gripper to open to 50mm, torque 200, speed 100
servo.set_gripper_position(
servo_id=1,
gripper_type="100mm",
position_mm=50,
torque=200,
speed=100
)
finally:
servo.close()
Warning

The speed range for the Force Control Edition is 0 to 150 (150 corresponds to the maximum servo speed of 110 rpm). Do not use the speed values of the Standard Edition (0 to 3000), otherwise unexpected behavior may occur.

4. Parameter Description

4.1 Core Control Parameters

ParameterRangeDescription
position_mm0 to gripper max strokeTarget opening width (millimeters)
torque0 to 1000Gripping torque, the core parameter of the Force Control Edition (1000 corresponds to a maximum torque of 35 kg·cm); 0 means no additional torque is applied
speed0 to 150Motion speed; the Force Control Edition has a smaller speed range (150 corresponds to the maximum servo speed of 110 rpm)

4.2 Supported Gripper Models

ModelOpening RangeUse Case
"50mm"0 to 50 mmGrasping small precision objects
"100mm"0 to 100 mmGrasping medium-sized objects

5. Typical Use Cases

5.1 Flexible Object Gripping (Low Torque)

Suitable for grasping fragile or soft objects, using lower torque to prevent damage.

import time
from Gloria_D import BusServo

servo = BusServo(port='COM5', baudrate=1000000)

try:
# First open the gripper
servo.set_gripper_position(1, "100mm", 80, torque=0, speed=100)
time.sleep(1)

# Slowly close and grip with low torque
servo.set_gripper_position(1, "100mm", 20, torque=150, speed=50)
finally:
servo.close()

5.2 Rigid Object Gripping (High Torque)

Suitable for grasping hard objects such as metal or plastic, applying greater gripping force to ensure a firm hold.

import time
from Gloria_D import BusServo

servo = BusServo(port='COM5', baudrate=1000000)

try:
# Open the gripper
servo.set_gripper_position(1, "100mm", 80, torque=0, speed=100)
time.sleep(1)

# Close and grip with high torque
servo.set_gripper_position(1, "100mm", 10, torque=800, speed=80)
finally:
servo.close()

5.3 Force Feedback Reading and Grip Detection

The Force Control Edition gripper can read load feedback in real time to determine whether an object has been successfully gripped.

import time
from Gloria_D import BusServo

servo = BusServo(port='COM5', baudrate=1000000)

try:
# Perform gripping
servo.set_gripper_position(1, "100mm", 15, torque=300, speed=60)
time.sleep(1)

# Read sensor data
sensor = servo.read_sensor_data(1)
if sensor:
print(f"Current position: {sensor['position']}")
print(f"Current load: {sensor['load']}")
print(f"Current speed: {sensor['speed']}")
print(f"Voltage: {sensor['voltage'] * 0.1:.1f}V")
print(f"Temperature: {sensor['temperature']}℃")

# Determine whether an object has been gripped (non-zero load indicates resistance)
if abs(sensor['load']) > 50:
print("Gripped object detected")
else:
print("No object detected")
finally:
servo.close()

5.4 Cyclic Grip-and-Release Test

import time
from Gloria_D import BusServo

servo = BusServo(port='COM5', baudrate=1000000)

try:
for i in range(5):
print(f"\n--- Iteration {i+1} ---")
# Open
servo.set_gripper_position(1, "100mm", 80, torque=0, speed=100)
time.sleep(1.5)

# Close and grip
servo.set_gripper_position(1, "100mm", 10, torque=400, speed=60)
time.sleep(1.5)

# Read status
sensor = servo.read_sensor_data(1)
if sensor:
print(f"Load: {sensor['load']}, Position: {sensor['position']}")
finally:
servo.close()

6. API Reference

MethodDescription
BusServo(port, baudrate, verbose)Create a serial connection instance
ping(servo_id)Check the servo connection status
set_gripper_position(id, type, mm, torque, speed)Control the gripper opening (core force-control interface)
move_servo(id, position, torque, speed)Directly control the raw servo position
read_sensor_data(servo_id)Read comprehensive sensor data
get_position(servo_id)Read the current position value
set_servo_id(old_id, new_id)Modify the servo ID
set_baudrate(servo_id, baudrate)Set the communication baud rate
set_servo_torque_enable(servo_id, enable)Torque enable switch
close()Close the serial connection

7. Force Control Edition vs. Standard Edition

FeatureForce Control EditionStandard Edition
Speed Range0 to 150 (max 110 rpm)0 to 3000 (max 110 rpm)
Torque ControlSupported (0 to 1000, max 35 kg·cm)Not supported (torque=0)
Load FeedbackPrecise torque feedbackBasic feedback
Typical ScenariosFragile items, flexible objectsHigh-speed pick-and-place, production line cycle time
Control ComplexityHigherSimple

8. Notes

Usage Tips
  1. Speed Range: The Force Control Edition speed range is 0 to 150 (150 corresponds to the maximum servo speed of 110 rpm); never use the Standard Edition speed values (0 to 3000)
  2. Torque Setting: A torque value of 0 means no additional torque is applied (free motion); choose an appropriate torque value based on the target object
  3. Operation Sequence: It is recommended to first open the gripper to a position larger than the target object, then close to grip
  4. Communication Interval: It is recommended to add a delay of at least time.sleep(0.05) between consecutive commands
  5. Power-Off Protection: Always call servo.close() to close the connection after operations are complete