Skip to content

Hand Gesture Control for a UR5 Cobot

Pointing instead of a teach pendant: a ROS prototype that drives a UR5 from MediaPipe hand tracking, and a co-authored paper on a 7 KB model that recognizes eight hand gestures.

4 min read1 star
  • ROS Noetic
  • ROS 2
  • Python
  • MediaPipe
  • OpenCV
  • TensorFlow Lite
  • UR5

Telling a cobot what to do usually means a teach pendant, a joystick or a laptop next to the arm. This work lets an operator use a hand instead. The prototype maps a fingertip seen by a camera to commands for a Universal Robots UR5, and the paper I co-authored at ITS covers a gesture model small enough for edge hardware.

The problem

In a shared workspace the operator's hands are busy, and walking to a pendant to tell the arm where a part goes breaks the flow. The interface should need no extra device to hold or wear, no training to use, and it must not fire a command by accident.

The prototype

Four ROS Noetic packages:

  • ur_perception runs MediaPipe Hands on the camera feed, maps the index fingertip to a cell of a grid drawn over the image and publishes only the cell number. A second node reads a distance sensor over serial.
  • ur_controller decides what a cell means in the current mode and switches the grid between modes.
  • ur_interface sends joint trajectories to the UR5 through the trajectory controller of the Universal Robots ROS driver.
  • ur_srvs holds the services to start, stop and change mode.
camera --> MediaPipe Hands --> index fingertip --> grid celldistance sensor (serial) --> part closer than 15 cm                              |                              v                        ur_controller               +--------------+--------------+               |                             |      control panel mode            pick-and-place mode      relay on an ESP (HTTP)        UR5 joint trajectory

It has two modes. As a touchless control panel, a 4 × 2 grid gives eight cells, each switching a relay on an ESP board over HTTP. For pick and place, a part arriving within 15 cm of the distance sensor makes the arm pick it up, the grid switches to two cells, and the operator points to the side where the arm should place it before it returns to its idle pose.

Challenges and how I solved them

A fingertip is never still

Problem. The first version published raw fingertip coordinates at 1280 × 720. A hand always shakes a little, so mapping pixels straight to commands would make the relays chatter and the arm hesitate.

Solution. The image is split into a grid and only the cell under the fingertip counts. A command fires only when the cell changes: the controller switches the previous cell off and the new one on. The camera now runs at 848 × 480, plenty for one landmark, and a detection confidence of 0.9 keeps false hands out.

An interface nobody has to learn

Problem. Every gesture vocabulary has to be taught to every operator, and people forget which shape means what.

Solution. The prototype only asks where the fingertip is, not what shape the hand makes, and it draws the grid with each cell's number on the camera view. Operators see what pointing will do before they do it.

A model small enough for the edge

Problem. Pointing chooses a place, but it cannot say stop or confirm, and a gesture model next to a cobot has to run in real time on modest hardware.

Solution. That is the subject of the paper: a lightweight model that recognizes eight hand gestures with 1,103 parameters in 22 KB, at 93.5 % accuracy. Quantization and pruning with TensorFlow Lite bring it down to 7 KB, and it was tested controlling a UR5 in a real-time ROS 2 system.

Results

  • The prototype switches eight relays by pointing and runs a sensor-triggered pick-and-place on a UR5, with the drop side chosen by hand.
  • The paper's gesture model reaches 93.5 % accuracy on eight gestures in 7 KB after optimization.

Status

The prototype was built in about a week in July 2024. The gripper calls are still stubs, and the pick and place poses are fixed joint positions recorded on the arm.

Lessons learned

  • Quantize a noisy input before you interpret it. A grid turned a shaking fingertip into a stable command.
  • Fire on change, not on every frame.
  • Show the operator the interface. Drawing the grid on the camera view made the system usable without instructions.
  • A small model is a design choice. 1,103 parameters were enough for eight gestures.

Stack

PartTechnology
PrototypeROS Noetic, Python, MediaPipe Hands, OpenCV
RobotUniversal Robots UR5 with the UR ROS driver
I/ODistance sensor over serial, relays on an ESP board over HTTP
ResearchTensorFlow Lite with quantization and pruning, ROS 2

Paper

Muhtadin, I Wayan Agus Darmawan, Muhammad Hilmi Rusydiansyah, I Ketut Eddy Purnama, Chastine Fatichah and Mauridhi Hery Purnomo, Hand Gesture Recognition for Collaborative Robots Using Lightweight Deep Learning in Real-Time Robotic Systems, arXiv, 2025.

More projects

  • Pashupati & NETRA: Autonomous Mall Patrol

    A robot-agnostic ROS 2 patrol and inspection stack for a wheel-legged quadruped, and NETRA, the command center that schedules patrols, validates what the robot finds and sends the alerts.

    RoboticsFeatured1 star

    • ROS 2
    • Python
    • FAST-LIO2
    • Jetson
    • +4 more
  • Proteus V2: Autonomy for the Barunastra ASV

    The ROS workspace I led for Barunastra ITS's autonomous surface vessel: missions, control and hardware links behind the Grand Champion title at the International Roboboat Competition 2023.

    RoboticsFeatured

    • ROS Noetic
    • Python
    • MAVROS
    • YOLO
    • +3 more
  • iCar 4: Porting the Self-Driving Stack

    Brought the iCar ITS self-driving workspace up on the new iCar 4: one wire format for its new STM32 board, two Velodyne LiDARs and a cleaner workspace, refactored from Pandu Surya Tantra's base program.

    Robotics

    • ROS Noetic
    • C++
    • Velodyne VLP-16
    • STM32
    • +3 more