Skip to content

Conversation

@kluge7
Copy link
Contributor

@kluge7 kluge7 commented Jan 4, 2026

This PR introduces keyboard_joy, a python package that publishes sensor_msgs/Joy messages based on keyboard input.

TODO: the current implementation uses pynput and only works on xorg (not Wayland).

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces keyboard_joy, a new ROS 2 Python package that enables keyboard-based control by publishing sensor_msgs/Joy messages. The package serves as a joystick replacement for development and testing purposes, with configurable key mappings and support for both hold and sticky axis modes. Note that the current implementation is limited to Xorg environments.

Key changes:

  • New keyboard_joy package with configurable YAML-based key mappings
  • Support for both axis control (hold/sticky modes) and button inputs via keyboard
  • Comprehensive test suite using pytest with mocked keyboard listener

Reviewed changes

Copilot reviewed 8 out of 10 changed files in this pull request and generated 17 comments.

Show a summary per file
File Description
mission/keyboard_joy/keyboard_joy/keyboard_joy_node.py Main node implementation with keyboard event handling, Joy message publishing, and axis/button state management
mission/keyboard_joy/config/key_mappings.yaml Default key mapping configuration defining axis and button bindings
mission/keyboard_joy/launch/keyboard_joy_node.launch.py Launch file for starting the keyboard_joy node with configurable parameters
mission/keyboard_joy/test/test_keyboard_joy_node.py Unit tests covering key mapping, axis modes, and button state transitions
mission/keyboard_joy/setup.py Python package setup configuration with dependencies and entry points
mission/keyboard_joy/setup.cfg Installation script configuration for ROS 2
mission/keyboard_joy/package.xml ROS 2 package manifest with dependencies
mission/keyboard_joy/README.md Package documentation describing functionality and known limitations
mission/keyboard_joy/keyboard_joy/init.py Empty package initialization file
mission/keyboard_joy/resource/keyboard_joy Empty resource marker file for ament

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@kluge7 kluge7 force-pushed the feat/keyboard-joy branch from 0588283 to 8893e9c Compare January 4, 2026 14:30
@codecov
Copy link

codecov bot commented Jan 4, 2026

Codecov Report

❌ Patch coverage is 0% with 128 lines in your changes missing coverage. Please review.
✅ Project coverage is 36.53%. Comparing base (24b00d6) to head (6599bda).

Files with missing lines Patch % Lines
...ion/keyboard_joy/keyboard_joy/keyboard_joy_node.py 0.00% 119 Missing and 4 partials ⚠️
mission/keyboard_joy/setup.py 0.00% 5 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #652      +/-   ##
==========================================
+ Coverage   35.58%   36.53%   +0.95%     
==========================================
  Files          38       36       -2     
  Lines        2254     2195      -59     
  Branches      686      706      +20     
==========================================
  Hits          802      802              
+ Misses       1273     1210      -63     
- Partials      179      183       +4     
Flag Coverage Δ
unittests 36.53% <0.00%> (+0.95%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
mission/keyboard_joy/setup.py 0.00% <0.00%> (ø)
...ion/keyboard_joy/keyboard_joy/keyboard_joy_node.py 0.00% <0.00%> (ø)

... and 4 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Q3rkses
Copy link
Contributor

Q3rkses commented Jan 5, 2026

bro why bootleg chatgpt talking

@kluge7 kluge7 requested a review from Q3rkses January 5, 2026 13:58
Copy link
Contributor

@Q3rkses Q3rkses left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you are looking good cooking

Comment on lines +12 to +23
start_message = r"""
██ ▄█▀▓█████▓██ ██▓ ▄▄▄▄ ▒█████ ▄▄▄ ██▀███ ▓█████▄ ▄▄▄██▀▀▀▒█████ ▓██ ██▓
██▄█▒ ▓█ ▀ ▒██ ██▒▓█████▄ ▒██▒ ██▒▒████▄ ▓██ ▒ ██▒▒██▀ ██▌ ▒██ ▒██▒ ██▒▒██ ██▒
▓███▄░ ▒███ ▒██ ██░▒██▒ ▄██▒██░ ██▒▒██ ▀█▄ ▓██ ░▄█ ▒░██ █▌ ░██ ▒██░ ██▒ ▒██ ██░
▓██ █▄ ▒▓█ ▄ ░ ▐██▓░▒██░█▀ ▒██ ██░░██▄▄▄▄██ ▒██▀▀█▄ ░▓█▄ ▌▓██▄██▓ ▒██ ██░ ░ ▐██▓░
▒██▒ █▄░▒████▒ ░ ██▒▓░░▓█ ▀█▓░ ████▓▒░ ▓█ ▓██▒░██▓ ▒██▒░▒████▓ ▓███▒ ░ ████▓▒░ ░ ██▒▓░
▒ ▒▒ ▓▒░░ ▒░ ░ ██▒▒▒ ░▒▓███▀▒░ ▒░▒░▒░ ▒▒ ▓▒█░░ ▒▓ ░▒▓░ ▒▒▓ ▒ ▒▓▒▒░ ░ ▒░▒░▒░ ██▒▒▒
░ ░▒ ▒░ ░ ░ ░▓██ ░▒░ ▒░▒ ░ ░ ▒ ▒░ ▒ ▒▒ ░ ░▒ ░ ▒░ ░ ▒ ▒ ▒ ░▒░ ░ ▒ ▒░ ▓██ ░▒░
░ ░░ ░ ░ ▒ ▒ ░░ ░ ░ ░ ░ ░ ▒ ░ ▒ ░░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ▒ ▒ ▒ ░░
░ ░ ░ ░░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░
░ ░ ░ ░ ░ ░
"""
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes

Copy link
Contributor

@Andeshog Andeshog left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider separating the ros layer (publishing) and the logic layer. This would also make the code easier to test, as you would not need to go through ros. Personally I find nested dataclasses better than dictionaries here (easier to read, and safer to use). It would also pretty much mirror the yaml file. Also consider Enum class for "mode" instead of string

Copy link
Contributor

@Andeshog Andeshog left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fine as is, but if you managed to separate the logic from ros, the code would be much easier to test (ref. when you removed the previously written tests). The only "ros stuff" is periodically publishing a joy message, so not a compelling reason to pack all the logic into a ros node

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants