Integrated Control of PiPER Mate and Piper Robotic Arms
This project implements integrated control between the PiPER Mate robotic arm and the Piper robotic arm, enabling real-time teleoperation through USB and CAN bus.
Project Overview
This project allows users to use the PiPER Mate robotic arm as the leader device to control the Piper robotic arm in real time. The system reads the joint states of the PiPER Mate robotic arm and converts them into control commands for the Piper robotic arm, enabling precise teleoperation.
Features
- Real-time teleoperation: supports a high control frequency.
- Joint mapping: automatically converts PiPER Mate joint angles to Piper joint positions.
- Safety protection: includes joint angle limits and torque control.
- Gripper control: optional coordinated gripper control.
System Requirements
Hardware Requirements
- PiPER Mate robotic arm (connected through USB)
- Piper robotic arm (connected through CAN bus)
- CAN-to-USB adapter
- Linux system (Ubuntu 22.04+ recommended)
Software Dependencies
# 安装CAN工具
sudo apt update
sudo apt install ethtool can-utils
# Python依赖
sudo pip install serial fashionstar-uart-sdk piper-sdk python-can scipy
Quick Start
1. Configure the CAN Device
Single-CAN Device Configuration
# 1. 查找所有CAN端口
bash find_all_can_port.sh
# 2. 激活can0接口(波特率1000000)
bash can_activate.sh can0 1000000
2. Run the Main Program
python3 ./Python_SDK/piper_pipermate.py
3. Parameter Configuration
Modify the following parameters in the piper_pipermate.py file's main() function:
# PiPER Mate USB端口
PIPERMATE_PORT = "/dev/ttyUSB0"
# Piper CAN端口
PIPER_CAN_NAME = "can0"
# 是否包含夹爪
GRIPPER_EXIST = True
# 控制频率(Hz)
UPDATE_RATE = 100.0
Core Functions
Joint Angle Conversion
The system supports angle conversion for 6 joints:
| Joint | Angle Limit | Radian Limit | Direction |
|---|---|---|---|
| Joint1 | -150° ~ 150° | -2.6179 ~ 2.6179 | Reversed |
| Joint2 | 0° ~ 180° | 0 ~ 3.14 | Forward |
| Joint3 | -170° ~ 0° | -2.967 ~ 0 | Forward |
| Joint4 | -100° ~ 100° | -1.745 ~ 1.745 | Reversed |
| Joint5 | -70° ~ 70° | -1.22 ~ 1.22 | Forward |
| Joint6 | -120° ~ 120° | -2.09439 ~ 2.09439 | Reversed |
Gripper Control
The gripper angle is converted to metric distance:
- Angle range: 0° ~ 45°
- Corresponding distance: 0 m ~ 0.08 m
Control Modes
- Joint control mode: 0x01
- Speed control mode: 0x01
- Speed control ratio: 100
Script Descriptions
can_activate.sh
Single-CAN device activation script. Supports:
- Automatic CAN interface detection
- Bitrate configuration
- Interface renaming
- USB hardware address matching
can_config.sh
General CAN configuration script. Supports:
- Single-CAN and multi-CAN device configuration
- Flexible USB port mapping
- Custom bitrate settings
can_muti_activate.sh
Multi-CAN device activation script. Supports:
- Parallel configuration of multiple devices
- Duplicate name detection
- Interactive confirmation
find_all_can_port.sh
CAN port detection script. Used to:
- List all CAN interfaces
- Display USB port information
- Check system compatibility
Troubleshooting
Common Issues
- CAN interface not found
- Check whether the CAN device is connected.
- Run
find_all_can_port.shto detect the interface. -
Confirm that the USB port mapping is correct.
-
Insufficient permissions
-
Run the script after using
sudo chmod 777 /dev/ttyUSB*. -
PiPER Mate connection failed
- Check the USB port number.
- Confirm that the FashionStar SDK is installed correctly.
- Check device permissions.
Configuration Information
The program displays the following during operation:
- Real-time joint state monitoring
- Control frequency statistics
- Detailed error output
Safety Notes
- Pre-operation check: Make sure there are no obstacles around the robotic arms.
- Emergency stop: Press Ctrl+C to stop the program immediately.
- Torque control: PiPER Mate torque is disabled by default.
- Joint limits: The system automatically limits joint angles to a safe range.
License
This project is open-sourced under the MIT license.
Contributing
Issues and pull requests are welcome to improve the project.
Contact
Contact the project maintainer if you have any questions.