Lingxi Standard Edition Python SDK
1. Introduction
The Gloria-D Standard Edition SDK is a Python development toolkit for controlling the Lingxi Gloria-D Standard Edition parallel two-finger gripper. The Standard Edition uses position control mode, controlling the gripper's motion by directly setting the target opening width and motion speed. It features fast response and simple control, and is suitable for scenarios that require high speed and do not need precise torque control.
1.1 Key Features
- Position Control: Supports opening-width setting with millimeter-level precision
- High-Speed Motion: Speed range of 0 to 3000 (3000 corresponds to the maximum servo speed of 110 rpm), meeting the needs of high-cycle-time scenarios
- 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
- Simple Interface: Core control requires only a single function call for quick onboarding
2. Environment Setup
2.1 Dependency Installation
- Python 3.10 or later
- pyserial
pip install pyserial
2.2 Hardware Connection
- Connect the gripper to the computer via a serial adapter board (USB-TTL / RS485)
- Confirm the serial port number:
- Windows: Check in Device Manager, e.g.
COM5 - Linux:
/dev/ttyUSB0 - macOS:
/dev/tty.usbserial-xxx
- Windows: Check in Device Manager, e.g.
- 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, speed 2000
servo.set_gripper_position(
servo_id=1,
gripper_type="100mm",
position_mm=50,
torque=0,
speed=2000
)
finally:
servo.close()
The torque parameter is ineffective for the Standard Edition (non-force-control version); it is recommended to always set it to 0.
4. Parameter Description
4.1 Core Control Parameters
| Parameter | Range | Description |
|---|---|---|
position_mm | 0 to gripper max stroke | Target opening width (millimeters) |
torque | 0 | The Standard Edition has no torque control; fixed at 0 |
speed | 0 to 3000 | Motion speed; the larger the value, the faster (3000 corresponds to the maximum servo speed of 110 rpm) |
4.2 Supported Gripper Models
| Model | Opening Range | Use Case |
|---|---|---|
"50mm" | 0 to 50 mm | Grasping small objects |
"100mm" | 0 to 100 mm | Grasping medium-sized objects |
5. Typical Use Cases
5.1 Fast Grasping
The Standard Edition responds quickly with crisp motions, suitable for scenarios with strict cycle-time requirements.
import time
from Gloria_D import BusServo
servo = BusServo(port='COM5', baudrate=1000000)
try:
# Quickly open to maximum
servo.set_gripper_position(1, "100mm", 100, torque=0, speed=3000)
time.sleep(0.8)
# Quickly close
servo.set_gripper_position(1, "100mm", 0, torque=0, speed=3000)
finally:
servo.close()
5.2 Precise Positioning Grasp
Low-speed motion provides more precise positioning results.
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=2000)
time.sleep(1)
# Slowly close to the target position
servo.set_gripper_position(1, "100mm", 25, torque=0, speed=500)
finally:
servo.close()
5.3 Multi-Level Opening Switching
Switch between different gripping widths across different workstations.
import time
from Gloria_D import BusServo
servo = BusServo(port='COM5', baudrate=1000000)
try:
positions = [80, 50, 30, 10, 50, 100] # Sequence in millimeters
for pos in positions:
print(f"Moving to {pos}mm")
servo.set_gripper_position(1, "100mm", pos, torque=0, speed=2000)
time.sleep(1)
# Read the actual position
sensor = servo.read_sensor_data(1)
if sensor:
print(f" Actual position value: {sensor['position']}")
finally:
servo.close()
5.4 Sensor Status Reading
The Standard Edition also supports sensor data reading, which can be used to monitor operating status.
import time
from Gloria_D import BusServo
servo = BusServo(port='COM5', baudrate=1000000)
try:
# Move to the specified position
servo.set_gripper_position(1, "100mm", 50, torque=0, speed=2000)
time.sleep(1)
# Read sensor data
sensor = servo.read_sensor_data(1)
if sensor:
print(f"Current position: {sensor['position']}")
print(f"Current speed: {sensor['speed']}")
print(f"Current load: {sensor['load']}")
print(f"Voltage: {sensor['voltage'] * 0.1:.1f}V")
print(f"Temperature: {sensor['temperature']}℃")
finally:
servo.close()
5.5 Cyclic Grip-and-Release Test
import time
from Gloria_D import BusServo
servo = BusServo(port='COM5', baudrate=1000000)
try:
for i in range(10):
print(f"\n--- Iteration {i+1} ---")
# Open
servo.set_gripper_position(1, "100mm", 80, torque=0, speed=2500)
time.sleep(0.8)
# Close
servo.set_gripper_position(1, "100mm", 5, torque=0, speed=2500)
time.sleep(0.8)
# Read status
sensor = servo.read_sensor_data(1)
if sensor:
print(f"Position: {sensor['position']}, Temperature: {sensor['temperature']}℃")
finally:
servo.close()
6. API Reference
| Method | Description |
|---|---|
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 interface, set torque to 0) |
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. Standard Edition vs. Force Control Edition
| Feature | Standard Edition | Force Control Edition |
|---|---|---|
| Speed Range | 0 to 3000 (max 110 rpm) | 0 to 150 (max 110 rpm) |
| Torque Control | Not supported (torque=0) | Supported (0 to 1000, max 35 kg·cm) |
| Load Feedback | Basic feedback | Precise torque feedback |
| Typical Scenarios | High-speed pick-and-place, production line cycle time | Fragile items, flexible objects |
| Control Complexity | Simple | Higher |
8. Notes
- Speed Range: The Standard Edition speed range is 0 to 3000 (3000 corresponds to the maximum servo speed of 110 rpm); never confuse it with the Force Control Edition
- Torque Parameter: The Standard Edition
torqueis ineffective; it is recommended to always set it to0 - Gripping Protection: The Standard Edition has no torque feedback; be careful to avoid over-squeezing the target object when closing
- Communication Interval: It is recommended to add a delay of at least
time.sleep(0.05)between consecutive commands - Power-Off Protection: Always call
servo.close()to close the connection after operations are complete