Skip to content

Add a default deadband to all gamepads#8897

Open
ThadHouse wants to merge 7 commits into
wpilibsuite:mainfrom
ThadHouse:defaultdeadband
Open

Add a default deadband to all gamepads#8897
ThadHouse wants to merge 7 commits into
wpilibsuite:mainfrom
ThadHouse:defaultdeadband

Conversation

@ThadHouse
Copy link
Copy Markdown
Member

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

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
@ThadHouse ThadHouse requested a review from a team as a code owner May 14, 2026 19:08
@ThadHouse ThadHouse requested a review from Copilot May 14, 2026 20:13
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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::ApplyDeadband to 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.

Comment thread wpilibj/src/main/java/org/wpilib/driverstation/Gamepad.java
@ThadHouse ThadHouse requested a review from a team as a code owner May 15, 2026 04:59
@ThadHouse ThadHouse requested a review from a team as a code owner May 15, 2026 16:09
@ThadHouse ThadHouse requested a review from Copilot May 15, 2026 16:09
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 new faceDown names.
  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 new FaceDown names.
  bool GetSouthFaceButton() const;

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 14 out of 14 changed files in this pull request and generated 2 comments.

Comment thread wpilibj/src/main/java/org/wpilib/driverstation/Gamepad.java
Comment thread wpilibc/src/main/native/cpp/driverstation/Gamepad.cpp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants