Remote Control of Robotic Arms – Using a Standard Gamepad

Gamepad Control for PiPER Manipulator

1. Abstract

This document implements intuitive control of the PiPER robotic arm using a standard gamepad. With a common gamepad, you can operate the PiPER manipulator in a visualized environment, delivering a precise and intuitive control experience.

Tags

PiPER Manipulator, Gamepad Teleoperation, Joint Control, Pose Control, Gripper Control, Forward & Inverse Kinematics

2. Repositories

3. Function Demo

20260326-173204

4. Environment Setup

  • OS: Ubuntu 20.04 or later
  • Python Environment: Python 3.9 or later. Anaconda or Miniconda is recommended

Clone the project and enter the root directory:

git clone https://github.com/kehuanjack/Gamepad_PiPER.git
cd Gamepad_PiPER

Install common dependencies and kinematics libraries (choose one option; pytracik is recommended):

Option 1: Based on pinocchio

(Python == 3.9; requires piper_ros and sourcing the ROS workspace, otherwise meshes will not be found)

conda create -n test_pinocchio python=3.9.* -y
conda activate test_pinocchio
pip3 install -r requirements_common.txt --upgrade
conda install pinocchio=3.6.0 -c conda-forge
pip install meshcat
pip install casadi

In main.py and main_virtual.py, select:from src.gamepad_pin import RoboticArmController

Option 2: Based on PyRoKi

(Python >= 3.10)

conda create -n test_pyroki python=3.10.* -y
conda activate test_pyroki
pip3 install -r requirements_common.txt --upgrade
pip3 install pyroki@git+https://github.com/chungmin99/pyroki.git@f234516

In main.py and main_virtual.py, select:from src.gamepad_limit import RoboticArmController orfrom src.gamepad_no_limit import RoboticArmController

Option 3: Based on cuRobo

(Python >= 3.8; CUDA 11.8 recommended)

conda create -n test_curobo python=3.10.* -y
conda activate test_curobo
pip3 install -r requirements_common.txt --upgrade
sudo apt install git-lfs && cd ../
git clone https://github.com/NVlabs/curobo.git && cd curobo
pip3 install "numpy<2.0" "torch==2.0.0" pytest lark
pip3 install -e . --no-build-isolation
python3 -m pytest .
cd ../Gamepad_PiPER

In main.py and main_virtual.py, select:from src.gamepad_curobo import RoboticArmController

Option 4: Based on pytracik

(Python >= 3.10)

conda create -n test_tracik python=3.10.* -y
conda activate test_tracik
pip3 install -r requirements_common.txt --upgrade
git clone https://github.com/chenhaox/pytracik.git
cd pytracik
pip install -r requirements.txt
sudo apt install g++ libboost-all-dev libeigen3-dev liborocos-kdl-dev libnlopt-dev libnlopt-cxx-dev
python setup_linux.py install --user

In main.py and main_virtual.py, select:from src.gamepad_trac_ik import RoboticArmController

5. Execution Steps

  1. Connect manipulator and activate CAN interface:sudo ip link set can0 up type can bitrate 1000000

  2. Connect gamepad:Connect the gamepad to the PC via USB or Bluetooth.

  3. Launch control script:Run python3 main.py or python3 main_virtual.py in the project directory.It is recommended to test with main_virtual.py first in simulation mode.

  4. Verify gamepad connection:Check console output to confirm the gamepad is recognized.

  5. Web visualization:Open a browser and go to http://localhost:8080 to view the manipulator status.

  6. Start control:Operate the manipulator according to the gamepad mapping.

6. Gamepad Control Instructions

6.1 Button Mapping

Button Short Press Function Long Press Function
HOME Connect / Disconnect manipulator None
START Switch high-level control mode (Joint / Pose) Switch low-level control mode (Joint / Pose)
BACK Switch low-level command mode (Position-Velocity 0x00 / Fast Response 0xAD) None
Y Go to home position None
A Save current position Clear current saved position
B Restore previous saved position None
X Switch playback order Clear all saved positions
LB Increase speed factor (high-level) Decrease speed factor (high-level)
RB Increase movement speed (low-level) Decrease movement speed (low-level)

6.2 Joystick & Trigger Functions

Control Joint Mode Pose Mode
Left Joystick J1 (Base rotation): Left / RightJ2 (Shoulder): Up / Down End-effector X / Y translation
Right Joystick J3 (Elbow): Up / DownJ6 (Wrist rotation): Left / Right End-effector Z translation & Z-axis rotation
D-Pad J4 (Wrist yaw): Left / RightJ5 (Wrist pitch): Up / Down End-effector X / Y-axis rotation
Left Trigger (LT) Close gripper Close gripper
Right Trigger (RT) Open gripper Open gripper

6.3 Special Functions

6.3.1 Gripper Control

  • Gripper opening range: 0–100%
  • Quick toggle: When fully open (100%) or fully closed (0%), a quick press and release of the trigger toggles the state.

6.3.2 Speed Control

  • Speed factor: 0.25x, 0.5x, 1.0x, 2.0x, 3.0x, 4.0x, 5.0x (adjust with LB)
  • Movement speed: 10%–100% (adjust with RB)

6.3.3 Position Memory

  • Supports saving multiple waypoints
  • Supports forward and reverse playback

Notes

  • You may run main_virtual.py first to test in simulation.
  • For first-time use, start with low speed and increase gradually after familiarization.
  • Keep a safe distance during operation. Do not approach the moving manipulator.
  • Numerical solutions may cause large joint jumps near singularities — maintain safe distance.
  • Fast response mode (0xAD) is dangerous. Use with extreme caution and keep clear.
  • If using pinocchio, source the ROS workspace of the manipulator in advance, otherwise meshes will not be detected.