Skip to content

joystick: add "reverse" mode and "gain" functionality#2477

Open
ES-Alexander wants to merge 5 commits intobluerobotics:masterfrom
ES-Alexander:joystick-axes-reverse
Open

joystick: add "reverse" mode and "gain" functionality#2477
ES-Alexander wants to merge 5 commits intobluerobotics:masterfrom
ES-Alexander:joystick-axes-reverse

Conversation

@ES-Alexander
Copy link
Copy Markdown
Contributor

@ES-Alexander ES-Alexander commented Mar 7, 2026

Based over #24761 and #2478 (the first two commits) - I figured it would be easier to review them separately and rebase this over master before it gets reviewed. If not, we can just review and merge this one instead of those 🤷‍♂️

Fixes #2221, by adding a base reverse data-lake variable (which can be used to trigger additional related functionality), then splitting that into per-axis compound variables*. The base variable can be directly (momentarily) controlled by a joystick button, or statefully controlled with the provided Actions.

*NOTE: Since we tend to operate with the vertical axis in earth frame, the vertical axis never gets reversed, and because of that yaw shouldn't either. Motion axes vs manual control axes are also inconsistent between vehicles, so:
- ArduSub should reverse everything except Z and R
- Rover/boat should reverse only Z
- Copter should reverse only X and Y
- Plane should ignore reverse inputs (it's not safe)

Fixes #2480, with a base gain data-lake variable, and applying it by default to only translation axes (a suggestion from @Williangalvani) for each vehicle type, falling back to a gain of 1 for rotation / undefined axes. The base variable can be directly controlled with range input widgets (like a slider), or incremented and decremented with the provided Actions. Unlike the reversing state, the gain state and number of steps are persistent across reboots.

Footnotes

  1. If you've been testing joystick: migrate MANUAL_CONTROL axes to data lake #2476, you'll need to delete the Axis * Output compound variables before this one will work, since it doesn't currently include a migration.

@ES-Alexander ES-Alexander force-pushed the joystick-axes-reverse branch 2 times, most recently from 612edcb to 1672a31 Compare March 7, 2026 17:27
@ES-Alexander ES-Alexander force-pushed the joystick-axes-reverse branch from 1672a31 to 945c25b Compare March 7, 2026 18:15
@ES-Alexander ES-Alexander marked this pull request as ready for review March 8, 2026 11:28
@ES-Alexander ES-Alexander marked this pull request as draft March 9, 2026 07:33
@ES-Alexander
Copy link
Copy Markdown
Contributor Author

ES-Alexander commented Mar 9, 2026

I've just raised #2480, and realised this is probably the ideal place to implement that, because then both can be made available simultaneously (and these definitions will likely be hard/annoying to migrate for users once they already have them). Implementing both gain and reversing in a single compound variable would also be marginally more performant, because then the output messages only need to pull in one "scale" variable value.

@ES-Alexander ES-Alexander added the docs-needed Change needs to be documented label Mar 9, 2026
@ES-Alexander ES-Alexander force-pushed the joystick-axes-reverse branch from 945c25b to 00b7ed1 Compare March 10, 2026 20:26
- Avoids reversing the vertical or yaw axes, as we typically intuit those as world-frame.
- Only applies gain to translation axes by default
  - Users can edit the compound variables if they want to add it to rotations as well
@ES-Alexander ES-Alexander force-pushed the joystick-axes-reverse branch from 00b7ed1 to 810ef8f Compare March 10, 2026 20:30
@ES-Alexander ES-Alexander changed the title joystick: add a "reverse" mode/function joystick: add "reverse" mode and "gain" functionality Mar 10, 2026
@ES-Alexander ES-Alexander marked this pull request as ready for review March 10, 2026 20:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs-needed Change needs to be documented

Projects

None yet

Development

Successfully merging this pull request may close these issues.

joystick: add pilot "gain" support frontend: joystick: add a "reverse" mode

1 participant