Skip to content

Conversation

@MarcOlivierFecteau
Copy link
Collaborator

The motivation for this commit stems from the discrepancies between the input modes of the Logitech F710 controller (DirectInput and XInput), potentially causing confusion when trying to teleoperate the racecar.

Instead of directly reading the values from the Joy msg in the callback, a local dictionary containing the values of the axes and the buttons is updated before going through the logic of the callback. This abstraction SHOULD make it so the same input in both input modes result in the same command** sent to the controller.

** Since the triggers are treated as buttons in DirectInput mode,
a command using the analog value of a trigger will not be equivalent
in both modes.

The ROS parameter input_mode is added to the node to specify the input mode. IMPORTANT: the input mode does NOT update automatically if the input mode is changed on the F710 or if a new controller is used.

CHANGES:

  • Add node argument input_mode to specify the input mode;
  • Add (local) axes and buttons dictionaries;
  • Add dictionary update function;
  • Replace hard-coded msg.<category>[<ID>] with mode-independant values;
  • Auto-format the teleop node file;
  • Add mappings for the Xbox One Controller and Logitech F710 (XInput) in the documentation:
    • The DirectInput mappings WILL be added in an ulterior commit (I currently don't have a F710 to test the mappings);

@MarcOlivierFecteau MarcOlivierFecteau added the enhancement New feature or request label Sep 27, 2025
@MarcOlivierFecteau MarcOlivierFecteau force-pushed the upgrade/controller-mappings branch from 1c39d81 to 8aa7c7c Compare September 27, 2025 01:50
The motivation for this commit stems from the discrepancies between the
input modes of the Logitech F710 controller (DirectInput and XInput),
potentially causing confusion when trying to teleoperate the racecar.

Instead of directly reading the values from the `Joy` msg in the
callback, a local dictionary containing the values of the axes and the
buttons is updated before going through the logic of the callback. This
abstraction SHOULD make it so the same input in both input modes
result in the same command\*\* sent to the controller. Additionally,
this abstraction makes the code more readable (IMO).

> \*\* Since the triggers are treated as buttons in DirectInput mode,
> a command using the analog value of a trigger will not be equivalent
> in both modes.

The ROS parameter `input_mode` is added to the node to specify the input
mode. **IMPORTANT**: the input mode does NOT update automatically if the
input mode is changed on the F710 or if a new controller is used.

CHANGES:

- Add node argument `input_mode` to specify the input mode;
- Add (local) axes and buttons dictionaries;
- Add dictionary update function;
- Replace hard-coded `msg.<category>[<ID>]` with mode-independant
  values;
- Auto-format the `teleop` node file;
- Add mappings for the Xbox One Controller and Logitech F710 (XInput) in
  the documentation:
  - The DirectInput mappings WILL be added in an ulterior commit (I
    currently don't have a F710 to test the mappings);
@MarcOlivierFecteau MarcOlivierFecteau force-pushed the upgrade/controller-mappings branch from 8aa7c7c to 086c642 Compare September 27, 2025 01:52
This commit also adds a note about the `mode` button on the F710.
@alx87grd
Copy link
Collaborator

Allô Marco,

Merci pour les suggestions, toutefois je préfère ne pas faire de changements dans les fichiers de base pour le contrôle, i.e. dans slash_controller, slash_teleop et main.cpp (arduino).

Alexandre

@alx87grd alx87grd closed this Sep 29, 2025
@MarcOlivierFecteau
Copy link
Collaborator Author

@alx87grd c'était un draft pour des changements pour A26, dans le cadre de la migration vers micro-ROS sur le micro-contrôleur. Je me disais: "tant qu'à changer le hardware (micro-contrôleur), on pourrait faire le 'grand ménage' niveau software".

J'envisageais travailler sur ce "grand ménage" à temps perdu, et au moment opportun, présenter la "nouvelle" codebase à l'équipe.

@alx87grd
Copy link
Collaborator

alx87grd commented Oct 1, 2025

Ah ok, oui effectivement ma crainte principale était que je ne voulais pas faire des changements en plein APP, les étudiants ont modifié ce fichier dans leurs branches.

Pour le long terme, idéalement ça serait mieux de préalablement récolter la vision et les besoins (des enseignants)

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