Skip to main content

๐Ÿ–ฑ๏ธ teleop-cursor

Intuitive Desktop Cursor Teleoperation for ROS 2 Mobile Robots

ROS 2 Python License pip

Transform real-time desktop mouse cursor movements into canonical ROS 2 velocity commands (geometry_msgs/msg/Twist) for physical and simulated mobile robots.

Quickstart โ€ข Architecture โ€ข Control Mapping โ€ข Simulation โ€ข Documentation


๐Ÿ“Œ Overview

teleop-cursor provides an ultra-lightweight, zero-hardware teleoperation node for ROS 2 (rclpy). Instead of requiring dedicated joysticks or cumbersome keyboard combinations, teleop-cursor tracks your screen cursor position relative to display center, translating cursor displacement vectors into smooth linear ($v_x$) and angular ($\omega_z$) velocity commands published directly to the /cmd_vel topic.

Whether you are testing autonomous mobile robots (AMRs), validating navigation pipelines in Gazebo, or demonstrating robot movements, teleop-cursor turns any standard workstation display into a responsive teleoperation interface.


โšก Key Features

  • ๐Ÿš€ Instant Teleoperation: Zero hardware joysticks requiredโ€”teleoperate directly using your mouse or trackpad.
  • ๐Ÿ”„ Dominant Axis Switching: Automatically calculates magnitude deltas ($\Delta X, \Delta Y$) to distinguish between turning and driving forward/backward.
  • ๐Ÿค– ROS 2 Native: Built on rclpy and standard geometry_msgs/msg/Twist payloads, ensuring 100% compatibility with TurtleBot3, Nav2, and custom robot controllers.
  • ๐ŸŽฏ Dynamic Resolution Handling: Dynamically queries monitor dimensions using pyautogui, auto-centering controls on any resolution (1080p, 4K, ultrawide).
  • โฑ๏ธ Real-Time Stream: Operates at a steady 10 Hz control callback frequency with minimal CPU overhead.

๐Ÿ—๏ธ Architecture

The diagram below demonstrates how host screen cursor events flow through the system to actuate simulated or physical ROS 2 robots:

graph LR
    A[Host Display Cursor] -->|X, Y Coordinates| B[PyAutoGUI Interface]
    B -->|Screen Offset ฮ”X, ฮ”Y| C[CursorFollowNode]
    
    subgraph Signal Processing Loop 10Hz
        C --> D{Dominant Axis?}
        D -->|"abs(ฮ”X) > abs(ฮ”Y)"| E[Compute Angular Yaw Speed ฯ‰z]
        D -->|"abs(ฮ”Y) >= abs(ฮ”X)"| F[Compute Linear Speed vx]
        E --> G[Construct Twist Message]
        F --> G
    end

    G -->|Publish| H((/cmd_vel Topic))
    H --> I[TurtleBot3 Gazebo Sim]
    H --> J[Physical Mobile Robot]

For complete mathematical details and signal transformations, see docs/ARCHITECTURE.md.


๐ŸŽฎ Control Mapping

The host display is divided into four primary directional control regions anchored to screen center $(X_c, Y_c)$:

                  โ–ฒ  FORWARD (+vx = 0.2 m/s)
                  โ”‚  [|ฮ”Y| >= |ฮ”X|]
                  โ”‚
   LEFT โ—„โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–บ RIGHT
(ฯ‰z = +1.0 rad/s) โ”‚         (ฯ‰z = -1.0 rad/s)
 [|ฮ”X| > |ฮ”Y|]    โ”‚          [|ฮ”X| > |ฮ”Y|]
                  โ”‚
                  โ–ผ  BACKWARD (-vx = -0.2 m/s)
                     [|ฮ”Y| >= |ฮ”X|]

Motion Decision Matrix

Cursor Displacement Robot Action linear.x (m/s) angular.z (rad/s)
Top Half ($ \Delta Y \ge \Delta X
Bottom Half ($ \Delta Y \ge \Delta X
Left Side ($ \Delta X > \Delta Y
Right Side ($ \Delta X > \Delta Y

๐Ÿš€ Quickstart

Prerequisites

Ensure you have a working installation of ROS 2 (Humble, Iron, Jazzy, or Rolling) and Python 3.10+:

# Source your ROS 2 environment
source /opt/ros/$ROS_DISTRO/setup.bash

Option A โ€” Pip Install (Recommended)

# Install directly from the repo (adds 'teleop-cursor' CLI to PATH)
pip install git+https://github.com/gaminization/teleop-cursor.git

# Then simply run:
teleop-cursor

Option B โ€” Local Editable Install

git clone https://github.com/gaminization/teleop-cursor.git
cd teleop-cursor
pip install -e .

# Run the CLI
teleop-cursor

Option C โ€” ROS 2 colcon Workspace Build

mkdir -p ~/ros2_ws/src && cd ~/ros2_ws/src
git clone https://github.com/gaminization/teleop-cursor.git
cd ~/ros2_ws && colcon build --packages-select teleop_cursor
source install/setup.bash

# Run via ros2 run
ros2 run teleop_cursor teleop-cursor

Option D โ€” Direct Script

git clone https://github.com/gaminization/teleop-cursor.git
cd teleop-cursor
python3 cursor.py
  1. Move your mouse across your screen to stream velocity commands to your robot!

๐Ÿงช Gazebo Simulation

To test teleop-cursor with TurtleBot3 inside Gazebo:

# Terminal 1: Launch Gazebo Simulation World
export TURTLEBOT3_MODEL=waffle
ros2 launch turtlebot3_gazebo turtlebot3_world.launch.py

# Terminal 2: Run via pip CLI
teleop-cursor

# Or via ros2 run (after colcon build)
ros2 run teleop_cursor teleop-cursor

For complete simulation launching and debugging guides, see docs/DEVELOPMENT.md.


โš™๏ธ Configuration & Parameters

The node parameters in cursor.py can be easily tuned:

Parameter Type Default Description
max_linear_speed float 0.2 Maximum linear speed limit ($v_x$) in meters/second
max_angular_speed float 1.0 Maximum angular speed limit ($\omega_z$) in radians/second
timer frequency float 0.1 (10 Hz) Publish rate period in seconds

๐Ÿ“‚ Repository Structure

teleop-cursor/
โ”œโ”€โ”€ teleop_cursor/        # Pip-installable Python package
โ”‚   โ”œโ”€โ”€ __init__.py       # Package initialisation & exports
โ”‚   โ””โ”€โ”€ cursor.py         # CursorFollowNode ROS 2 node implementation
โ”œโ”€โ”€ resource/             # ROS 2 ament_index resource marker
โ”‚   โ””โ”€โ”€ teleop_cursor
โ”œโ”€โ”€ cursor.py             # Backward-compatible script wrapper
โ”œโ”€โ”€ package.xml           # ROS 2 ament_python package manifest
โ”œโ”€โ”€ pyproject.toml        # PEP 517/518 build system & metadata
โ”œโ”€โ”€ setup.py              # Setuptools config (colcon + pip)
โ”œโ”€โ”€ LICENSE               # MIT Open Source License
โ”œโ”€โ”€ README.md             # Primary repository landing page
โ”œโ”€โ”€ CHANGELOG.md          # Version history & release notes
โ”œโ”€โ”€ CONTRIBUTING.md       # Open-source contribution & PR guide
โ”œโ”€โ”€ TIMELINE.md           # Project roadmap & release milestones
โ”œโ”€โ”€ SECURITY.md           # Security & physical robot safety policies
โ””โ”€โ”€ docs/
    โ”œโ”€โ”€ ARCHITECTURE.md   # Deep-dive architecture & transformation math
    โ””โ”€โ”€ DEVELOPMENT.md    # Developer setup, testing & simulation guide

๐Ÿ“– Documentation Directory

  • ๐Ÿ“ Technical Architecture: Deep dive into signal processing math, coordinate frame transformations, sequence diagrams, and message definitions.
  • ๐Ÿ’ป Developer Guide: Workspace setup, colcon building, linting rules (black/flake8), and ROS 2 debugging utilities.
  • ๐Ÿค Contributing Guidelines: Standard PR workflows, Conventional Commit requirements, and issue reporting.
  • ๐Ÿ—บ๏ธ Project Timeline & Roadmap: Milestone progression, release history, and feature roadmap (proportional control, deadband overlay).
  • ๐Ÿ“œ Changelog: Formal release logs adhering to Keep a Changelog.
  • ๐Ÿ”’ Security Policy: Safety standards for teleoperating physical mobile hardware.

๐Ÿ“„ License

This project is open-source software licensed under the MIT License.


Built with โค๏ธ for the ROS 2 Robotics Community by Garv Arora

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

teleop_cursor-1.0.0.tar.gz (12.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

teleop_cursor-1.0.0-py3-none-any.whl (9.5 kB view details)

Uploaded Python 3

File details

Details for the file teleop_cursor-1.0.0.tar.gz.

File metadata

  • Download URL: teleop_cursor-1.0.0.tar.gz
  • Upload date:
  • Size: 12.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for teleop_cursor-1.0.0.tar.gz
Algorithm Hash digest
SHA256 291445a4fe3608c26a9a66ca44f48315a1f97ee76c12d6bcbd930e106c42e951
MD5 5f9fc47cc4f787920179d912deafb438
BLAKE2b-256 f3c578e9bc48db8527620fd18cd590f7d9faef0db2aa04dff374eb4b0b541148

See more details on using hashes here.

Provenance

The following attestation bundles were made for teleop_cursor-1.0.0.tar.gz:

Publisher: publish.yml on gaminization/teleop-cursor

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file teleop_cursor-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: teleop_cursor-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 9.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for teleop_cursor-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 00ae3a35f66f9746114f69d1529adc2eb382b78511dd555950c5a2b4f81a70c0
MD5 b3ced56549dda0b516b35d27941c8950
BLAKE2b-256 73eb9a85f4b340adca7ed7e44b1cac2f457d146a582ed1f0267816b723a6cdc9

See more details on using hashes here.

Provenance

The following attestation bundles were made for teleop_cursor-1.0.0-py3-none-any.whl:

Publisher: publish.yml on gaminization/teleop-cursor

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page