[wpilib,cmd] Remove Axis from Gamepad Triggers (#8956)

It's a bit confusing, especially since some controllers will have this be
a 0:1 button rather than axis.
This commit is contained in:
Thad House
2026-06-12 06:42:06 -07:00
committed by GitHub
parent d6fb871a26
commit 5a7d7d50ee
11 changed files with 47 additions and 49 deletions

View File

@@ -69,7 +69,7 @@ void Gamepad::SetRightYDeadband(double deadband) {
m_rightYDeadband = ClampDeadband(deadband);
}
double Gamepad::GetLeftTriggerAxis() const {
double Gamepad::GetLeftTrigger() const {
return wpi::math::ApplyDeadband(GetAxis(Axis::LEFT_TRIGGER),
m_leftTriggerDeadband);
}
@@ -88,7 +88,7 @@ BooleanEvent Gamepad::LeftTrigger(EventLoop* loop) const {
return this->LeftTrigger(0.5, loop);
}
double Gamepad::GetRightTriggerAxis() const {
double Gamepad::GetRightTrigger() const {
return wpi::math::ApplyDeadband(GetAxis(Axis::RIGHT_TRIGGER),
m_rightTriggerDeadband);
}
@@ -613,10 +613,10 @@ void Gamepad::InitSendable(wpi::util::SendableBuilder& builder) {
builder.SetSmartDashboardType("HID");
builder.PublishConstString("ControllerType", "Gamepad");
builder.AddDoubleProperty(
"LeftTrigger Axis",
[this] { return GetAxisForSendable(Axis::LEFT_TRIGGER); }, nullptr);
"LeftTrigger", [this] { return GetAxisForSendable(Axis::LEFT_TRIGGER); },
nullptr);
builder.AddDoubleProperty(
"RightTrigger Axis",
"RightTrigger",
[this] { return GetAxisForSendable(Axis::RIGHT_TRIGGER); }, nullptr);
builder.AddDoubleProperty(
"LeftX", [this] { return GetAxisForSendable(Axis::LEFT_X); }, nullptr);

View File

@@ -214,7 +214,7 @@ class Gamepad : public HIDDevice,
void SetRightYDeadband(double deadband);
/**
* Get the left trigger axis value of the controller. Note that this axis
* Get the left trigger value of the controller. Note that this axis
* is bound to the range of [0, 1] as opposed to the usual [-1, 1].
*
* A deadband of 0.01 is applied by default. Use SetLeftTriggerDeadband() to
@@ -222,7 +222,7 @@ class Gamepad : public HIDDevice,
*
* @return the axis value.
*/
double GetLeftTriggerAxis() const;
double GetLeftTrigger() const;
/**
* Set the deadband for the left trigger axis.
@@ -256,7 +256,7 @@ class Gamepad : public HIDDevice,
BooleanEvent LeftTrigger(EventLoop* loop) const;
/**
* Get the right trigger axis value of the controller. Note that this axis
* Get the right trigger value of the controller. Note that this axis
* is bound to the range of [0, 1] as opposed to the usual [-1, 1].
*
* A deadband of 0.01 is applied by default. Use SetRightTriggerDeadband() to
@@ -264,7 +264,7 @@ class Gamepad : public HIDDevice,
*
* @return the axis value.
*/
double GetRightTriggerAxis() const;
double GetRightTrigger() const;
/**
* Set the deadband for the right trigger axis.

View File

@@ -29,13 +29,13 @@ classes:
SetRightXDeadband:
GetRightY:
SetRightYDeadband:
GetLeftTriggerAxis:
GetLeftTrigger:
SetLeftTriggerDeadband:
LeftTrigger:
overloads:
double, EventLoop* [const]:
EventLoop* [const]:
GetRightTriggerAxis:
GetRightTrigger:
SetRightTriggerDeadband:
RightTrigger:
overloads: