๐ฑ๏ธ teleop-cursor
Intuitive Desktop Cursor Teleoperation for ROS 2 Mobile Robots
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
rclpyand standardgeometry_msgs/msg/Twistpayloads, 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
- 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.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
291445a4fe3608c26a9a66ca44f48315a1f97ee76c12d6bcbd930e106c42e951
|
|
| MD5 |
5f9fc47cc4f787920179d912deafb438
|
|
| BLAKE2b-256 |
f3c578e9bc48db8527620fd18cd590f7d9faef0db2aa04dff374eb4b0b541148
|
Provenance
The following attestation bundles were made for teleop_cursor-1.0.0.tar.gz:
Publisher:
publish.yml on gaminization/teleop-cursor
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
teleop_cursor-1.0.0.tar.gz -
Subject digest:
291445a4fe3608c26a9a66ca44f48315a1f97ee76c12d6bcbd930e106c42e951 - Sigstore transparency entry: 2260134943
- Sigstore integration time:
-
Permalink:
gaminization/teleop-cursor@b679750c793f71222438789984e76593fb3c566c -
Branch / Tag:
refs/tags/v1.0.0 - Owner: https://github.com/gaminization
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@b679750c793f71222438789984e76593fb3c566c -
Trigger Event:
release
-
Statement type:
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
00ae3a35f66f9746114f69d1529adc2eb382b78511dd555950c5a2b4f81a70c0
|
|
| MD5 |
b3ced56549dda0b516b35d27941c8950
|
|
| BLAKE2b-256 |
73eb9a85f4b340adca7ed7e44b1cac2f457d146a582ed1f0267816b723a6cdc9
|
Provenance
The following attestation bundles were made for teleop_cursor-1.0.0-py3-none-any.whl:
Publisher:
publish.yml on gaminization/teleop-cursor
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
teleop_cursor-1.0.0-py3-none-any.whl -
Subject digest:
00ae3a35f66f9746114f69d1529adc2eb382b78511dd555950c5a2b4f81a70c0 - Sigstore transparency entry: 2260135039
- Sigstore integration time:
-
Permalink:
gaminization/teleop-cursor@b679750c793f71222438789984e76593fb3c566c -
Branch / Tag:
refs/tags/v1.0.0 - Owner: https://github.com/gaminization
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@b679750c793f71222438789984e76593fb3c566c -
Trigger Event:
release
-
Statement type: