diff --git a/commandsv2/src/main/java/org/wpilib/command2/button/CommandGamepad.java b/commandsv2/src/main/java/org/wpilib/command2/button/CommandGamepad.java index 4faf8503c9..464ab5bcec 100644 --- a/commandsv2/src/main/java/org/wpilib/command2/button/CommandGamepad.java +++ b/commandsv2/src/main/java/org/wpilib/command2/button/CommandGamepad.java @@ -873,22 +873,22 @@ public class CommandGamepad { } /** - * Get the left trigger axis value of the controller. Note that this axis is bound to the range of - * [0, 1] as opposed to the usual [-1, 1]. + * 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]. * * @return The axis value. */ - public double getLeftTriggerAxis() { - return m_gamepad.getLeftTriggerAxis(); + public double getLeftTrigger() { + return m_gamepad.getLeftTrigger(); } /** - * Get the right trigger axis value of the controller. Note that this axis is bound to the range - * of [0, 1] as opposed to the usual [-1, 1]. + * 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]. * * @return The axis value. */ - public double getRightTriggerAxis() { - return m_gamepad.getRightTriggerAxis(); + public double getRightTrigger() { + return m_gamepad.getRightTrigger(); } } diff --git a/commandsv2/src/main/native/cpp/button/CommandGamepad.cpp b/commandsv2/src/main/native/cpp/button/CommandGamepad.cpp index cef4f39805..c4d113a391 100644 --- a/commandsv2/src/main/native/cpp/button/CommandGamepad.cpp +++ b/commandsv2/src/main/native/cpp/button/CommandGamepad.cpp @@ -181,10 +181,10 @@ double CommandGamepad::GetRightY() const { return m_gamepad->GetRightY(); } -double CommandGamepad::GetLeftTriggerAxis() const { - return m_gamepad->GetLeftTriggerAxis(); +double CommandGamepad::GetLeftTrigger() const { + return m_gamepad->GetLeftTrigger(); } -double CommandGamepad::GetRightTriggerAxis() const { - return m_gamepad->GetRightTriggerAxis(); +double CommandGamepad::GetRightTrigger() const { + return m_gamepad->GetRightTrigger(); } diff --git a/commandsv2/src/main/native/include/wpi/commands2/button/CommandGamepad.hpp b/commandsv2/src/main/native/include/wpi/commands2/button/CommandGamepad.hpp index de68795ccb..7cd65fd471 100644 --- a/commandsv2/src/main/native/include/wpi/commands2/button/CommandGamepad.hpp +++ b/commandsv2/src/main/native/include/wpi/commands2/button/CommandGamepad.hpp @@ -494,20 +494,20 @@ class CommandGamepad { double GetRightY() const; /** - * Get the left trigger axis value of the controller. Note that this axis is + * 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]. * * @return The axis value. */ - double GetLeftTriggerAxis() const; + double GetLeftTrigger() const; /** - * Get the right trigger axis value of the controller. Note that this axis is + * 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]. * * @return The axis value. */ - double GetRightTriggerAxis() const; + double GetRightTrigger() const; private: CommandGenericHID* m_hid; diff --git a/commandsv3/src/main/java/org/wpilib/command3/button/CommandGamepad.java b/commandsv3/src/main/java/org/wpilib/command3/button/CommandGamepad.java index 1d521a0e7e..1de551e14d 100644 --- a/commandsv3/src/main/java/org/wpilib/command3/button/CommandGamepad.java +++ b/commandsv3/src/main/java/org/wpilib/command3/button/CommandGamepad.java @@ -824,22 +824,22 @@ public class CommandGamepad { } /** - * Get the left trigger axis value of the controller. Note that this axis is bound to the range of - * [0, 1] as opposed to the usual [-1, 1]. + * 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]. * * @return The axis value. */ - public double getLeftTriggerAxis() { - return m_gamepad.getLeftTriggerAxis(); + public double getLeftTrigger() { + return m_gamepad.getLeftTrigger(); } /** - * Get the right trigger axis value of the controller. Note that this axis is bound to the range - * of [0, 1] as opposed to the usual [-1, 1]. + * 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]. * * @return The axis value. */ - public double getRightTriggerAxis() { - return m_gamepad.getRightTriggerAxis(); + public double getRightTrigger() { + return m_gamepad.getRightTrigger(); } } diff --git a/wpilibc/src/main/native/cpp/driverstation/Gamepad.cpp b/wpilibc/src/main/native/cpp/driverstation/Gamepad.cpp index a2edd0f93f..937a2a84fe 100644 --- a/wpilibc/src/main/native/cpp/driverstation/Gamepad.cpp +++ b/wpilibc/src/main/native/cpp/driverstation/Gamepad.cpp @@ -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); diff --git a/wpilibc/src/main/native/include/wpi/driverstation/Gamepad.hpp b/wpilibc/src/main/native/include/wpi/driverstation/Gamepad.hpp index 691e9bd865..86c26a807f 100644 --- a/wpilibc/src/main/native/include/wpi/driverstation/Gamepad.hpp +++ b/wpilibc/src/main/native/include/wpi/driverstation/Gamepad.hpp @@ -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. diff --git a/wpilibc/src/main/python/semiwrap/Gamepad.yml b/wpilibc/src/main/python/semiwrap/Gamepad.yml index 7f4606bbae..adcb8650f2 100644 --- a/wpilibc/src/main/python/semiwrap/Gamepad.yml +++ b/wpilibc/src/main/python/semiwrap/Gamepad.yml @@ -29,13 +29,13 @@ classes: SetRightXDeadband: GetRightY: SetRightYDeadband: - GetLeftTriggerAxis: + GetLeftTrigger: SetLeftTriggerDeadband: LeftTrigger: overloads: double, EventLoop* [const]: EventLoop* [const]: - GetRightTriggerAxis: + GetRightTrigger: SetRightTriggerDeadband: RightTrigger: overloads: diff --git a/wpilibcExamples/src/main/cpp/examples/SysIdRoutine/cpp/SysIdRoutineBot.cpp b/wpilibcExamples/src/main/cpp/examples/SysIdRoutine/cpp/SysIdRoutineBot.cpp index 8cbb1c4e87..68d128d7bc 100644 --- a/wpilibcExamples/src/main/cpp/examples/SysIdRoutine/cpp/SysIdRoutineBot.cpp +++ b/wpilibcExamples/src/main/cpp/examples/SysIdRoutine/cpp/SysIdRoutineBot.cpp @@ -27,7 +27,7 @@ void SysIdRoutineBot::ConfigureBindings() { .WhileTrue(drive.SysIdDynamic(wpi::cmd::sysid::Direction::kReverse)); shooter.SetDefaultCommand(shooter.RunShooterCommand( - [this] { return driverController.GetLeftTriggerAxis(); })); + [this] { return driverController.GetLeftTrigger(); })); (driverController.FaceDown() && driverController.LeftBumper()) .WhileTrue( diff --git a/wpilibj/src/main/java/org/wpilib/driverstation/Gamepad.java b/wpilibj/src/main/java/org/wpilib/driverstation/Gamepad.java index 9b66bde911..21df9623d1 100644 --- a/wpilibj/src/main/java/org/wpilib/driverstation/Gamepad.java +++ b/wpilibj/src/main/java/org/wpilib/driverstation/Gamepad.java @@ -299,14 +299,14 @@ public class Gamepad implements HIDDevice, Sendable { } /** - * Get the left trigger axis value of the controller. Note that this axis is bound to the range of - * [0, 1] as opposed to the usual [-1, 1]. + * 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 {@link #setLeftTriggerDeadband} to change it. * * @return The axis value. */ - public double getLeftTriggerAxis() { + public double getLeftTrigger() { return MathUtil.applyDeadband(getAxis(Axis.LEFT_TRIGGER), m_leftTriggerDeadband); } @@ -337,14 +337,14 @@ public class Gamepad implements HIDDevice, Sendable { } /** - * Get the right trigger axis value of the controller. Note that this axis is bound to the range - * of [0, 1] as opposed to the usual [-1, 1]. + * 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 {@link #setRightTriggerDeadband} to change it. * * @return The axis value. */ - public double getRightTriggerAxis() { + public double getRightTrigger() { return MathUtil.applyDeadband(getAxis(Axis.RIGHT_TRIGGER), m_rightTriggerDeadband); } @@ -1563,10 +1563,8 @@ public class Gamepad implements HIDDevice, Sendable { public void initSendable(SendableBuilder builder) { builder.setSmartDashboardType("HID"); builder.publishConstString("ControllerType", "Gamepad"); - builder.addDoubleProperty( - "LeftTrigger Axis", () -> getAxisForSendable(Axis.LEFT_TRIGGER), null); - builder.addDoubleProperty( - "RightTrigger Axis", () -> getAxisForSendable(Axis.RIGHT_TRIGGER), null); + builder.addDoubleProperty("LeftTrigger", () -> getAxisForSendable(Axis.LEFT_TRIGGER), null); + builder.addDoubleProperty("RightTrigger", () -> getAxisForSendable(Axis.RIGHT_TRIGGER), null); builder.addDoubleProperty("LeftX", () -> getAxisForSendable(Axis.LEFT_X), null); builder.addDoubleProperty("LeftY", () -> getAxisForSendable(Axis.LEFT_Y), null); builder.addDoubleProperty("RightX", () -> getAxisForSendable(Axis.RIGHT_X), null); diff --git a/wpilibjExamples/src/main/java/org/wpilib/examples/expansionhubsample/DefaultTeleMode.java b/wpilibjExamples/src/main/java/org/wpilib/examples/expansionhubsample/DefaultTeleMode.java index 29c8ea3594..91938333e4 100644 --- a/wpilibjExamples/src/main/java/org/wpilib/examples/expansionhubsample/DefaultTeleMode.java +++ b/wpilibjExamples/src/main/java/org/wpilib/examples/expansionhubsample/DefaultTeleMode.java @@ -25,7 +25,7 @@ public class DefaultTeleMode extends PeriodicOpMode { robot.motor1.setThrottle(-gamepad.getRightY()); robot.motor2.setThrottle(-gamepad.getLeftX()); robot.motor3.setThrottle(-gamepad.getRightX()); - robot.servo0.setPosition(gamepad.getLeftTriggerAxis()); - robot.servo1.setPosition(gamepad.getRightTriggerAxis()); + robot.servo0.setPosition(gamepad.getLeftTrigger()); + robot.servo1.setPosition(gamepad.getRightTrigger()); } } diff --git a/wpilibjExamples/src/main/java/org/wpilib/examples/sysidroutine/SysIdRoutineBot.java b/wpilibjExamples/src/main/java/org/wpilib/examples/sysidroutine/SysIdRoutineBot.java index d54aa64162..24b0d06114 100644 --- a/wpilibjExamples/src/main/java/org/wpilib/examples/sysidroutine/SysIdRoutineBot.java +++ b/wpilibjExamples/src/main/java/org/wpilib/examples/sysidroutine/SysIdRoutineBot.java @@ -62,7 +62,7 @@ public class SysIdRoutineBot { .whileTrue(drive.sysIdDynamic(SysIdRoutine.Direction.kReverse)); // Control the shooter wheel with the left trigger - shooter.setDefaultCommand(shooter.runShooter(driverController::getLeftTriggerAxis)); + shooter.setDefaultCommand(shooter.runShooter(driverController::getLeftTrigger)); driverController .faceDown()