Skip to content

Leety09/ur5-robotiq-spacemouse-control

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

UR5 + Robotiq SpaceMouse Control

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.

Features

  • 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 on Ctrl+C

Hardware

  • 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.

Installation

Install the SpaceMouse daemon and Python binding:

sudo apt install spacenavd libspnav-dev python3-spnav
sudo systemctl enable --now spacenavd

Create 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"

Robot setup

  1. Configure the robot with a static IP and connect the workstation to the same subnet.
  2. Put an e-Series robot in Remote Control mode.
  3. Correctly configure the TCP, payload, center of gravity, safety planes, and speed limits on the teach pendant.
  4. Verify that the robot emergency stop is reachable before starting.

Usage

For a Robotiq 2F gripper:

python scripts/teleop_2f.py \
  --robot-ip 192.168.0.204 \
  --gripper-port /dev/ttyUSB0

For a Robotiq 3F gripper:

python scripts/teleop_3f.py \
  --robot-ip 192.168.0.204 \
  --gripper-port /dev/ttyUSB0

The installable command supports either gripper:

ur5-robotiq-teleop --robot-ip ROBOT_IP --gripper 2F

Controls

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.

Safety

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.

Project structure

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

Acknowledgements

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.

License

MIT

About

SpaceMouse teleoperation for UR5/UR5e robots with Robotiq 2F or 3F grippers

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages