![]() |
WPILibC++ 2027.0.0-alpha-4
|
A version of wpi::Gamepad with Trigger factories for command-based.
More...
#include <wpi/commands2/button/CommandGamepad.hpp>
Public Member Functions | |
| CommandGamepad (int port) | |
| Construct an instance of a controller. | |
| wpi::Gamepad & | GetHID () |
| Get the underlying GenericHID object. | |
| Trigger | SouthFace (wpi::EventLoop *loop=CommandScheduler::GetInstance() .GetDefaultButtonLoop()) const |
| Constructs a Trigger instance around the South Face button's digital signal. | |
| Trigger | EastFace (wpi::EventLoop *loop=CommandScheduler::GetInstance() .GetDefaultButtonLoop()) const |
| Constructs a Trigger instance around the East Face button's digital signal. | |
| Trigger | WestFace (wpi::EventLoop *loop=CommandScheduler::GetInstance() .GetDefaultButtonLoop()) const |
| Constructs a Trigger instance around the West Face button's digital signal. | |
| Trigger | NorthFace (wpi::EventLoop *loop=CommandScheduler::GetInstance() .GetDefaultButtonLoop()) const |
| Constructs a Trigger instance around the North Face button's digital signal. | |
| Trigger | Back (wpi::EventLoop *loop=CommandScheduler::GetInstance() .GetDefaultButtonLoop()) const |
| Constructs a Trigger instance around the Back button's digital signal. | |
| Trigger | Guide (wpi::EventLoop *loop=CommandScheduler::GetInstance() .GetDefaultButtonLoop()) const |
| Constructs a Trigger instance around the Guide button's digital signal. | |
| Trigger | Start (wpi::EventLoop *loop=CommandScheduler::GetInstance() .GetDefaultButtonLoop()) const |
| Constructs a Trigger instance around the Start button's digital signal. | |
| Trigger | LeftStick (wpi::EventLoop *loop=CommandScheduler::GetInstance() .GetDefaultButtonLoop()) const |
| Constructs a Trigger instance around the left stick button's digital signal. | |
| Trigger | RightStick (wpi::EventLoop *loop=CommandScheduler::GetInstance() .GetDefaultButtonLoop()) const |
| Constructs a Trigger instance around the right stick button's digital signal. | |
| Trigger | LeftBumper (wpi::EventLoop *loop=CommandScheduler::GetInstance() .GetDefaultButtonLoop()) const |
| Constructs a Trigger instance around the right bumper button's digital signal. | |
| Trigger | RightBumper (wpi::EventLoop *loop=CommandScheduler::GetInstance() .GetDefaultButtonLoop()) const |
| Constructs a Trigger instance around the right bumper button's digital signal. | |
| Trigger | DpadUp (wpi::EventLoop *loop=CommandScheduler::GetInstance() .GetDefaultButtonLoop()) const |
| Constructs a Trigger instance around the D-pad up button's digital signal. | |
| Trigger | DpadDown (wpi::EventLoop *loop=CommandScheduler::GetInstance() .GetDefaultButtonLoop()) const |
| Constructs a Trigger instance around the D-pad down button's digital signal. | |
| Trigger | DpadLeft (wpi::EventLoop *loop=CommandScheduler::GetInstance() .GetDefaultButtonLoop()) const |
| Constructs a Trigger instance around the D-pad left button's digital signal. | |
| Trigger | DpadRight (wpi::EventLoop *loop=CommandScheduler::GetInstance() .GetDefaultButtonLoop()) const |
| Constructs a Trigger instance around the D-pad right button's digital signal. | |
| Trigger | Misc1 (wpi::EventLoop *loop=CommandScheduler::GetInstance() .GetDefaultButtonLoop()) const |
| Constructs a Trigger instance around the Miscellaneous 1 button's digital signal. | |
| Trigger | RightPaddle1 (wpi::EventLoop *loop=CommandScheduler::GetInstance().GetDefaultButtonLoop()) const |
| Constructs a Trigger instance around the Right Paddle 1 button's digital signal. | |
| Trigger | LeftPaddle1 (wpi::EventLoop *loop=CommandScheduler::GetInstance() .GetDefaultButtonLoop()) const |
| Constructs a Trigger instance around the Left Paddle 1 button's digital signal. | |
| Trigger | RightPaddle2 (wpi::EventLoop *loop=CommandScheduler::GetInstance().GetDefaultButtonLoop()) const |
| Constructs a Trigger instance around the Right Paddle 2 button's digital signal. | |
| Trigger | LeftPaddle2 (wpi::EventLoop *loop=CommandScheduler::GetInstance() .GetDefaultButtonLoop()) const |
| Constructs a Trigger instance around the Left Paddle 2 button's digital signal. | |
| Trigger | Touchpad (wpi::EventLoop *loop=CommandScheduler::GetInstance() .GetDefaultButtonLoop()) const |
| Constructs a Trigger instance around the Touchpad button's digital signal. | |
| Trigger | Misc2 (wpi::EventLoop *loop=CommandScheduler::GetInstance() .GetDefaultButtonLoop()) const |
| Constructs a Trigger instance around the Miscellaneous 2 button's digital signal. | |
| Trigger | Misc3 (wpi::EventLoop *loop=CommandScheduler::GetInstance() .GetDefaultButtonLoop()) const |
| Constructs a Trigger instance around the Miscellaneous 3 button's digital signal. | |
| Trigger | Misc4 (wpi::EventLoop *loop=CommandScheduler::GetInstance() .GetDefaultButtonLoop()) const |
| Constructs a Trigger instance around the Miscellaneous 4 button's digital signal. | |
| Trigger | Misc5 (wpi::EventLoop *loop=CommandScheduler::GetInstance() .GetDefaultButtonLoop()) const |
| Constructs a Trigger instance around the Miscellaneous 5 button's digital signal. | |
| Trigger | Misc6 (wpi::EventLoop *loop=CommandScheduler::GetInstance() .GetDefaultButtonLoop()) const |
| Constructs a Trigger instance around the Miscellaneous 6 button's digital signal. | |
| Trigger | LeftTrigger (double threshold=0.5, wpi::EventLoop *loop=CommandScheduler::GetInstance() .GetDefaultButtonLoop()) const |
| Constructs a Trigger instance around the axis value of the left trigger. | |
| Trigger | RightTrigger (double threshold=0.5, wpi::EventLoop *loop=CommandScheduler::GetInstance().GetDefaultButtonLoop()) const |
| Constructs a Trigger instance around the axis value of the right trigger. | |
| double | GetLeftX () const |
| Get the X axis value of left side of the controller. | |
| double | GetLeftY () const |
| Get the Y axis value of left side of the controller. | |
| double | GetRightX () const |
| Get the X axis value of right side of the controller. | |
| double | GetRightY () const |
| Get the Y axis value of right side of the controller. | |
| double | GetLeftTriggerAxis () const |
| Get the left trigger axis value of the controller. | |
| double | GetRightTriggerAxis () const |
| Get the right trigger axis value of the controller. | |
| Public Member Functions inherited from wpi::cmd::CommandGenericHID | |
| CommandGenericHID (int port) | |
| Construct an instance of a device. | |
| wpi::GenericHID & | GetHID () |
| Get the underlying GenericHID object. | |
| Trigger | Button (int button, wpi::EventLoop *loop=CommandScheduler::GetInstance() .GetDefaultButtonLoop()) const |
| Constructs an event instance around this button's digital signal. | |
| Trigger | POV (wpi::DriverStation::POVDirection angle, wpi::EventLoop *loop=CommandScheduler::GetInstance().GetDefaultButtonLoop()) const |
| Constructs a Trigger instance based around this angle of a POV on the HID. | |
| Trigger | POV (int pov, wpi::DriverStation::POVDirection angle, wpi::EventLoop *loop=CommandScheduler::GetInstance().GetDefaultButtonLoop()) const |
| Constructs a Trigger instance based around this angle of a POV on the HID. | |
| Trigger | POVUp (wpi::EventLoop *loop=CommandScheduler::GetInstance() .GetDefaultButtonLoop()) const |
| Constructs a Trigger instance based around the up direction of the default (index 0) POV on the HID. | |
| Trigger | POVUpRight (wpi::EventLoop *loop=CommandScheduler::GetInstance() .GetDefaultButtonLoop()) const |
| Constructs a Trigger instance based around the up right direction of the default (index 0) POV on the HID. | |
| Trigger | POVRight (wpi::EventLoop *loop=CommandScheduler::GetInstance() .GetDefaultButtonLoop()) const |
| Constructs a Trigger instance based around the right direction of the default (index 0) POV on the HID. | |
| Trigger | POVDownRight (wpi::EventLoop *loop=CommandScheduler::GetInstance().GetDefaultButtonLoop()) const |
| Constructs a Trigger instance based around the down right direction of the default (index 0) POV on the HID. | |
| Trigger | POVDown (wpi::EventLoop *loop=CommandScheduler::GetInstance() .GetDefaultButtonLoop()) const |
| Constructs a Trigger instance based around the down direction of the default (index 0) POV on the HID. | |
| Trigger | POVDownLeft (wpi::EventLoop *loop=CommandScheduler::GetInstance() .GetDefaultButtonLoop()) const |
| Constructs a Trigger instance based around the down left direction of the default (index 0) POV on the HID. | |
| Trigger | POVLeft (wpi::EventLoop *loop=CommandScheduler::GetInstance() .GetDefaultButtonLoop()) const |
| Constructs a Trigger instance based around the left direction of the default (index 0) POV on the HID. | |
| Trigger | POVUpLeft (wpi::EventLoop *loop=CommandScheduler::GetInstance() .GetDefaultButtonLoop()) const |
| Constructs a Trigger instance based around the up left direction of the default (index 0) POV on the HID. | |
| Trigger | POVCenter (wpi::EventLoop *loop=CommandScheduler::GetInstance() .GetDefaultButtonLoop()) const |
| Constructs a Trigger instance based around the center (not pressed) position of the default (index 0) POV on the HID. | |
| Trigger | AxisLessThan (int axis, double threshold, wpi::EventLoop *loop=CommandScheduler::GetInstance().GetDefaultButtonLoop()) const |
Constructs a Trigger instance that is true when the axis value is less than threshold, attached to the default command scheduler
button loop. | |
| Trigger | AxisGreaterThan (int axis, double threshold, wpi::EventLoop *loop=CommandScheduler::GetInstance().GetDefaultButtonLoop()) const |
Constructs a Trigger instance that is true when the axis value is greater than threshold, attached to the default command scheduler
button loop. | |
| Trigger | AxisMagnitudeGreaterThan (int axis, double threshold, wpi::EventLoop *loop=CommandScheduler::GetInstance().GetDefaultButtonLoop()) const |
Constructs a Trigger instance that is true when the axis magnitude value is greater than threshold, attached to the given loop. | |
| void | SetRumble (wpi::GenericHID::RumbleType type, double value) |
| Set the rumble output for the HID. | |
| bool | IsConnected () const |
| Get if the HID is connected. | |
A version of wpi::Gamepad with Trigger factories for command-based.
|
explicit |
Construct an instance of a controller.
| port | The port index on the Driver Station that the controller is plugged into. |
| Trigger wpi::cmd::CommandGamepad::Back | ( | wpi::EventLoop * | loop = CommandScheduler::GetInstance() .GetDefaultButtonLoop() | ) | const |
Constructs a Trigger instance around the Back button's digital signal.
| loop | the event loop instance to attach the event to. Defaults to the CommandScheduler's default loop. |
| Trigger wpi::cmd::CommandGamepad::DpadDown | ( | wpi::EventLoop * | loop = CommandScheduler::GetInstance() .GetDefaultButtonLoop() | ) | const |
Constructs a Trigger instance around the D-pad down button's digital signal.
| loop | the event loop instance to attach the event to. Defaults to the CommandScheduler's default loop. |
| Trigger wpi::cmd::CommandGamepad::DpadLeft | ( | wpi::EventLoop * | loop = CommandScheduler::GetInstance() .GetDefaultButtonLoop() | ) | const |
Constructs a Trigger instance around the D-pad left button's digital signal.
| loop | the event loop instance to attach the event to. Defaults to the CommandScheduler's default loop. |
| Trigger wpi::cmd::CommandGamepad::DpadRight | ( | wpi::EventLoop * | loop = CommandScheduler::GetInstance() .GetDefaultButtonLoop() | ) | const |
Constructs a Trigger instance around the D-pad right button's digital signal.
| loop | the event loop instance to attach the event to. Defaults to the CommandScheduler's default loop. |
| Trigger wpi::cmd::CommandGamepad::DpadUp | ( | wpi::EventLoop * | loop = CommandScheduler::GetInstance() .GetDefaultButtonLoop() | ) | const |
Constructs a Trigger instance around the D-pad up button's digital signal.
| loop | the event loop instance to attach the event to. Defaults to the CommandScheduler's default loop. |
| Trigger wpi::cmd::CommandGamepad::EastFace | ( | wpi::EventLoop * | loop = CommandScheduler::GetInstance() .GetDefaultButtonLoop() | ) | const |
Constructs a Trigger instance around the East Face button's digital signal.
| loop | the event loop instance to attach the event to. Defaults to the CommandScheduler's default loop. |
| wpi::Gamepad & wpi::cmd::CommandGamepad::GetHID | ( | ) |
Get the underlying GenericHID object.
| double wpi::cmd::CommandGamepad::GetLeftTriggerAxis | ( | ) | const |
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].
| double wpi::cmd::CommandGamepad::GetLeftX | ( | ) | const |
Get the X axis value of left side of the controller.
Right is positive.
| double wpi::cmd::CommandGamepad::GetLeftY | ( | ) | const |
Get the Y axis value of left side of the controller.
Back is positive.
| double wpi::cmd::CommandGamepad::GetRightTriggerAxis | ( | ) | const |
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].
| double wpi::cmd::CommandGamepad::GetRightX | ( | ) | const |
Get the X axis value of right side of the controller.
Right is positive.
| double wpi::cmd::CommandGamepad::GetRightY | ( | ) | const |
Get the Y axis value of right side of the controller.
Back is positive.
| Trigger wpi::cmd::CommandGamepad::Guide | ( | wpi::EventLoop * | loop = CommandScheduler::GetInstance() .GetDefaultButtonLoop() | ) | const |
Constructs a Trigger instance around the Guide button's digital signal.
| loop | the event loop instance to attach the event to. Defaults to the CommandScheduler's default loop. |
| Trigger wpi::cmd::CommandGamepad::LeftBumper | ( | wpi::EventLoop * | loop = CommandScheduler::GetInstance() .GetDefaultButtonLoop() | ) | const |
Constructs a Trigger instance around the right bumper button's digital signal.
| loop | the event loop instance to attach the event to. Defaults to the CommandScheduler's default loop. |
| Trigger wpi::cmd::CommandGamepad::LeftPaddle1 | ( | wpi::EventLoop * | loop = CommandScheduler::GetInstance() .GetDefaultButtonLoop() | ) | const |
Constructs a Trigger instance around the Left Paddle 1 button's digital signal.
| loop | the event loop instance to attach the event to. Defaults to the CommandScheduler's default loop. |
| Trigger wpi::cmd::CommandGamepad::LeftPaddle2 | ( | wpi::EventLoop * | loop = CommandScheduler::GetInstance() .GetDefaultButtonLoop() | ) | const |
Constructs a Trigger instance around the Left Paddle 2 button's digital signal.
| loop | the event loop instance to attach the event to. Defaults to the CommandScheduler's default loop. |
| Trigger wpi::cmd::CommandGamepad::LeftStick | ( | wpi::EventLoop * | loop = CommandScheduler::GetInstance() .GetDefaultButtonLoop() | ) | const |
Constructs a Trigger instance around the left stick button's digital signal.
| loop | the event loop instance to attach the event to. Defaults to the CommandScheduler's default loop. |
| Trigger wpi::cmd::CommandGamepad::LeftTrigger | ( | double | threshold = 0.5, |
| wpi::EventLoop * | loop = CommandScheduler::GetInstance() .GetDefaultButtonLoop() ) const |
Constructs a Trigger instance around the axis value of the left trigger.
The returned Trigger will be true when the axis value is greater than threshold.
| threshold | the minimum axis value for the returned Trigger to be true. This value should be in the range [0, 1] where 0 is the unpressed state of the axis. Defaults to 0.5. |
| loop | the event loop instance to attach the Trigger to. Defaults to the CommandScheduler's default loop. |
| Trigger wpi::cmd::CommandGamepad::Misc1 | ( | wpi::EventLoop * | loop = CommandScheduler::GetInstance() .GetDefaultButtonLoop() | ) | const |
Constructs a Trigger instance around the Miscellaneous 1 button's digital signal.
| loop | the event loop instance to attach the event to. Defaults to the CommandScheduler's default loop. |
| Trigger wpi::cmd::CommandGamepad::Misc2 | ( | wpi::EventLoop * | loop = CommandScheduler::GetInstance() .GetDefaultButtonLoop() | ) | const |
Constructs a Trigger instance around the Miscellaneous 2 button's digital signal.
| loop | the event loop instance to attach the event to. Defaults to the CommandScheduler's default loop. |
| Trigger wpi::cmd::CommandGamepad::Misc3 | ( | wpi::EventLoop * | loop = CommandScheduler::GetInstance() .GetDefaultButtonLoop() | ) | const |
Constructs a Trigger instance around the Miscellaneous 3 button's digital signal.
| loop | the event loop instance to attach the event to. Defaults to the CommandScheduler's default loop. |
| Trigger wpi::cmd::CommandGamepad::Misc4 | ( | wpi::EventLoop * | loop = CommandScheduler::GetInstance() .GetDefaultButtonLoop() | ) | const |
Constructs a Trigger instance around the Miscellaneous 4 button's digital signal.
| loop | the event loop instance to attach the event to. Defaults to the CommandScheduler's default loop. |
| Trigger wpi::cmd::CommandGamepad::Misc5 | ( | wpi::EventLoop * | loop = CommandScheduler::GetInstance() .GetDefaultButtonLoop() | ) | const |
Constructs a Trigger instance around the Miscellaneous 5 button's digital signal.
| loop | the event loop instance to attach the event to. Defaults to the CommandScheduler's default loop. |
| Trigger wpi::cmd::CommandGamepad::Misc6 | ( | wpi::EventLoop * | loop = CommandScheduler::GetInstance() .GetDefaultButtonLoop() | ) | const |
Constructs a Trigger instance around the Miscellaneous 6 button's digital signal.
| loop | the event loop instance to attach the event to. Defaults to the CommandScheduler's default loop. |
| Trigger wpi::cmd::CommandGamepad::NorthFace | ( | wpi::EventLoop * | loop = CommandScheduler::GetInstance() .GetDefaultButtonLoop() | ) | const |
Constructs a Trigger instance around the North Face button's digital signal.
| loop | the event loop instance to attach the event to. Defaults to the CommandScheduler's default loop. |
| Trigger wpi::cmd::CommandGamepad::RightBumper | ( | wpi::EventLoop * | loop = CommandScheduler::GetInstance() .GetDefaultButtonLoop() | ) | const |
Constructs a Trigger instance around the right bumper button's digital signal.
| loop | the event loop instance to attach the event to. Defaults to the CommandScheduler's default loop. |
| Trigger wpi::cmd::CommandGamepad::RightPaddle1 | ( | wpi::EventLoop * | loop = CommandScheduler::GetInstance().GetDefaultButtonLoop() | ) | const |
Constructs a Trigger instance around the Right Paddle 1 button's digital signal.
| loop | the event loop instance to attach the event to. Defaults to the CommandScheduler's default loop. |
| Trigger wpi::cmd::CommandGamepad::RightPaddle2 | ( | wpi::EventLoop * | loop = CommandScheduler::GetInstance().GetDefaultButtonLoop() | ) | const |
Constructs a Trigger instance around the Right Paddle 2 button's digital signal.
| loop | the event loop instance to attach the event to. Defaults to the CommandScheduler's default loop. |
| Trigger wpi::cmd::CommandGamepad::RightStick | ( | wpi::EventLoop * | loop = CommandScheduler::GetInstance() .GetDefaultButtonLoop() | ) | const |
Constructs a Trigger instance around the right stick button's digital signal.
| loop | the event loop instance to attach the event to. Defaults to the CommandScheduler's default loop. |
| Trigger wpi::cmd::CommandGamepad::RightTrigger | ( | double | threshold = 0.5, |
| wpi::EventLoop * | loop = CommandScheduler::GetInstance().GetDefaultButtonLoop() ) const |
Constructs a Trigger instance around the axis value of the right trigger.
The returned Trigger will be true when the axis value is greater than threshold.
| threshold | the minimum axis value for the returned Trigger to be true. This value should be in the range [0, 1] where 0 is the unpressed state of the axis. Defaults to 0.5. |
| loop | the event loop instance to attach the Trigger to. Defaults to the CommandScheduler's default loop. |
| Trigger wpi::cmd::CommandGamepad::SouthFace | ( | wpi::EventLoop * | loop = CommandScheduler::GetInstance() .GetDefaultButtonLoop() | ) | const |
Constructs a Trigger instance around the South Face button's digital signal.
| loop | the event loop instance to attach the event to. Defaults to the CommandScheduler's default loop. |
| Trigger wpi::cmd::CommandGamepad::Start | ( | wpi::EventLoop * | loop = CommandScheduler::GetInstance() .GetDefaultButtonLoop() | ) | const |
Constructs a Trigger instance around the Start button's digital signal.
| loop | the event loop instance to attach the event to. Defaults to the CommandScheduler's default loop. |
| Trigger wpi::cmd::CommandGamepad::Touchpad | ( | wpi::EventLoop * | loop = CommandScheduler::GetInstance() .GetDefaultButtonLoop() | ) | const |
Constructs a Trigger instance around the Touchpad button's digital signal.
| loop | the event loop instance to attach the event to. Defaults to the CommandScheduler's default loop. |
| Trigger wpi::cmd::CommandGamepad::WestFace | ( | wpi::EventLoop * | loop = CommandScheduler::GetInstance() .GetDefaultButtonLoop() | ) | const |
Constructs a Trigger instance around the West Face button's digital signal.
| loop | the event loop instance to attach the event to. Defaults to the CommandScheduler's default loop. |