mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-28 02:11:43 +00:00
[wpilib,cmd] Rename gamepad shoulder to bumper (#8573)
Both programs used bumper, so we shouldn't rename it. There's no reason to change it, and we don't need to match SDL.
This commit is contained in:
@@ -236,47 +236,47 @@ public class CommandGamepad extends CommandGenericHID {
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the right shoulder button's digital signal.
|
||||
* Constructs a Trigger instance around the right bumper button's digital signal.
|
||||
*
|
||||
* @return a Trigger instance representing the right shoulder button's digital signal attached to
|
||||
* @return a Trigger instance representing the right bumper button's digital signal attached to
|
||||
* the {@link CommandScheduler#getDefaultButtonLoop() default scheduler button loop}.
|
||||
* @see #leftShoulder(EventLoop)
|
||||
* @see #leftBumper(EventLoop)
|
||||
*/
|
||||
public Trigger leftShoulder() {
|
||||
return leftShoulder(CommandScheduler.getInstance().getDefaultButtonLoop());
|
||||
public Trigger leftBumper() {
|
||||
return leftBumper(CommandScheduler.getInstance().getDefaultButtonLoop());
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the right shoulder button's digital signal.
|
||||
* Constructs a Trigger instance around the right bumper button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return a Trigger instance representing the right shoulder button's digital signal attached to
|
||||
* @return a Trigger instance representing the right bumper button's digital signal attached to
|
||||
* the given loop.
|
||||
*/
|
||||
public Trigger leftShoulder(EventLoop loop) {
|
||||
return button(Gamepad.Button.kLeftShoulder.value, loop);
|
||||
public Trigger leftBumper(EventLoop loop) {
|
||||
return button(Gamepad.Button.kLeftBumper.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the right shoulder button's digital signal.
|
||||
* Constructs a Trigger instance around the right bumper button's digital signal.
|
||||
*
|
||||
* @return a Trigger instance representing the right shoulder button's digital signal attached to
|
||||
* @return a Trigger instance representing the right bumper button's digital signal attached to
|
||||
* the {@link CommandScheduler#getDefaultButtonLoop() default scheduler button loop}.
|
||||
* @see #rightShoulder(EventLoop)
|
||||
* @see #rightBumper(EventLoop)
|
||||
*/
|
||||
public Trigger rightShoulder() {
|
||||
return rightShoulder(CommandScheduler.getInstance().getDefaultButtonLoop());
|
||||
public Trigger rightBumper() {
|
||||
return rightBumper(CommandScheduler.getInstance().getDefaultButtonLoop());
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the right shoulder button's digital signal.
|
||||
* Constructs a Trigger instance around the right bumper button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return a Trigger instance representing the right shoulder button's digital signal attached to
|
||||
* @return a Trigger instance representing the right bumper button's digital signal attached to
|
||||
* the given loop.
|
||||
*/
|
||||
public Trigger rightShoulder(EventLoop loop) {
|
||||
return button(Gamepad.Button.kRightShoulder.value, loop);
|
||||
public Trigger rightBumper(EventLoop loop) {
|
||||
return button(Gamepad.Button.kRightBumper.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -49,12 +49,12 @@ Trigger CommandGamepad::RightStick(wpi::EventLoop* loop) const {
|
||||
return Button(wpi::Gamepad::Button::kRightStick, loop);
|
||||
}
|
||||
|
||||
Trigger CommandGamepad::LeftShoulder(wpi::EventLoop* loop) const {
|
||||
return Button(wpi::Gamepad::Button::kLeftShoulder, loop);
|
||||
Trigger CommandGamepad::LeftBumper(wpi::EventLoop* loop) const {
|
||||
return Button(wpi::Gamepad::Button::kLeftBumper, loop);
|
||||
}
|
||||
|
||||
Trigger CommandGamepad::RightShoulder(wpi::EventLoop* loop) const {
|
||||
return Button(wpi::Gamepad::Button::kRightShoulder, loop);
|
||||
Trigger CommandGamepad::RightBumper(wpi::EventLoop* loop) const {
|
||||
return Button(wpi::Gamepad::Button::kRightBumper, loop);
|
||||
}
|
||||
|
||||
Trigger CommandGamepad::DpadUp(wpi::EventLoop* loop) const {
|
||||
|
||||
@@ -141,30 +141,28 @@ class CommandGamepad : public CommandGenericHID {
|
||||
.GetDefaultButtonLoop()) const;
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the right shoulder button's
|
||||
* Constructs a Trigger instance around the right bumper button's
|
||||
* digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to. Defaults to the
|
||||
* CommandScheduler's default loop.
|
||||
* @return a Trigger instance representing the right shoulder button's
|
||||
* @return a Trigger instance representing the right bumper button's
|
||||
* digital signal attached to the given loop.
|
||||
*/
|
||||
Trigger LeftShoulder(
|
||||
wpi::EventLoop* loop =
|
||||
CommandScheduler::GetInstance().GetDefaultButtonLoop()) const;
|
||||
Trigger LeftBumper(wpi::EventLoop* loop = CommandScheduler::GetInstance()
|
||||
.GetDefaultButtonLoop()) const;
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the right shoulder button's
|
||||
* Constructs a Trigger instance around the right bumper button's
|
||||
* digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to. Defaults to the
|
||||
* CommandScheduler's default loop.
|
||||
* @return a Trigger instance representing the right shoulder button's
|
||||
* @return a Trigger instance representing the right bumper button's
|
||||
* digital signal attached to the given loop.
|
||||
*/
|
||||
Trigger RightShoulder(
|
||||
wpi::EventLoop* loop =
|
||||
CommandScheduler::GetInstance().GetDefaultButtonLoop()) const;
|
||||
Trigger RightBumper(wpi::EventLoop* loop = CommandScheduler::GetInstance()
|
||||
.GetDefaultButtonLoop()) const;
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the D-pad up button's
|
||||
|
||||
@@ -266,51 +266,51 @@ public class CommandGamepad extends CommandGenericHID {
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the right shoulder button's digital signal.
|
||||
* Constructs a Trigger instance around the right bumper button's digital signal.
|
||||
*
|
||||
* @return a Trigger instance representing the right shoulder button's digital signal attached to
|
||||
* @return a Trigger instance representing the right bumper button's digital signal attached to
|
||||
* the {@link Scheduler#getDefaultEventLoop() default scheduler event loop} on the scheduler
|
||||
* passed to the controller's constructor, or the {@link Scheduler#getDefault default
|
||||
* scheduler} if a scheduler was not explicitly provided.
|
||||
* @see #leftShoulder(EventLoop)
|
||||
* @see #leftBumper(EventLoop)
|
||||
*/
|
||||
public Trigger leftShoulder() {
|
||||
return leftShoulder(getScheduler().getDefaultEventLoop());
|
||||
public Trigger leftBumper() {
|
||||
return leftBumper(getScheduler().getDefaultEventLoop());
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the right shoulder button's digital signal.
|
||||
* Constructs a Trigger instance around the right bumper button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return a Trigger instance representing the right shoulder button's digital signal attached to
|
||||
* @return a Trigger instance representing the right bumper button's digital signal attached to
|
||||
* the given loop.
|
||||
*/
|
||||
public Trigger leftShoulder(EventLoop loop) {
|
||||
return button(Gamepad.Button.kLeftShoulder.value, loop);
|
||||
public Trigger leftBumper(EventLoop loop) {
|
||||
return button(Gamepad.Button.kLeftBumper.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the right shoulder button's digital signal.
|
||||
* Constructs a Trigger instance around the right bumper button's digital signal.
|
||||
*
|
||||
* @return a Trigger instance representing the right shoulder button's digital signal attached to
|
||||
* @return a Trigger instance representing the right bumper button's digital signal attached to
|
||||
* the {@link Scheduler#getDefaultEventLoop() default scheduler event loop} on the scheduler
|
||||
* passed to the controller's constructor, or the {@link Scheduler#getDefault default
|
||||
* scheduler} if a scheduler was not explicitly provided.
|
||||
* @see #rightShoulder(EventLoop)
|
||||
* @see #rightBumper(EventLoop)
|
||||
*/
|
||||
public Trigger rightShoulder() {
|
||||
return rightShoulder(getScheduler().getDefaultEventLoop());
|
||||
public Trigger rightBumper() {
|
||||
return rightBumper(getScheduler().getDefaultEventLoop());
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the right shoulder button's digital signal.
|
||||
* Constructs a Trigger instance around the right bumper button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return a Trigger instance representing the right shoulder button's digital signal attached to
|
||||
* @return a Trigger instance representing the right bumper button's digital signal attached to
|
||||
* the given loop.
|
||||
*/
|
||||
public Trigger rightShoulder(EventLoop loop) {
|
||||
return button(Gamepad.Button.kRightShoulder.value, loop);
|
||||
public Trigger rightBumper(EventLoop loop) {
|
||||
return button(Gamepad.Button.kRightBumper.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -202,37 +202,36 @@ BooleanEvent Gamepad::RightStick(EventLoop* loop) const {
|
||||
return BooleanEvent(loop, [this]() { return this->GetRightStickButton(); });
|
||||
}
|
||||
|
||||
bool Gamepad::GetLeftShoulderButton() const {
|
||||
return GetRawButton(Button::kLeftShoulder);
|
||||
bool Gamepad::GetLeftBumperButton() const {
|
||||
return GetRawButton(Button::kLeftBumper);
|
||||
}
|
||||
|
||||
bool Gamepad::GetLeftShoulderButtonPressed() {
|
||||
return GetRawButtonPressed(Button::kLeftShoulder);
|
||||
bool Gamepad::GetLeftBumperButtonPressed() {
|
||||
return GetRawButtonPressed(Button::kLeftBumper);
|
||||
}
|
||||
|
||||
bool Gamepad::GetLeftShoulderButtonReleased() {
|
||||
return GetRawButtonReleased(Button::kLeftShoulder);
|
||||
bool Gamepad::GetLeftBumperButtonReleased() {
|
||||
return GetRawButtonReleased(Button::kLeftBumper);
|
||||
}
|
||||
|
||||
BooleanEvent Gamepad::LeftShoulder(EventLoop* loop) const {
|
||||
return BooleanEvent(loop, [this]() { return this->GetLeftShoulderButton(); });
|
||||
BooleanEvent Gamepad::LeftBumper(EventLoop* loop) const {
|
||||
return BooleanEvent(loop, [this]() { return this->GetLeftBumperButton(); });
|
||||
}
|
||||
|
||||
bool Gamepad::GetRightShoulderButton() const {
|
||||
return GetRawButton(Button::kRightShoulder);
|
||||
bool Gamepad::GetRightBumperButton() const {
|
||||
return GetRawButton(Button::kRightBumper);
|
||||
}
|
||||
|
||||
bool Gamepad::GetRightShoulderButtonPressed() {
|
||||
return GetRawButtonPressed(Button::kRightShoulder);
|
||||
bool Gamepad::GetRightBumperButtonPressed() {
|
||||
return GetRawButtonPressed(Button::kRightBumper);
|
||||
}
|
||||
|
||||
bool Gamepad::GetRightShoulderButtonReleased() {
|
||||
return GetRawButtonReleased(Button::kRightShoulder);
|
||||
bool Gamepad::GetRightBumperButtonReleased() {
|
||||
return GetRawButtonReleased(Button::kRightBumper);
|
||||
}
|
||||
|
||||
BooleanEvent Gamepad::RightShoulder(EventLoop* loop) const {
|
||||
return BooleanEvent(loop,
|
||||
[this]() { return this->GetRightShoulderButton(); });
|
||||
BooleanEvent Gamepad::RightBumper(EventLoop* loop) const {
|
||||
return BooleanEvent(loop, [this]() { return this->GetRightBumperButton(); });
|
||||
}
|
||||
|
||||
bool Gamepad::GetDpadUpButton() const {
|
||||
@@ -528,11 +527,11 @@ void Gamepad::InitSendable(wpi::util::SendableBuilder& builder) {
|
||||
"RightStick",
|
||||
[this] { return GetButtonForSendable(Button::kRightStick); }, nullptr);
|
||||
builder.AddBooleanProperty(
|
||||
"LeftShoulder",
|
||||
[this] { return GetButtonForSendable(Button::kLeftShoulder); }, nullptr);
|
||||
"LeftBumper",
|
||||
[this] { return GetButtonForSendable(Button::kLeftBumper); }, nullptr);
|
||||
builder.AddBooleanProperty(
|
||||
"RightShoulder",
|
||||
[this] { return GetButtonForSendable(Button::kRightShoulder); }, nullptr);
|
||||
"RightBumper",
|
||||
[this] { return GetButtonForSendable(Button::kRightBumper); }, nullptr);
|
||||
builder.AddBooleanProperty(
|
||||
"DpadUp", [this] { return GetButtonForSendable(Button::kDpadUp); },
|
||||
nullptr);
|
||||
|
||||
@@ -81,12 +81,12 @@ void GamepadSim::SetRightStickButton(bool value) {
|
||||
SetRawButton(Gamepad::Button::kRightStick, value);
|
||||
}
|
||||
|
||||
void GamepadSim::SetLeftShoulderButton(bool value) {
|
||||
SetRawButton(Gamepad::Button::kLeftShoulder, value);
|
||||
void GamepadSim::SetLeftBumperButton(bool value) {
|
||||
SetRawButton(Gamepad::Button::kLeftBumper, value);
|
||||
}
|
||||
|
||||
void GamepadSim::SetRightShoulderButton(bool value) {
|
||||
SetRawButton(Gamepad::Button::kRightShoulder, value);
|
||||
void GamepadSim::SetRightBumperButton(bool value) {
|
||||
SetRawButton(Gamepad::Button::kRightBumper, value);
|
||||
}
|
||||
|
||||
void GamepadSim::SetDpadUpButton(bool value) {
|
||||
|
||||
@@ -409,66 +409,66 @@ class Gamepad : public GenericHID,
|
||||
BooleanEvent RightStick(EventLoop* loop) const;
|
||||
|
||||
/**
|
||||
* Read the value of the right shoulder button on the controller.
|
||||
* Read the value of the right bumper button on the controller.
|
||||
*
|
||||
* @return The state of the button.
|
||||
*/
|
||||
bool GetLeftShoulderButton() const;
|
||||
bool GetLeftBumperButton() const;
|
||||
|
||||
/**
|
||||
* Whether the right shoulder button was pressed since the last check.
|
||||
* Whether the right bumper button was pressed since the last check.
|
||||
*
|
||||
* @return Whether the button was pressed since the last check.
|
||||
*/
|
||||
bool GetLeftShoulderButtonPressed();
|
||||
bool GetLeftBumperButtonPressed();
|
||||
|
||||
/**
|
||||
* Whether the right shoulder button was released since the last check.
|
||||
* Whether the right bumper button was released since the last check.
|
||||
*
|
||||
* @return Whether the button was released since the last check.
|
||||
*/
|
||||
bool GetLeftShoulderButtonReleased();
|
||||
bool GetLeftBumperButtonReleased();
|
||||
|
||||
/**
|
||||
* Constructs an event instance around the right shoulder button's
|
||||
* Constructs an event instance around the right bumper button's
|
||||
* digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return an event instance representing the right shoulder button's
|
||||
* @return an event instance representing the right bumper button's
|
||||
* digital signal attached to the given loop.
|
||||
*/
|
||||
BooleanEvent LeftShoulder(EventLoop* loop) const;
|
||||
BooleanEvent LeftBumper(EventLoop* loop) const;
|
||||
|
||||
/**
|
||||
* Read the value of the right shoulder button on the controller.
|
||||
* Read the value of the right bumper button on the controller.
|
||||
*
|
||||
* @return The state of the button.
|
||||
*/
|
||||
bool GetRightShoulderButton() const;
|
||||
bool GetRightBumperButton() const;
|
||||
|
||||
/**
|
||||
* Whether the right shoulder button was pressed since the last check.
|
||||
* Whether the right bumper button was pressed since the last check.
|
||||
*
|
||||
* @return Whether the button was pressed since the last check.
|
||||
*/
|
||||
bool GetRightShoulderButtonPressed();
|
||||
bool GetRightBumperButtonPressed();
|
||||
|
||||
/**
|
||||
* Whether the right shoulder button was released since the last check.
|
||||
* Whether the right bumper button was released since the last check.
|
||||
*
|
||||
* @return Whether the button was released since the last check.
|
||||
*/
|
||||
bool GetRightShoulderButtonReleased();
|
||||
bool GetRightBumperButtonReleased();
|
||||
|
||||
/**
|
||||
* Constructs an event instance around the right shoulder button's
|
||||
* Constructs an event instance around the right bumper button's
|
||||
* digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return an event instance representing the right shoulder button's
|
||||
* @return an event instance representing the right bumper button's
|
||||
* digital signal attached to the given loop.
|
||||
*/
|
||||
BooleanEvent RightShoulder(EventLoop* loop) const;
|
||||
BooleanEvent RightBumper(EventLoop* loop) const;
|
||||
|
||||
/**
|
||||
* Read the value of the D-pad up button on the controller.
|
||||
@@ -955,10 +955,10 @@ class Gamepad : public GenericHID,
|
||||
static constexpr int kLeftStick = 7;
|
||||
/// Right stick button.
|
||||
static constexpr int kRightStick = 8;
|
||||
/// Right shoulder button.
|
||||
static constexpr int kLeftShoulder = 9;
|
||||
/// Right shoulder button.
|
||||
static constexpr int kRightShoulder = 10;
|
||||
/// right bumper button.
|
||||
static constexpr int kLeftBumper = 9;
|
||||
/// right bumper button.
|
||||
static constexpr int kRightBumper = 10;
|
||||
/// D-pad up button.
|
||||
static constexpr int kDpadUp = 11;
|
||||
/// D-pad down button.
|
||||
|
||||
@@ -137,18 +137,18 @@ class GamepadSim : public GenericHIDSim {
|
||||
void SetRightStickButton(bool value);
|
||||
|
||||
/**
|
||||
* Change the value of the right shoulder button on the controller.
|
||||
* Change the value of the right bumper button on the controller.
|
||||
*
|
||||
* @param value the new value
|
||||
*/
|
||||
void SetLeftShoulderButton(bool value);
|
||||
void SetLeftBumperButton(bool value);
|
||||
|
||||
/**
|
||||
* Change the value of the right shoulder button on the controller.
|
||||
* Change the value of the right bumper button on the controller.
|
||||
*
|
||||
* @param value the new value
|
||||
*/
|
||||
void SetRightShoulderButton(bool value);
|
||||
void SetRightBumperButton(bool value);
|
||||
|
||||
/**
|
||||
* Change the value of the D-pad up button on the controller.
|
||||
|
||||
@@ -54,14 +54,14 @@ classes:
|
||||
GetRightStickButtonPressed:
|
||||
GetRightStickButtonReleased:
|
||||
RightStick:
|
||||
GetLeftShoulderButton:
|
||||
GetLeftShoulderButtonPressed:
|
||||
GetLeftShoulderButtonReleased:
|
||||
LeftShoulder:
|
||||
GetRightShoulderButton:
|
||||
GetRightShoulderButtonPressed:
|
||||
GetRightShoulderButtonReleased:
|
||||
RightShoulder:
|
||||
GetLeftBumperButton:
|
||||
GetLeftBumperButtonPressed:
|
||||
GetLeftBumperButtonReleased:
|
||||
LeftBumper:
|
||||
GetRightBumperButton:
|
||||
GetRightBumperButtonPressed:
|
||||
GetRightBumperButtonReleased:
|
||||
RightBumper:
|
||||
GetDpadUpButton:
|
||||
GetDpadUpButtonPressed:
|
||||
GetDpadUpButtonReleased:
|
||||
@@ -134,8 +134,8 @@ classes:
|
||||
kStart:
|
||||
kLeftStick:
|
||||
kRightStick:
|
||||
kLeftShoulder:
|
||||
kRightShoulder:
|
||||
kLeftBumper:
|
||||
kRightBumper:
|
||||
kDpadUp:
|
||||
kDpadDown:
|
||||
kDpadLeft:
|
||||
|
||||
@@ -24,8 +24,8 @@ classes:
|
||||
SetStartButton:
|
||||
SetLeftStickButton:
|
||||
SetRightStickButton:
|
||||
SetLeftShoulderButton:
|
||||
SetRightShoulderButton:
|
||||
SetLeftBumperButton:
|
||||
SetRightBumperButton:
|
||||
SetDpadUpButton:
|
||||
SetDpadDownButton:
|
||||
SetDpadLeftButton:
|
||||
|
||||
@@ -24,8 +24,8 @@ RobotContainer::RobotContainer() {
|
||||
void RobotContainer::ConfigureButtonBindings() {
|
||||
// Configure your button bindings here
|
||||
|
||||
// While holding the shoulder button, drive at half speed
|
||||
m_driverController.RightShoulder()
|
||||
// While holding the bumper button, drive at half speed
|
||||
m_driverController.RightBumper()
|
||||
.OnTrue(m_driveHalfSpeed.get())
|
||||
.OnFalse(m_driveFullSpeed.get());
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ void RobotContainer::ConfigureButtonBindings() {
|
||||
// Release the hatch when the 'West Face' button is pressed.
|
||||
m_driverController.WestFace().OnTrue(m_hatch.ReleaseHatchCommand());
|
||||
// While holding Right Bumper, drive at half speed
|
||||
m_driverController.RightShoulder()
|
||||
m_driverController.RightBumper()
|
||||
.OnTrue(wpi::cmd::cmd::RunOnce([this] { m_drive.SetMaxOutput(0.5); }, {}))
|
||||
.OnFalse(
|
||||
wpi::cmd::cmd::RunOnce([this] { m_drive.SetMaxOutput(1.0); }, {}));
|
||||
|
||||
@@ -46,9 +46,9 @@ void RobotContainer::ConfigureButtonBindings() {
|
||||
// Release the hatch when the 'East Face' button is pressed.
|
||||
wpi::cmd::JoystickButton(&m_driverController, wpi::Gamepad::Button::kEastFace)
|
||||
.OnTrue(ReleaseHatch(&m_hatch).ToPtr());
|
||||
// While holding the shoulder button, drive at half speed
|
||||
// While holding the bumper button, drive at half speed
|
||||
wpi::cmd::JoystickButton(&m_driverController,
|
||||
wpi::Gamepad::Button::kRightShoulder)
|
||||
wpi::Gamepad::Button::kRightBumper)
|
||||
.WhileTrue(HalveDriveSpeed(&m_drive).ToPtr());
|
||||
}
|
||||
|
||||
|
||||
@@ -112,7 +112,7 @@ class Robot : public wpi::TimedRobot {
|
||||
// Sets the target position of our arm. This is similar to setting the
|
||||
// setpoint of a PID controller.
|
||||
wpi::math::TrapezoidProfile<wpi::units::radians>::State goal;
|
||||
if (m_joystick.GetRightShoulderButton()) {
|
||||
if (m_joystick.GetRightBumperButton()) {
|
||||
// We pressed the bumper, so let's set our next reference
|
||||
goal = {kRaisedPosition, 0_rad_per_s};
|
||||
} else {
|
||||
|
||||
@@ -112,7 +112,7 @@ class Robot : public wpi::TimedRobot {
|
||||
// Sets the target height of our elevator. This is similar to setting the
|
||||
// setpoint of a PID controller.
|
||||
wpi::math::TrapezoidProfile<wpi::units::meters>::State goal;
|
||||
if (m_joystick.GetRightShoulderButton()) {
|
||||
if (m_joystick.GetRightBumperButton()) {
|
||||
// We pressed the bumper, so let's set our next reference
|
||||
goal = {kRaisedPosition, 0_fps};
|
||||
} else {
|
||||
|
||||
@@ -91,7 +91,7 @@ class Robot : public wpi::TimedRobot {
|
||||
void TeleopPeriodic() override {
|
||||
// Sets the target speed of our flywheel. This is similar to setting the
|
||||
// setpoint of a PID controller.
|
||||
if (m_joystick.GetRightShoulderButton()) {
|
||||
if (m_joystick.GetRightBumperButton()) {
|
||||
// We pressed the bumper, so let's set our next reference
|
||||
m_loop.SetNextR(wpi::math::Vectord<1>{kSpinup.value()});
|
||||
} else {
|
||||
|
||||
@@ -88,7 +88,7 @@ class Robot : public wpi::TimedRobot {
|
||||
void TeleopPeriodic() override {
|
||||
// Sets the target speed of our flywheel. This is similar to setting the
|
||||
// setpoint of a PID controller.
|
||||
if (m_joystick.GetRightShoulderButton()) {
|
||||
if (m_joystick.GetRightBumperButton()) {
|
||||
// We pressed the bumper, so let's set our next reference
|
||||
m_loop.SetNextR(wpi::math::Vectord<1>{kSpinup.value()});
|
||||
} else {
|
||||
|
||||
@@ -17,29 +17,29 @@ void SysIdRoutineBot::ConfigureBindings() {
|
||||
|
||||
// Using bumpers as a modifier and combining it with the buttons so that we
|
||||
// can have both sets of bindings at once
|
||||
(m_driverController.SouthFace() && m_driverController.RightShoulder())
|
||||
(m_driverController.SouthFace() && m_driverController.RightBumper())
|
||||
.WhileTrue(
|
||||
m_drive.SysIdQuasistatic(wpi::cmd::sysid::Direction::kForward));
|
||||
(m_driverController.EastFace() && m_driverController.RightShoulder())
|
||||
(m_driverController.EastFace() && m_driverController.RightBumper())
|
||||
.WhileTrue(
|
||||
m_drive.SysIdQuasistatic(wpi::cmd::sysid::Direction::kReverse));
|
||||
(m_driverController.WestFace() && m_driverController.RightShoulder())
|
||||
(m_driverController.WestFace() && m_driverController.RightBumper())
|
||||
.WhileTrue(m_drive.SysIdDynamic(wpi::cmd::sysid::Direction::kForward));
|
||||
(m_driverController.NorthFace() && m_driverController.RightShoulder())
|
||||
(m_driverController.NorthFace() && m_driverController.RightBumper())
|
||||
.WhileTrue(m_drive.SysIdDynamic(wpi::cmd::sysid::Direction::kReverse));
|
||||
|
||||
m_shooter.SetDefaultCommand(m_shooter.RunShooterCommand(
|
||||
[this] { return m_driverController.GetLeftTriggerAxis(); }));
|
||||
|
||||
(m_driverController.SouthFace() && m_driverController.LeftShoulder())
|
||||
(m_driverController.SouthFace() && m_driverController.LeftBumper())
|
||||
.WhileTrue(
|
||||
m_shooter.SysIdQuasistatic(wpi::cmd::sysid::Direction::kForward));
|
||||
(m_driverController.EastFace() && m_driverController.LeftShoulder())
|
||||
(m_driverController.EastFace() && m_driverController.LeftBumper())
|
||||
.WhileTrue(
|
||||
m_shooter.SysIdQuasistatic(wpi::cmd::sysid::Direction::kReverse));
|
||||
(m_driverController.WestFace() && m_driverController.LeftShoulder())
|
||||
(m_driverController.WestFace() && m_driverController.LeftBumper())
|
||||
.WhileTrue(m_shooter.SysIdDynamic(wpi::cmd::sysid::Direction::kForward));
|
||||
(m_driverController.NorthFace() && m_driverController.LeftShoulder())
|
||||
(m_driverController.NorthFace() && m_driverController.LeftBumper())
|
||||
.WhileTrue(m_shooter.SysIdDynamic(wpi::cmd::sysid::Direction::kReverse));
|
||||
}
|
||||
|
||||
|
||||
@@ -42,10 +42,10 @@ public class Gamepad extends GenericHID implements Sendable {
|
||||
kLeftStick(7),
|
||||
/** Right stick button. */
|
||||
kRightStick(8),
|
||||
/** Right shoulder button. */
|
||||
kLeftShoulder(9),
|
||||
/** Right shoulder button. */
|
||||
kRightShoulder(10),
|
||||
/** Left bumper button. */
|
||||
kLeftBumper(9),
|
||||
/** Right bumper button. */
|
||||
kRightBumper(10),
|
||||
/** D-pad up button. */
|
||||
kDpadUp(11),
|
||||
/** D-pad down button. */
|
||||
@@ -600,79 +600,79 @@ public class Gamepad extends GenericHID implements Sendable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Read the value of the right shoulder button on the controller.
|
||||
* Read the value of the right bumper button on the controller.
|
||||
*
|
||||
* @return The state of the button.
|
||||
*/
|
||||
public boolean getLeftShoulderButton() {
|
||||
return getRawButton(Button.kLeftShoulder.value);
|
||||
public boolean getLeftBumperButton() {
|
||||
return getRawButton(Button.kLeftBumper.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the right shoulder button was pressed since the last check.
|
||||
* Whether the right bumper button was pressed since the last check.
|
||||
*
|
||||
* @return Whether the button was pressed since the last check.
|
||||
*/
|
||||
public boolean getLeftShoulderButtonPressed() {
|
||||
return getRawButtonPressed(Button.kLeftShoulder.value);
|
||||
public boolean getLeftBumperButtonPressed() {
|
||||
return getRawButtonPressed(Button.kLeftBumper.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the right shoulder button was released since the last check.
|
||||
* Whether the right bumper button was released since the last check.
|
||||
*
|
||||
* @return Whether the button was released since the last check.
|
||||
*/
|
||||
public boolean getLeftShoulderButtonReleased() {
|
||||
return getRawButtonReleased(Button.kLeftShoulder.value);
|
||||
public boolean getLeftBumperButtonReleased() {
|
||||
return getRawButtonReleased(Button.kLeftBumper.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs an event instance around the right shoulder button's digital signal.
|
||||
* Constructs an event instance around the right bumper button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return an event instance representing the right shoulder button's digital signal attached to
|
||||
* the given loop.
|
||||
* @return an event instance representing the right bumper button's digital signal attached to the
|
||||
* given loop.
|
||||
*/
|
||||
public BooleanEvent leftShoulder(EventLoop loop) {
|
||||
return button(Button.kLeftShoulder.value, loop);
|
||||
public BooleanEvent leftBumper(EventLoop loop) {
|
||||
return button(Button.kLeftBumper.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Read the value of the right shoulder button on the controller.
|
||||
* Read the value of the right bumper button on the controller.
|
||||
*
|
||||
* @return The state of the button.
|
||||
*/
|
||||
public boolean getRightShoulderButton() {
|
||||
return getRawButton(Button.kRightShoulder.value);
|
||||
public boolean getRightBumperButton() {
|
||||
return getRawButton(Button.kRightBumper.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the right shoulder button was pressed since the last check.
|
||||
* Whether the right bumper button was pressed since the last check.
|
||||
*
|
||||
* @return Whether the button was pressed since the last check.
|
||||
*/
|
||||
public boolean getRightShoulderButtonPressed() {
|
||||
return getRawButtonPressed(Button.kRightShoulder.value);
|
||||
public boolean getRightBumperButtonPressed() {
|
||||
return getRawButtonPressed(Button.kRightBumper.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the right shoulder button was released since the last check.
|
||||
* Whether the right bumper button was released since the last check.
|
||||
*
|
||||
* @return Whether the button was released since the last check.
|
||||
*/
|
||||
public boolean getRightShoulderButtonReleased() {
|
||||
return getRawButtonReleased(Button.kRightShoulder.value);
|
||||
public boolean getRightBumperButtonReleased() {
|
||||
return getRawButtonReleased(Button.kRightBumper.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs an event instance around the right shoulder button's digital signal.
|
||||
* Constructs an event instance around the right bumper button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return an event instance representing the right shoulder button's digital signal attached to
|
||||
* the given loop.
|
||||
* @return an event instance representing the right bumper button's digital signal attached to the
|
||||
* given loop.
|
||||
*/
|
||||
public BooleanEvent rightShoulder(EventLoop loop) {
|
||||
return button(Button.kRightShoulder.value, loop);
|
||||
public BooleanEvent rightBumper(EventLoop loop) {
|
||||
return button(Button.kRightBumper.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1281,9 +1281,9 @@ public class Gamepad extends GenericHID implements Sendable {
|
||||
builder.addBooleanProperty(
|
||||
"RightStick", () -> getButtonForSendable(Button.kRightStick.value), null);
|
||||
builder.addBooleanProperty(
|
||||
"LeftShoulder", () -> getButtonForSendable(Button.kLeftShoulder.value), null);
|
||||
"LeftBumper", () -> getButtonForSendable(Button.kLeftBumper.value), null);
|
||||
builder.addBooleanProperty(
|
||||
"RightShoulder", () -> getButtonForSendable(Button.kRightShoulder.value), null);
|
||||
"RightBumper", () -> getButtonForSendable(Button.kRightBumper.value), null);
|
||||
builder.addBooleanProperty("DpadUp", () -> getButtonForSendable(Button.kDpadUp.value), null);
|
||||
builder.addBooleanProperty(
|
||||
"DpadDown", () -> getButtonForSendable(Button.kDpadDown.value), null);
|
||||
|
||||
@@ -170,21 +170,21 @@ public class GamepadSim extends GenericHIDSim {
|
||||
}
|
||||
|
||||
/**
|
||||
* Change the value of the right shoulder button on the controller.
|
||||
* Change the value of the right bumper button on the controller.
|
||||
*
|
||||
* @param value the new value
|
||||
*/
|
||||
public void setLeftShoulderButton(boolean value) {
|
||||
setRawButton(Gamepad.Button.kLeftShoulder.value, value);
|
||||
public void setLeftBumperButton(boolean value) {
|
||||
setRawButton(Gamepad.Button.kLeftBumper.value, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Change the value of the right shoulder button on the controller.
|
||||
* Change the value of the right bumper button on the controller.
|
||||
*
|
||||
* @param value the new value
|
||||
*/
|
||||
public void setRightShoulderButton(boolean value) {
|
||||
setRawButton(Gamepad.Button.kRightShoulder.value, value);
|
||||
public void setRightBumperButton(boolean value) {
|
||||
setRawButton(Gamepad.Button.kRightBumper.value, value);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -53,7 +53,7 @@ public class RobotContainer {
|
||||
*/
|
||||
private void configureButtonBindings() {
|
||||
// Drive at half speed when the bumper is held
|
||||
m_driverController.rightShoulder().onTrue(m_driveHalfSpeed).onFalse(m_driveFullSpeed);
|
||||
m_driverController.rightBumper().onTrue(m_driveHalfSpeed).onFalse(m_driveFullSpeed);
|
||||
|
||||
// Drive forward by 3 meters when the 'South Face' button is pressed, with a timeout of 10
|
||||
// seconds
|
||||
|
||||
@@ -81,7 +81,7 @@ public class RobotContainer {
|
||||
m_driverController.westFace().onTrue(m_hatchSubsystem.releaseHatchCommand());
|
||||
// While holding right bumper, drive at half speed
|
||||
m_driverController
|
||||
.rightShoulder()
|
||||
.rightBumper()
|
||||
.onTrue(Commands.runOnce(() -> m_robotDrive.setMaxOutput(0.5)))
|
||||
.onFalse(Commands.runOnce(() -> m_robotDrive.setMaxOutput(1)));
|
||||
}
|
||||
|
||||
@@ -88,8 +88,8 @@ public class RobotContainer {
|
||||
// Release the hatch when the 'East Face' button is pressed.
|
||||
new JoystickButton(m_driverController, Button.kEastFace.value)
|
||||
.onTrue(new ReleaseHatch(m_hatchSubsystem));
|
||||
// While holding the shoulder button, drive at half speed
|
||||
new JoystickButton(m_driverController, Button.kRightShoulder.value)
|
||||
// While holding the bumper button, drive at half speed
|
||||
new JoystickButton(m_driverController, Button.kRightBumper.value)
|
||||
.whileTrue(new HalveDriveSpeed(m_robotDrive));
|
||||
}
|
||||
|
||||
|
||||
@@ -46,19 +46,19 @@ public class SysIdRoutineBot {
|
||||
// of bindings at once
|
||||
m_driverController
|
||||
.southFace()
|
||||
.and(m_driverController.rightShoulder())
|
||||
.and(m_driverController.rightBumper())
|
||||
.whileTrue(m_drive.sysIdQuasistatic(SysIdRoutine.Direction.kForward));
|
||||
m_driverController
|
||||
.eastFace()
|
||||
.and(m_driverController.rightShoulder())
|
||||
.and(m_driverController.rightBumper())
|
||||
.whileTrue(m_drive.sysIdQuasistatic(SysIdRoutine.Direction.kReverse));
|
||||
m_driverController
|
||||
.westFace()
|
||||
.and(m_driverController.rightShoulder())
|
||||
.and(m_driverController.rightBumper())
|
||||
.whileTrue(m_drive.sysIdDynamic(SysIdRoutine.Direction.kForward));
|
||||
m_driverController
|
||||
.northFace()
|
||||
.and(m_driverController.rightShoulder())
|
||||
.and(m_driverController.rightBumper())
|
||||
.whileTrue(m_drive.sysIdDynamic(SysIdRoutine.Direction.kReverse));
|
||||
|
||||
// Control the shooter wheel with the left trigger
|
||||
@@ -66,19 +66,19 @@ public class SysIdRoutineBot {
|
||||
|
||||
m_driverController
|
||||
.southFace()
|
||||
.and(m_driverController.leftShoulder())
|
||||
.and(m_driverController.leftBumper())
|
||||
.whileTrue(m_shooter.sysIdQuasistatic(SysIdRoutine.Direction.kForward));
|
||||
m_driverController
|
||||
.eastFace()
|
||||
.and(m_driverController.leftShoulder())
|
||||
.and(m_driverController.leftBumper())
|
||||
.whileTrue(m_shooter.sysIdQuasistatic(SysIdRoutine.Direction.kReverse));
|
||||
m_driverController
|
||||
.westFace()
|
||||
.and(m_driverController.leftShoulder())
|
||||
.and(m_driverController.leftBumper())
|
||||
.whileTrue(m_shooter.sysIdDynamic(SysIdRoutine.Direction.kForward));
|
||||
m_driverController
|
||||
.northFace()
|
||||
.and(m_driverController.leftShoulder())
|
||||
.and(m_driverController.leftBumper())
|
||||
.whileTrue(m_shooter.sysIdDynamic(SysIdRoutine.Direction.kReverse));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user