mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-19 00:41:43 +00:00
[wpilib] Finish gamepad face button rename (#8921)
This commit is contained in:
@@ -79,7 +79,7 @@ public class CommandGamepad extends CommandGenericHID {
|
||||
* given loop.
|
||||
*/
|
||||
public Trigger faceDown(EventLoop loop) {
|
||||
return button(Gamepad.Button.SOUTH_FACE, loop);
|
||||
return button(Gamepad.Button.FACE_DOWN, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -101,7 +101,7 @@ public class CommandGamepad extends CommandGenericHID {
|
||||
* given loop.
|
||||
*/
|
||||
public Trigger faceRight(EventLoop loop) {
|
||||
return button(Gamepad.Button.EAST_FACE, loop);
|
||||
return button(Gamepad.Button.FACE_RIGHT, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -123,7 +123,7 @@ public class CommandGamepad extends CommandGenericHID {
|
||||
* given loop.
|
||||
*/
|
||||
public Trigger faceLeft(EventLoop loop) {
|
||||
return button(Gamepad.Button.WEST_FACE, loop);
|
||||
return button(Gamepad.Button.FACE_LEFT, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -145,7 +145,7 @@ public class CommandGamepad extends CommandGenericHID {
|
||||
* given loop.
|
||||
*/
|
||||
public Trigger faceUp(EventLoop loop) {
|
||||
return button(Gamepad.Button.NORTH_FACE, loop);
|
||||
return button(Gamepad.Button.FACE_UP, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -21,19 +21,19 @@ Trigger CommandGamepad::Button(enum wpi::Gamepad::Button button,
|
||||
}
|
||||
|
||||
Trigger CommandGamepad::FaceDown(wpi::EventLoop* loop) const {
|
||||
return Button(wpi::Gamepad::Button::SOUTH_FACE, loop);
|
||||
return Button(wpi::Gamepad::Button::FACE_DOWN, loop);
|
||||
}
|
||||
|
||||
Trigger CommandGamepad::FaceRight(wpi::EventLoop* loop) const {
|
||||
return Button(wpi::Gamepad::Button::EAST_FACE, loop);
|
||||
return Button(wpi::Gamepad::Button::FACE_RIGHT, loop);
|
||||
}
|
||||
|
||||
Trigger CommandGamepad::FaceLeft(wpi::EventLoop* loop) const {
|
||||
return Button(wpi::Gamepad::Button::WEST_FACE, loop);
|
||||
return Button(wpi::Gamepad::Button::FACE_LEFT, loop);
|
||||
}
|
||||
|
||||
Trigger CommandGamepad::FaceUp(wpi::EventLoop* loop) const {
|
||||
return Button(wpi::Gamepad::Button::NORTH_FACE, loop);
|
||||
return Button(wpi::Gamepad::Button::FACE_UP, loop);
|
||||
}
|
||||
|
||||
Trigger CommandGamepad::Back(wpi::EventLoop* loop) const {
|
||||
|
||||
@@ -70,7 +70,7 @@ public class CommandGamepad extends CommandGenericHID {
|
||||
* given loop.
|
||||
*/
|
||||
public Trigger faceDown(EventLoop loop) {
|
||||
return button(Gamepad.Button.SOUTH_FACE.value, loop);
|
||||
return button(Gamepad.Button.FACE_DOWN.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -94,7 +94,7 @@ public class CommandGamepad extends CommandGenericHID {
|
||||
* given loop.
|
||||
*/
|
||||
public Trigger faceRight(EventLoop loop) {
|
||||
return button(Gamepad.Button.EAST_FACE.value, loop);
|
||||
return button(Gamepad.Button.FACE_RIGHT.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -118,7 +118,7 @@ public class CommandGamepad extends CommandGenericHID {
|
||||
* given loop.
|
||||
*/
|
||||
public Trigger faceLeft(EventLoop loop) {
|
||||
return button(Gamepad.Button.WEST_FACE.value, loop);
|
||||
return button(Gamepad.Button.FACE_LEFT.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -142,7 +142,7 @@ public class CommandGamepad extends CommandGenericHID {
|
||||
* given loop.
|
||||
*/
|
||||
public Trigger faceUp(EventLoop loop) {
|
||||
return button(Gamepad.Button.NORTH_FACE.value, loop);
|
||||
return button(Gamepad.Button.FACE_UP.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -58,68 +58,68 @@ BooleanEvent Gamepad::RightTrigger(EventLoop* loop) const {
|
||||
return this->RightTrigger(0.5, loop);
|
||||
}
|
||||
|
||||
bool Gamepad::GetSouthFaceButton() const {
|
||||
return GetButton(Button::SOUTH_FACE);
|
||||
bool Gamepad::GetFaceDownButton() const {
|
||||
return GetButton(Button::FACE_DOWN);
|
||||
}
|
||||
|
||||
bool Gamepad::GetSouthFaceButtonPressed() {
|
||||
return GetButtonPressed(Button::SOUTH_FACE);
|
||||
bool Gamepad::GetFaceDownButtonPressed() {
|
||||
return GetButtonPressed(Button::FACE_DOWN);
|
||||
}
|
||||
|
||||
bool Gamepad::GetSouthFaceButtonReleased() {
|
||||
return GetButtonReleased(Button::SOUTH_FACE);
|
||||
bool Gamepad::GetFaceDownButtonReleased() {
|
||||
return GetButtonReleased(Button::FACE_DOWN);
|
||||
}
|
||||
|
||||
BooleanEvent Gamepad::FaceDown(EventLoop* loop) const {
|
||||
return BooleanEvent(loop, [this]() { return this->GetSouthFaceButton(); });
|
||||
return BooleanEvent(loop, [this]() { return this->GetFaceDownButton(); });
|
||||
}
|
||||
|
||||
bool Gamepad::GetEastFaceButton() const {
|
||||
return GetButton(Button::EAST_FACE);
|
||||
bool Gamepad::GetFaceRightButton() const {
|
||||
return GetButton(Button::FACE_RIGHT);
|
||||
}
|
||||
|
||||
bool Gamepad::GetEastFaceButtonPressed() {
|
||||
return GetButtonPressed(Button::EAST_FACE);
|
||||
bool Gamepad::GetFaceRightButtonPressed() {
|
||||
return GetButtonPressed(Button::FACE_RIGHT);
|
||||
}
|
||||
|
||||
bool Gamepad::GetEastFaceButtonReleased() {
|
||||
return GetButtonReleased(Button::EAST_FACE);
|
||||
bool Gamepad::GetFaceRightButtonReleased() {
|
||||
return GetButtonReleased(Button::FACE_RIGHT);
|
||||
}
|
||||
|
||||
BooleanEvent Gamepad::FaceRight(EventLoop* loop) const {
|
||||
return BooleanEvent(loop, [this]() { return this->GetEastFaceButton(); });
|
||||
return BooleanEvent(loop, [this]() { return this->GetFaceRightButton(); });
|
||||
}
|
||||
|
||||
bool Gamepad::GetWestFaceButton() const {
|
||||
return GetButton(Button::WEST_FACE);
|
||||
bool Gamepad::GetFaceLeftButton() const {
|
||||
return GetButton(Button::FACE_LEFT);
|
||||
}
|
||||
|
||||
bool Gamepad::GetWestFaceButtonPressed() {
|
||||
return GetButtonPressed(Button::WEST_FACE);
|
||||
bool Gamepad::GetFaceLeftButtonPressed() {
|
||||
return GetButtonPressed(Button::FACE_LEFT);
|
||||
}
|
||||
|
||||
bool Gamepad::GetWestFaceButtonReleased() {
|
||||
return GetButtonReleased(Button::WEST_FACE);
|
||||
bool Gamepad::GetFaceLeftButtonReleased() {
|
||||
return GetButtonReleased(Button::FACE_LEFT);
|
||||
}
|
||||
|
||||
BooleanEvent Gamepad::FaceLeft(EventLoop* loop) const {
|
||||
return BooleanEvent(loop, [this]() { return this->GetWestFaceButton(); });
|
||||
return BooleanEvent(loop, [this]() { return this->GetFaceLeftButton(); });
|
||||
}
|
||||
|
||||
bool Gamepad::GetNorthFaceButton() const {
|
||||
return GetButton(Button::NORTH_FACE);
|
||||
bool Gamepad::GetFaceUpButton() const {
|
||||
return GetButton(Button::FACE_UP);
|
||||
}
|
||||
|
||||
bool Gamepad::GetNorthFaceButtonPressed() {
|
||||
return GetButtonPressed(Button::NORTH_FACE);
|
||||
bool Gamepad::GetFaceUpButtonPressed() {
|
||||
return GetButtonPressed(Button::FACE_UP);
|
||||
}
|
||||
|
||||
bool Gamepad::GetNorthFaceButtonReleased() {
|
||||
return GetButtonReleased(Button::NORTH_FACE);
|
||||
bool Gamepad::GetFaceUpButtonReleased() {
|
||||
return GetButtonReleased(Button::FACE_UP);
|
||||
}
|
||||
|
||||
BooleanEvent Gamepad::FaceUp(EventLoop* loop) const {
|
||||
return BooleanEvent(loop, [this]() { return this->GetNorthFaceButton(); });
|
||||
return BooleanEvent(loop, [this]() { return this->GetFaceUpButton(); });
|
||||
}
|
||||
|
||||
bool Gamepad::GetBackButton() const {
|
||||
@@ -534,16 +534,16 @@ void Gamepad::InitSendable(wpi::util::SendableBuilder& builder) {
|
||||
builder.AddDoubleProperty(
|
||||
"RightY", [this] { return GetAxisForSendable(Axis::RIGHT_Y); }, nullptr);
|
||||
builder.AddBooleanProperty(
|
||||
"SouthFace", [this] { return GetButtonForSendable(Button::SOUTH_FACE); },
|
||||
"FaceDown", [this] { return GetButtonForSendable(Button::FACE_DOWN); },
|
||||
nullptr);
|
||||
builder.AddBooleanProperty(
|
||||
"EastFace", [this] { return GetButtonForSendable(Button::EAST_FACE); },
|
||||
"FaceRight", [this] { return GetButtonForSendable(Button::FACE_RIGHT); },
|
||||
nullptr);
|
||||
builder.AddBooleanProperty(
|
||||
"WestFace", [this] { return GetButtonForSendable(Button::WEST_FACE); },
|
||||
"FaceLeft", [this] { return GetButtonForSendable(Button::FACE_LEFT); },
|
||||
nullptr);
|
||||
builder.AddBooleanProperty(
|
||||
"NorthFace", [this] { return GetButtonForSendable(Button::NORTH_FACE); },
|
||||
"FaceUp", [this] { return GetButtonForSendable(Button::FACE_UP); },
|
||||
nullptr);
|
||||
builder.AddBooleanProperty(
|
||||
"Back", [this] { return GetButtonForSendable(Button::BACK); }, nullptr);
|
||||
|
||||
@@ -53,20 +53,20 @@ void GamepadSim::SetRightTriggerAxis(double value) {
|
||||
SetAxis(Gamepad::Axis::RIGHT_TRIGGER, value);
|
||||
}
|
||||
|
||||
void GamepadSim::SetSouthFaceButton(bool value) {
|
||||
SetButton(Gamepad::Button::SOUTH_FACE, value);
|
||||
void GamepadSim::SetFaceDownButton(bool value) {
|
||||
SetButton(Gamepad::Button::FACE_DOWN, value);
|
||||
}
|
||||
|
||||
void GamepadSim::SetEastFaceButton(bool value) {
|
||||
SetButton(Gamepad::Button::EAST_FACE, value);
|
||||
void GamepadSim::SetFaceRightButton(bool value) {
|
||||
SetButton(Gamepad::Button::FACE_RIGHT, value);
|
||||
}
|
||||
|
||||
void GamepadSim::SetWestFaceButton(bool value) {
|
||||
SetButton(Gamepad::Button::WEST_FACE, value);
|
||||
void GamepadSim::SetFaceLeftButton(bool value) {
|
||||
SetButton(Gamepad::Button::FACE_LEFT, value);
|
||||
}
|
||||
|
||||
void GamepadSim::SetNorthFaceButton(bool value) {
|
||||
SetButton(Gamepad::Button::NORTH_FACE, value);
|
||||
void GamepadSim::SetFaceUpButton(bool value) {
|
||||
SetButton(Gamepad::Button::FACE_UP, value);
|
||||
}
|
||||
|
||||
void GamepadSim::SetBackButton(bool value) {
|
||||
|
||||
@@ -28,14 +28,14 @@ class Gamepad : public GenericHID,
|
||||
public:
|
||||
/** Represents a digital button on an Gamepad. */
|
||||
enum class Button {
|
||||
/// South Face button.
|
||||
SOUTH_FACE = 0,
|
||||
/// East Face button.
|
||||
EAST_FACE = 1,
|
||||
/// West Face button.
|
||||
WEST_FACE = 2,
|
||||
/// North Face button.
|
||||
NORTH_FACE = 3,
|
||||
/// Face Down button.
|
||||
FACE_DOWN = 0,
|
||||
/// Face Right button.
|
||||
FACE_RIGHT = 1,
|
||||
/// Face Left button.
|
||||
FACE_LEFT = 2,
|
||||
/// Face Up button.
|
||||
FACE_UP = 3,
|
||||
/// Back button.
|
||||
BACK = 4,
|
||||
/// Guide button.
|
||||
@@ -202,25 +202,25 @@ class Gamepad : public GenericHID,
|
||||
BooleanEvent RightTrigger(EventLoop* loop) const;
|
||||
|
||||
/**
|
||||
* Read the value of the South Face button on the controller.
|
||||
* Read the value of the Face Down button on the controller.
|
||||
*
|
||||
* @return The state of the button.
|
||||
*/
|
||||
bool GetSouthFaceButton() const;
|
||||
bool GetFaceDownButton() const;
|
||||
|
||||
/**
|
||||
* Whether the South Face button was pressed since the last check.
|
||||
* Whether the Face Down button was pressed since the last check.
|
||||
*
|
||||
* @return Whether the button was pressed since the last check.
|
||||
*/
|
||||
bool GetSouthFaceButtonPressed();
|
||||
bool GetFaceDownButtonPressed();
|
||||
|
||||
/**
|
||||
* Whether the South Face button was released since the last check.
|
||||
* Whether the Face Down button was released since the last check.
|
||||
*
|
||||
* @return Whether the button was released since the last check.
|
||||
*/
|
||||
bool GetSouthFaceButtonReleased();
|
||||
bool GetFaceDownButtonReleased();
|
||||
|
||||
/**
|
||||
* Constructs an event instance around the Face Down button's
|
||||
@@ -233,25 +233,25 @@ class Gamepad : public GenericHID,
|
||||
BooleanEvent FaceDown(EventLoop* loop) const;
|
||||
|
||||
/**
|
||||
* Read the value of the East Face button on the controller.
|
||||
* Read the value of the Face Right button on the controller.
|
||||
*
|
||||
* @return The state of the button.
|
||||
*/
|
||||
bool GetEastFaceButton() const;
|
||||
bool GetFaceRightButton() const;
|
||||
|
||||
/**
|
||||
* Whether the East Face button was pressed since the last check.
|
||||
* Whether the Face Right button was pressed since the last check.
|
||||
*
|
||||
* @return Whether the button was pressed since the last check.
|
||||
*/
|
||||
bool GetEastFaceButtonPressed();
|
||||
bool GetFaceRightButtonPressed();
|
||||
|
||||
/**
|
||||
* Whether the East Face button was released since the last check.
|
||||
* Whether the Face Right button was released since the last check.
|
||||
*
|
||||
* @return Whether the button was released since the last check.
|
||||
*/
|
||||
bool GetEastFaceButtonReleased();
|
||||
bool GetFaceRightButtonReleased();
|
||||
|
||||
/**
|
||||
* Constructs an event instance around the Face Right button's
|
||||
@@ -264,25 +264,25 @@ class Gamepad : public GenericHID,
|
||||
BooleanEvent FaceRight(EventLoop* loop) const;
|
||||
|
||||
/**
|
||||
* Read the value of the West Face button on the controller.
|
||||
* Read the value of the Face Left button on the controller.
|
||||
*
|
||||
* @return The state of the button.
|
||||
*/
|
||||
bool GetWestFaceButton() const;
|
||||
bool GetFaceLeftButton() const;
|
||||
|
||||
/**
|
||||
* Whether the West Face button was pressed since the last check.
|
||||
* Whether the Face Left button was pressed since the last check.
|
||||
*
|
||||
* @return Whether the button was pressed since the last check.
|
||||
*/
|
||||
bool GetWestFaceButtonPressed();
|
||||
bool GetFaceLeftButtonPressed();
|
||||
|
||||
/**
|
||||
* Whether the West Face button was released since the last check.
|
||||
* Whether the Face Left button was released since the last check.
|
||||
*
|
||||
* @return Whether the button was released since the last check.
|
||||
*/
|
||||
bool GetWestFaceButtonReleased();
|
||||
bool GetFaceLeftButtonReleased();
|
||||
|
||||
/**
|
||||
* Constructs an event instance around the Face Left button's
|
||||
@@ -295,25 +295,25 @@ class Gamepad : public GenericHID,
|
||||
BooleanEvent FaceLeft(EventLoop* loop) const;
|
||||
|
||||
/**
|
||||
* Read the value of the North Face button on the controller.
|
||||
* Read the value of the Face Up button on the controller.
|
||||
*
|
||||
* @return The state of the button.
|
||||
*/
|
||||
bool GetNorthFaceButton() const;
|
||||
bool GetFaceUpButton() const;
|
||||
|
||||
/**
|
||||
* Whether the North Face button was pressed since the last check.
|
||||
* Whether the Face Up button was pressed since the last check.
|
||||
*
|
||||
* @return Whether the button was pressed since the last check.
|
||||
*/
|
||||
bool GetNorthFaceButtonPressed();
|
||||
bool GetFaceUpButtonPressed();
|
||||
|
||||
/**
|
||||
* Whether the North Face button was released since the last check.
|
||||
* Whether the Face Up button was released since the last check.
|
||||
*
|
||||
* @return Whether the button was released since the last check.
|
||||
*/
|
||||
bool GetNorthFaceButtonReleased();
|
||||
bool GetFaceUpButtonReleased();
|
||||
|
||||
/**
|
||||
* Constructs an event instance around the Face Up button's
|
||||
|
||||
@@ -87,32 +87,32 @@ class GamepadSim : public GenericHIDSim {
|
||||
void SetRightTriggerAxis(double value);
|
||||
|
||||
/**
|
||||
* Change the value of the South Face button on the controller.
|
||||
* Change the value of the Face Down button on the controller.
|
||||
*
|
||||
* @param value the new value
|
||||
*/
|
||||
void SetSouthFaceButton(bool value);
|
||||
void SetFaceDownButton(bool value);
|
||||
|
||||
/**
|
||||
* Change the value of the East Face button on the controller.
|
||||
* Change the value of the Face Right button on the controller.
|
||||
*
|
||||
* @param value the new value
|
||||
*/
|
||||
void SetEastFaceButton(bool value);
|
||||
void SetFaceRightButton(bool value);
|
||||
|
||||
/**
|
||||
* Change the value of the West Face button on the controller.
|
||||
* Change the value of the Face Left button on the controller.
|
||||
*
|
||||
* @param value the new value
|
||||
*/
|
||||
void SetWestFaceButton(bool value);
|
||||
void SetFaceLeftButton(bool value);
|
||||
|
||||
/**
|
||||
* Change the value of the North Face button on the controller.
|
||||
* Change the value of the Face Up button on the controller.
|
||||
*
|
||||
* @param value the new value
|
||||
*/
|
||||
void SetNorthFaceButton(bool value);
|
||||
void SetFaceUpButton(bool value);
|
||||
|
||||
/**
|
||||
* Change the value of the Back button on the controller.
|
||||
|
||||
@@ -21,21 +21,21 @@ classes:
|
||||
overloads:
|
||||
double, EventLoop* [const]:
|
||||
EventLoop* [const]:
|
||||
GetSouthFaceButton:
|
||||
GetSouthFaceButtonPressed:
|
||||
GetSouthFaceButtonReleased:
|
||||
GetFaceDownButton:
|
||||
GetFaceDownButtonPressed:
|
||||
GetFaceDownButtonReleased:
|
||||
FaceDown:
|
||||
GetEastFaceButton:
|
||||
GetEastFaceButtonPressed:
|
||||
GetEastFaceButtonReleased:
|
||||
GetFaceRightButton:
|
||||
GetFaceRightButtonPressed:
|
||||
GetFaceRightButtonReleased:
|
||||
FaceRight:
|
||||
GetWestFaceButton:
|
||||
GetWestFaceButtonPressed:
|
||||
GetWestFaceButtonReleased:
|
||||
GetFaceLeftButton:
|
||||
GetFaceLeftButtonPressed:
|
||||
GetFaceLeftButtonReleased:
|
||||
FaceLeft:
|
||||
GetNorthFaceButton:
|
||||
GetNorthFaceButtonPressed:
|
||||
GetNorthFaceButtonReleased:
|
||||
GetFaceUpButton:
|
||||
GetFaceUpButtonPressed:
|
||||
GetFaceUpButtonReleased:
|
||||
FaceUp:
|
||||
GetBackButton:
|
||||
GetBackButtonPressed:
|
||||
|
||||
@@ -17,10 +17,10 @@ classes:
|
||||
SetRightY:
|
||||
SetLeftTriggerAxis:
|
||||
SetRightTriggerAxis:
|
||||
SetSouthFaceButton:
|
||||
SetEastFaceButton:
|
||||
SetWestFaceButton:
|
||||
SetNorthFaceButton:
|
||||
SetFaceDownButton:
|
||||
SetFaceRightButton:
|
||||
SetFaceLeftButton:
|
||||
SetFaceUpButton:
|
||||
SetBackButton:
|
||||
SetGuideButton:
|
||||
SetStartButton:
|
||||
|
||||
@@ -39,11 +39,11 @@ void RobotContainer::ConfigureButtonBindings() {
|
||||
// NOTE: since we're binding a CommandPtr, command ownership here is moved to
|
||||
// the scheduler thus, no memory leaks!
|
||||
|
||||
// Grab the hatch when the 'South Face' button is pressed.
|
||||
wpi::cmd::GamepadButton(&driverController, wpi::Gamepad::Button::SOUTH_FACE)
|
||||
// Grab the hatch when the 'Face Down' button is pressed.
|
||||
wpi::cmd::GamepadButton(&driverController, wpi::Gamepad::Button::FACE_DOWN)
|
||||
.OnTrue(GrabHatch(&hatch).ToPtr());
|
||||
// Release the hatch when the 'East Face' button is pressed.
|
||||
wpi::cmd::GamepadButton(&driverController, wpi::Gamepad::Button::EAST_FACE)
|
||||
// Release the hatch when the 'Face Right' button is pressed.
|
||||
wpi::cmd::GamepadButton(&driverController, wpi::Gamepad::Button::FACE_RIGHT)
|
||||
.OnTrue(ReleaseHatch(&hatch).ToPtr());
|
||||
// While holding the bumper button, drive at half velocity
|
||||
wpi::cmd::GamepadButton(&driverController, wpi::Gamepad::Button::RIGHT_BUMPER)
|
||||
|
||||
@@ -25,14 +25,14 @@ import org.wpilib.util.sendable.SendableBuilder;
|
||||
public class Gamepad extends GenericHID implements Sendable {
|
||||
/** Represents a digital button on a Gamepad. */
|
||||
public enum Button {
|
||||
/** South Face button. */
|
||||
SOUTH_FACE(0, "SouthFaceButton"),
|
||||
/** East Face button. */
|
||||
EAST_FACE(1, "EastFaceButton"),
|
||||
/** West Face button. */
|
||||
WEST_FACE(2, "WestFaceButton"),
|
||||
/** North Face button. */
|
||||
NORTH_FACE(3, "NorthFaceButton"),
|
||||
/** Face Down button. */
|
||||
FACE_DOWN(0, "FaceDownButton"),
|
||||
/** Face Right button. */
|
||||
FACE_RIGHT(1, "FaceRightButton"),
|
||||
/** Face Left button. */
|
||||
FACE_LEFT(2, "FaceLeftButton"),
|
||||
/** Face Up button. */
|
||||
FACE_UP(3, "FaceUpButton"),
|
||||
/** Back button. */
|
||||
BACK(4, "BackButton"),
|
||||
/** Guide button. */
|
||||
@@ -258,30 +258,30 @@ public class Gamepad extends GenericHID implements Sendable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Read the value of the South Face button on the controller.
|
||||
* Read the value of the Face Down button on the controller.
|
||||
*
|
||||
* @return The state of the button.
|
||||
*/
|
||||
public boolean getSouthFaceButton() {
|
||||
return getButton(Button.SOUTH_FACE);
|
||||
public boolean getFaceDownButton() {
|
||||
return getButton(Button.FACE_DOWN);
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the South Face button was pressed since the last check.
|
||||
* Whether the Face Down button was pressed since the last check.
|
||||
*
|
||||
* @return Whether the button was pressed since the last check.
|
||||
*/
|
||||
public boolean getSouthFaceButtonPressed() {
|
||||
return getButtonPressed(Button.SOUTH_FACE);
|
||||
public boolean getFaceDownButtonPressed() {
|
||||
return getButtonPressed(Button.FACE_DOWN);
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the South Face button was released since the last check.
|
||||
* Whether the Face Down button was released since the last check.
|
||||
*
|
||||
* @return Whether the button was released since the last check.
|
||||
*/
|
||||
public boolean getSouthFaceButtonReleased() {
|
||||
return getButtonReleased(Button.SOUTH_FACE);
|
||||
public boolean getFaceDownButtonReleased() {
|
||||
return getButtonReleased(Button.FACE_DOWN);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -292,34 +292,34 @@ public class Gamepad extends GenericHID implements Sendable {
|
||||
* given loop.
|
||||
*/
|
||||
public BooleanEvent faceDown(EventLoop loop) {
|
||||
return button(Button.SOUTH_FACE, loop);
|
||||
return button(Button.FACE_DOWN, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Read the value of the East Face button on the controller.
|
||||
* Read the value of the Face Right button on the controller.
|
||||
*
|
||||
* @return The state of the button.
|
||||
*/
|
||||
public boolean getEastFaceButton() {
|
||||
return getButton(Button.EAST_FACE);
|
||||
public boolean getFaceRightButton() {
|
||||
return getButton(Button.FACE_RIGHT);
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the East Face button was pressed since the last check.
|
||||
* Whether the Face Right button was pressed since the last check.
|
||||
*
|
||||
* @return Whether the button was pressed since the last check.
|
||||
*/
|
||||
public boolean getEastFaceButtonPressed() {
|
||||
return getButtonPressed(Button.EAST_FACE);
|
||||
public boolean getFaceRightButtonPressed() {
|
||||
return getButtonPressed(Button.FACE_RIGHT);
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the East Face button was released since the last check.
|
||||
* Whether the Face Right button was released since the last check.
|
||||
*
|
||||
* @return Whether the button was released since the last check.
|
||||
*/
|
||||
public boolean getEastFaceButtonReleased() {
|
||||
return getButtonReleased(Button.EAST_FACE);
|
||||
public boolean getFaceRightButtonReleased() {
|
||||
return getButtonReleased(Button.FACE_RIGHT);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -330,34 +330,34 @@ public class Gamepad extends GenericHID implements Sendable {
|
||||
* given loop.
|
||||
*/
|
||||
public BooleanEvent faceRight(EventLoop loop) {
|
||||
return button(Button.EAST_FACE, loop);
|
||||
return button(Button.FACE_RIGHT, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Read the value of the West Face button on the controller.
|
||||
* Read the value of the Face Left button on the controller.
|
||||
*
|
||||
* @return The state of the button.
|
||||
*/
|
||||
public boolean getWestFaceButton() {
|
||||
return getButton(Button.WEST_FACE);
|
||||
public boolean getFaceLeftButton() {
|
||||
return getButton(Button.FACE_LEFT);
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the West Face button was pressed since the last check.
|
||||
* Whether the Face Left button was pressed since the last check.
|
||||
*
|
||||
* @return Whether the button was pressed since the last check.
|
||||
*/
|
||||
public boolean getWestFaceButtonPressed() {
|
||||
return getButtonPressed(Button.WEST_FACE);
|
||||
public boolean getFaceLeftButtonPressed() {
|
||||
return getButtonPressed(Button.FACE_LEFT);
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the West Face button was released since the last check.
|
||||
* Whether the Face Left button was released since the last check.
|
||||
*
|
||||
* @return Whether the button was released since the last check.
|
||||
*/
|
||||
public boolean getWestFaceButtonReleased() {
|
||||
return getButtonReleased(Button.WEST_FACE);
|
||||
public boolean getFaceLeftButtonReleased() {
|
||||
return getButtonReleased(Button.FACE_LEFT);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -368,34 +368,34 @@ public class Gamepad extends GenericHID implements Sendable {
|
||||
* given loop.
|
||||
*/
|
||||
public BooleanEvent faceLeft(EventLoop loop) {
|
||||
return button(Button.WEST_FACE, loop);
|
||||
return button(Button.FACE_LEFT, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Read the value of the North Face button on the controller.
|
||||
* Read the value of the Face Up button on the controller.
|
||||
*
|
||||
* @return The state of the button.
|
||||
*/
|
||||
public boolean getNorthFaceButton() {
|
||||
return getButton(Button.NORTH_FACE);
|
||||
public boolean getFaceUpButton() {
|
||||
return getButton(Button.FACE_UP);
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the North Face button was pressed since the last check.
|
||||
* Whether the Face Up button was pressed since the last check.
|
||||
*
|
||||
* @return Whether the button was pressed since the last check.
|
||||
*/
|
||||
public boolean getNorthFaceButtonPressed() {
|
||||
return getButtonPressed(Button.NORTH_FACE);
|
||||
public boolean getFaceUpButtonPressed() {
|
||||
return getButtonPressed(Button.FACE_UP);
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the North Face button was released since the last check.
|
||||
* Whether the Face Up button was released since the last check.
|
||||
*
|
||||
* @return Whether the button was released since the last check.
|
||||
*/
|
||||
public boolean getNorthFaceButtonReleased() {
|
||||
return getButtonReleased(Button.NORTH_FACE);
|
||||
public boolean getFaceUpButtonReleased() {
|
||||
return getButtonReleased(Button.FACE_UP);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -406,7 +406,7 @@ public class Gamepad extends GenericHID implements Sendable {
|
||||
* given loop.
|
||||
*/
|
||||
public BooleanEvent faceUp(EventLoop loop) {
|
||||
return button(Button.NORTH_FACE, loop);
|
||||
return button(Button.FACE_UP, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1354,10 +1354,10 @@ public class Gamepad extends GenericHID implements Sendable {
|
||||
builder.addDoubleProperty("LeftY", () -> getAxisForSendable(Axis.LEFT_Y), null);
|
||||
builder.addDoubleProperty("RightX", () -> getAxisForSendable(Axis.RIGHT_X), null);
|
||||
builder.addDoubleProperty("RightY", () -> getAxisForSendable(Axis.RIGHT_Y), null);
|
||||
builder.addBooleanProperty("SouthFace", () -> getButtonForSendable(Button.SOUTH_FACE), null);
|
||||
builder.addBooleanProperty("EastFace", () -> getButtonForSendable(Button.EAST_FACE), null);
|
||||
builder.addBooleanProperty("WestFace", () -> getButtonForSendable(Button.WEST_FACE), null);
|
||||
builder.addBooleanProperty("NorthFace", () -> getButtonForSendable(Button.NORTH_FACE), null);
|
||||
builder.addBooleanProperty("FaceDown", () -> getButtonForSendable(Button.FACE_DOWN), null);
|
||||
builder.addBooleanProperty("FaceRight", () -> getButtonForSendable(Button.FACE_RIGHT), null);
|
||||
builder.addBooleanProperty("FaceLeft", () -> getButtonForSendable(Button.FACE_LEFT), null);
|
||||
builder.addBooleanProperty("FaceUp", () -> getButtonForSendable(Button.FACE_UP), null);
|
||||
builder.addBooleanProperty("Back", () -> getButtonForSendable(Button.BACK), null);
|
||||
builder.addBooleanProperty("Guide", () -> getButtonForSendable(Button.GUIDE), null);
|
||||
builder.addBooleanProperty("Start", () -> getButtonForSendable(Button.START), null);
|
||||
|
||||
@@ -109,39 +109,39 @@ public class GamepadSim extends GenericHIDSim {
|
||||
}
|
||||
|
||||
/**
|
||||
* Change the value of the South Face button on the controller.
|
||||
* Change the value of the Face Down button on the controller.
|
||||
*
|
||||
* @param value the new value
|
||||
*/
|
||||
public void setSouthFaceButton(boolean value) {
|
||||
setButton(Gamepad.Button.SOUTH_FACE, value);
|
||||
public void setFaceDownButton(boolean value) {
|
||||
setButton(Gamepad.Button.FACE_DOWN, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Change the value of the East Face button on the controller.
|
||||
* Change the value of the Face Right button on the controller.
|
||||
*
|
||||
* @param value the new value
|
||||
*/
|
||||
public void setEastFaceButton(boolean value) {
|
||||
setButton(Gamepad.Button.EAST_FACE, value);
|
||||
public void setFaceRightButton(boolean value) {
|
||||
setButton(Gamepad.Button.FACE_RIGHT, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Change the value of the West Face button on the controller.
|
||||
* Change the value of the Face Left button on the controller.
|
||||
*
|
||||
* @param value the new value
|
||||
*/
|
||||
public void setWestFaceButton(boolean value) {
|
||||
setButton(Gamepad.Button.WEST_FACE, value);
|
||||
public void setFaceLeftButton(boolean value) {
|
||||
setButton(Gamepad.Button.FACE_LEFT, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Change the value of the North Face button on the controller.
|
||||
* Change the value of the Face Up button on the controller.
|
||||
*
|
||||
* @param value the new value
|
||||
*/
|
||||
public void setNorthFaceButton(boolean value) {
|
||||
setButton(Gamepad.Button.NORTH_FACE, value);
|
||||
public void setFaceUpButton(boolean value) {
|
||||
setButton(Gamepad.Button.FACE_UP, value);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -80,10 +80,10 @@ public class RobotContainer {
|
||||
* org.wpilib.command2.button.JoystickButton}.
|
||||
*/
|
||||
private void configureButtonBindings() {
|
||||
// Grab the hatch when the 'South Face' button is pressed.
|
||||
new GamepadButton(driverController, Button.SOUTH_FACE).onTrue(new GrabHatch(hatchSubsystem));
|
||||
// Release the hatch when the 'East Face' button is pressed.
|
||||
new GamepadButton(driverController, Button.EAST_FACE).onTrue(new ReleaseHatch(hatchSubsystem));
|
||||
// Grab the hatch when the 'Face Down' button is pressed.
|
||||
new GamepadButton(driverController, Button.FACE_DOWN).onTrue(new GrabHatch(hatchSubsystem));
|
||||
// Release the hatch when the 'Face Right' button is pressed.
|
||||
new GamepadButton(driverController, Button.FACE_RIGHT).onTrue(new ReleaseHatch(hatchSubsystem));
|
||||
// While holding the bumper button, drive at half velocity
|
||||
new GamepadButton(driverController, Button.RIGHT_BUMPER)
|
||||
.whileTrue(new HalveDriveVelocity(robotDrive));
|
||||
|
||||
Reference in New Issue
Block a user