A simple and interactive Python interface for controlling the Piper robotic arm via the piper_control API. Build on the work of Reimagine Robotics.
This controller allows you to:
- Set joint positions absolutely or relatively
- Open/close the gripper with precise control
- Interact with the robot from the terminal using simple text commands
sudo apt install can-utilspip install piper_controlThis controller script provides the following functionality:
- Move the arm to a start position
- Move joints by providing absolute or relative values (radians or degrees)
- Open or close the gripper
- Run an interactive terminal interface for manual control
- Absolute and relative joint control
- Degrees and radians support
- Interactive gripper control (open, close, or partial)
- Current state feedback after every command
python3 driver.pyWhen running, you’ll be able to enter:
-
Absolute radians:
1.0 -0.5 0.3 0.2 -1.2 0.8 -
Absolute degrees:
45 -30 15 10 -70 45d -
Relative radians:
+0.1 0 -0.2 0 0.3 0 -
Relative degrees:
+5 0 -10 0 15 0d
Use the prefix
+to indicate a relative movement and suffixdto enter values in degrees.
Type g and press enter to enter gripper mode:
o: Open gripper fullyc: Close gripper fully0.0–1.0: Set gripper position (0 = closed, 1 = open)b: Go back to joint control
Type q or quit or exit at any time to leave the controller.
This is the default joint configuration in radians:
[-1.593, 0.634, -0.286, 0, 0.385, -1.85]Use arm.set_start_position() in code to return to this pose.
Here’s how to use the controller from your own script:
from piper_arm_controller import PiperArmController
import numpy as np
arm = PiperArmController()
arm.set_start_position()
# Move arm relative to start
arm.set_relative_angles(np.array([0.1, 0, -0.2, 0, 0.1, 0]))
# Open gripper halfway
arm.set_gripper(0.5)piper_control(Python package)can-utils(Linux CAN communication utilities)- Python 3.7+
- Make sure the CAN device is available (e.g.,
can0) - Ensure Piper is connected and powered on
- Run with
sudoif permissions are restricted oncan0