Skip to content

Fix autorepeat for game_controller_node#312

Open
abrandemuehl wants to merge 1 commit intoros-drivers:ros2from
abrandemuehl:fix-autorepeat-game-controller
Open

Fix autorepeat for game_controller_node#312
abrandemuehl wants to merge 1 commit intoros-drivers:ros2from
abrandemuehl:fix-autorepeat-game-controller

Conversation

@abrandemuehl
Copy link
Copy Markdown

The game_controller_node event loop runs the logic to run the autorepeat logic only when no events are received on the SDL_WaitEventTimeout. This means that when repeated events occur such as holding the joystick in the same location or ignored events like deadzone axis events are received, the autorepeat logic is skipped.

This commit refactors the autorepeat and coalescing logic

  1. Timeouts based on how long there should be until the next expected publish, whether that's the autorepeat interval or the coalesce period.
  2. Unconditional checking of the timing for coalesced and autorepeat publishing.

This should fix the problem of the joy messages not properly autorepeating

@abrandemuehl abrandemuehl force-pushed the fix-autorepeat-game-controller branch from e66fb95 to 775caff Compare March 9, 2026 14:02
The game_controller_node event loop runs the logic to run the
autorepeat logic _only_ when no events are received on the
SDL_WaitEventTimeout. This means that when repeated events occur such
as holding the joystick in the same location or ignored events like
deadzone axis events are received, the autorepeat logic is skipped.

This commit refactors the autorepeat and coalescing logic
1. Timeouts based on how long there should be until the next expected
   publish, whether that's the autorepeat interval or the coalesce
   period.
2. Unconditional checking of the timing for coalesced and autorepeat
   publishing.

This should fix the problem of the joy messages not properly
autorepeating
@abrandemuehl abrandemuehl force-pushed the fix-autorepeat-game-controller branch from 775caff to 94d9647 Compare March 9, 2026 14:16
@abrandemuehl
Copy link
Copy Markdown
Author

@clalancette I wrote this before seeing #261, If you'd like I can check if it's possible to apply the same simpler fix. I think what I've done is correct but I'm a bit worried that I can't really test it against any sort of mock SDL event loop

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.

1 participant