Skip to content

Upgrade/gamepad mappings#49

Closed
MarcOlivierFecteau wants to merge 5 commits intoSherbyRobotics:ros2from
MarcOlivierFecteau:upgrade/gamepad-mappings
Closed

Upgrade/gamepad mappings#49
MarcOlivierFecteau wants to merge 5 commits intoSherbyRobotics:ros2from
MarcOlivierFecteau:upgrade/gamepad-mappings

Conversation

@MarcOlivierFecteau
Copy link
Collaborator

mode_independent_mappings

The unused code is commented out instead of removed to preserve the
originally intended logic.
The affected lines are commented out instead of removed to preserve the
originally intended logic.
The issue was that the arbitration node didn't check the controller
inputs to verify the required buttons for controlling the racecar with
the behaviors were pressed, so it sent the command with the highest
priority whether or not the deadman switch and the
"autopilot-using-behaviors" were pressed, which would have been
problematic when testing the behaviors on the racecar (as one can
conclude with an autonomous vehicle ignoring the security measures).

The arbitration node now checks the `joy` topic for the required inputs,
and publishes only the "manual" commands if the requirements aren't met.
The input mode of the Logitech F710 used for the racecar is DirectInput.
`joy.joy_node` uses SDL's lower-level Joystick API: when used with the
Logitech F710, the indices in the `Joy` message differ between the
XInput mode and the DirectInput mode.

This commit aims to eliminate the confusion that can arise when the user
unintentionally switches the gamepad into XInput mode. The "joy" node
now uses SDL's GameController API, which offers consistent mappings in
the `Joy` message, independently of the mode the gamepad is in. The
indices of the buttons and axes in the logic of the `teleop` package
have been changed to keep the original physical mappings identical. All
launch files that include a "joy" node have been updated to use the
correct executable.

Additionally, the check for the minimum number of axes has been removed,
because the only gamepad used for controlling the racecar is the
Logitech F710, so it doesn't make sense to check for a potentially
incompatible gamepad.

NOTES:

- This commit has only been tested on a Xbox One controller (XInput
  mode).

TODO:

- Test GRO830's lab with a Logitech F710 in both XInput and DirectInput
  mode, and confirm the values obtained in the `Joy` message AND the
  `ctl_ref` message are identical for both modes BEFORE merging this PR.
@MarcOlivierFecteau MarcOlivierFecteau self-assigned this Nov 1, 2025
@MarcOlivierFecteau MarcOlivierFecteau added the enhancement New feature or request label Nov 1, 2025
@MarcOlivierFecteau
Copy link
Collaborator Author

TODO BEFORE merging this PR:

  1. Wait until Implement security measures for behavior-based autonomous driving #48 has been merged into ros2 branch;
  2. Rebase this branch to avoid merge conflicts;
  3. Test output of slash_teleop (/ctl_ref) with the Logitech F710 in both modes, and confirm the output is the same as before;
  4. (Optional) test GRO501-2 (or GRO830) on the racecar with the Logitech F710 in both modes.

@MarcOlivierFecteau MarcOlivierFecteau marked this pull request as draft November 1, 2025 20:53
@alx87grd
Copy link
Collaborator

alx87grd commented Nov 2, 2025

Allô, je préfère ne pas faire de modifications, du moins pour tout ce qui touche au core pipeline (teleop, slash-controller, Arduino) des APP2 et APP4.

Alex

@alx87grd alx87grd closed this Nov 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants