Fix Align Encoders trigger silently doing nothing - #194
Merged
Conversation
…dings Move the "Triggers/Align Encoders" NT trigger into Drive itself, requiring the Drive subsystem and resetting the boolean back to false once the encoders are zeroed, matching Biocore. Root cause of it silently doing nothing: ControllerSelector.scan() cleared the CommandScheduler's shared default button loop to rebind controls on every rescan, which wiped out any other Trigger (like Align Encoders) registered on that same shared loop. ControllerSelector now owns a private EventLoop for its own bindings, polled explicitly from robotPeriodic(), so rescanning never touches Triggers registered elsewhere. Ported from Biocore commit 0b07ed7. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Triggers/Align EncodersNT trigger fromRobot.javaintoDrive.java, requiring theDrivesubsystem and resetting the boolean back tofalseafter zeroing, matching Biocore's implementation.ControllerSelector.scan()calledCommandScheduler.getInstance().getDefaultButtonLoop().clear()to rebind controller controls, which silently wiped out anyTriggerregistered on that shared default loop beforeControllerSelectorran — including Align Encoders.ControllerSelectornow owns a privateEventLoopfor its own bindings, polled explicitly fromrobotPeriodic(), so re-scanning never touches Triggers registered elsewhere. Ported from Biocore commit0b07ed7.Test plan
./gradlew compileJava compileTestJavapasses cleanTriggers/Align Encoderstotruein Glass actually zeros the swerve encoders and the boolean pops back tofalse🤖 Generated with Claude Code