Add a default deadband to all gamepads#8897
Open
ThadHouse wants to merge 7 commits into
Open
Conversation
The FTC DS had a deadband. Additionally, the FRC one had an implicit deadband due to the only 8 bit resolution. We need a deadband by default now with the high resolution gamepads
There was a problem hiding this comment.
Pull request overview
Adds configurable default deadbands to the generic Gamepad APIs so high-resolution controller axis noise is filtered before callers consume stick and trigger values.
Changes:
- Adds per-axis deadband state and setters in Java and C++ Gamepad classes.
- Applies
MathUtil.applyDeadband/wpi::math::ApplyDeadbandto stick and trigger axis getters. - Exposes the new C++ setters through the Python semiwrap configuration.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
wpilibj/src/main/java/org/wpilib/driverstation/Gamepad.java |
Adds Java deadband fields, setters, docs, and deadbanded axis getters. |
wpilibc/src/main/python/semiwrap/Gamepad.yml |
Adds wrapper entries for the new C++ deadband setter methods. |
wpilibc/src/main/native/include/wpi/driverstation/Gamepad.hpp |
Declares C++ deadband setters and stores default deadband values. |
wpilibc/src/main/native/cpp/driverstation/Gamepad.cpp |
Applies deadbands in C++ axis getters and implements setters. |
Comments suppressed due to low confidence (1)
wpilibj/src/main/java/org/wpilib/driverstation/Gamepad.java:306
- This applies the new deadband to getRightTriggerAxis(), but rightTrigger(...) still uses axisGreaterThan(Axis.RIGHT_TRIGGER, ...) which reads the raw axis. As a result Java trigger events ignore the configured/default trigger deadband while the C++ implementation compares against GetRightTriggerAxis(). Please make the trigger event use the deadbanded getter (and update the command wrapper similarly) so the API is consistent.
return MathUtil.applyDeadband(getAxis(Axis.RIGHT_TRIGGER), m_rightTriggerDeadband);
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
004b20a to
4c67943
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 5 out of 5 changed files in this pull request and generated no new comments.
Comments suppressed due to low confidence (2)
wpilibj/src/main/java/org/wpilib/driverstation/Gamepad.java:339
- Renaming these public face-button accessors removes the existing
getSouthFaceButton*/southFace(...)API, so existing robot projects will fail to compile even though the PR is scoped to adding default deadbands. Unless this is an intentional breaking change, keep deprecated aliases that delegate to the newfaceDownnames.
public boolean getSouthFaceButton() {
wpilibc/src/main/native/include/wpi/driverstation/Gamepad.hpp:269
- Renaming these public face-button accessors removes the existing
GetSouthFaceButton*/SouthFace(...)API, so existing C++ robot projects will fail to compile even though the PR is scoped to adding default deadbands. Unless this is an intentional breaking change, keep deprecated aliases that delegate to the newFaceDownnames.
bool GetSouthFaceButton() const;
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.
The FTC DS had a deadband. Additionally, the FRC one had an implicit deadband due to the only 8 bit resolution. We need a deadband by default now with the high resolution gamepads