Lightweight Cartesian teleoperation for a UR5/UR5e robot with a Robotiq 2F-85/2F-140 or 3-Finger Adaptive Gripper. A 3Dconnexion SpaceMouse controls the TCP while the two side buttons close and open the gripper.
This repository contains only the real-time control path—no cameras, dataset recording, HDF5 files, or policy code.
- 6-DoF Cartesian TCP control through Universal Robots RTDE
- Direct Robotiq Modbus RTU control through a USB-RS485 adapter
- Dedicated launchers for Robotiq 2F and 3F grippers
- Configurable speed, deadzone, TCP offset, and gripper force
- Input timeout plus translation and rotation workspace limits
- Clean
servoStop()and RTDE shutdown onCtrl+C
- Universal Robots UR5 (CB3) or UR5e
- Robotiq 2F-85, 2F-140, or 3-Finger Adaptive Gripper
- USB-RS485 adapter connected directly between the gripper and workstation
- 3Dconnexion SpaceMouse
- Ubuntu workstation on the same network as the robot
The USB-RS485 adapter carries data only. The gripper still requires its appropriate power supply.
Install the SpaceMouse daemon and Python binding:
sudo apt install spacenavd libspnav-dev python3-spnav
sudo systemctl enable --now spacenavdCreate an environment and install this project:
python3 -m venv .venv
source .venv/bin/activate
pip install -e .If python3-spnav is not visible inside the virtual environment, create it
with python3 -m venv --system-site-packages .venv.
Give your user serial-port access (log out and back in afterward):
sudo usermod -aG dialout "$USER"- Configure the robot with a static IP and connect the workstation to the same subnet.
- Put an e-Series robot in Remote Control mode.
- Correctly configure the TCP, payload, center of gravity, safety planes, and speed limits on the teach pendant.
- Verify that the robot emergency stop is reachable before starting.
For a Robotiq 2F gripper:
python scripts/teleop_2f.py \
--robot-ip 192.168.0.204 \
--gripper-port /dev/ttyUSB0For a Robotiq 3F gripper:
python scripts/teleop_3f.py \
--robot-ip 192.168.0.204 \
--gripper-port /dev/ttyUSB0The installable command supports either gripper:
ur5-robotiq-teleop --robot-ip ROBOT_IP --gripper 2F| Input | Action |
|---|---|
| SpaceMouse cap | Translate and rotate the TCP |
| Button 0 | Close gripper |
| Button 1 | Open gripper |
Ctrl+C |
Stop servo control and disconnect |
Run python scripts/teleop_2f.py --help to see all tuning options. The
defaults limit TCP speed to 0.05 m/s, rotational speed to 0.30 rad/s, and
translation to ±0.20 m from the starting pose.
This software commands industrial hardware. Test at reduced robot speed with an empty workspace first. Software limits are secondary protections; they do not replace the robot safety configuration, risk assessment, or a reachable emergency stop. The program holds the pose when SpaceMouse messages become stale, but the operator remains responsible for safe operation.
src/ur5_robotiq_spacemouse/
├── gripper.py # Robotiq 2F/3F Modbus RTU protocol
├── spacemouse.py # spacenav input and coordinate mapping
└── teleop.py # RTDE servo loop and safety limits
scripts/
├── teleop_2f.py
└── teleop_3f.py
The control logic was extracted and refined from airvlab/UR5_Teleoperation_Spacemouse. It uses the open-source ur_rtde interface and the Linux spacenav driver.
MIT