WPILibC++ 2025.2.1
|
A version of frc::GenericHID
with Trigger
factories for command-based.
More...
#include <frc2/command/button/CommandGenericHID.h>
Public Member Functions | |
CommandGenericHID (int port) | |
Construct an instance of a device. | |
frc::GenericHID & | GetHID () |
Get the underlying GenericHID object. | |
Trigger | Button (int button, frc::EventLoop *loop=CommandScheduler::GetInstance() .GetDefaultButtonLoop()) const |
Constructs an event instance around this button's digital signal. | |
Trigger | POV (int angle, frc::EventLoop *loop=CommandScheduler::GetInstance().GetDefaultButtonLoop()) const |
Constructs a Trigger instance based around this angle of a POV on the HID. | |
Trigger | POV (int pov, int angle, frc::EventLoop *loop=CommandScheduler::GetInstance().GetDefaultButtonLoop()) const |
Constructs a Trigger instance based around this angle of a POV on the HID. | |
Trigger | POVUp (frc::EventLoop *loop=CommandScheduler::GetInstance() .GetDefaultButtonLoop()) const |
Constructs a Trigger instance based around the 0 degree angle (up) of the default (index 0) POV on the HID. | |
Trigger | POVUpRight (frc::EventLoop *loop=CommandScheduler::GetInstance() .GetDefaultButtonLoop()) const |
Constructs a Trigger instance based around the 45 degree angle (right up) of the default (index 0) POV on the HID. | |
Trigger | POVRight (frc::EventLoop *loop=CommandScheduler::GetInstance() .GetDefaultButtonLoop()) const |
Constructs a Trigger instance based around the 90 degree angle (right) of the default (index 0) POV on the HID. | |
Trigger | POVDownRight (frc::EventLoop *loop=CommandScheduler::GetInstance().GetDefaultButtonLoop()) const |
Constructs a Trigger instance based around the 135 degree angle (right down) of the default (index 0) POV on the HID. | |
Trigger | POVDown (frc::EventLoop *loop=CommandScheduler::GetInstance() .GetDefaultButtonLoop()) const |
Constructs a Trigger instance based around the 180 degree angle (down) of the default (index 0) POV on the HID. | |
Trigger | POVDownLeft (frc::EventLoop *loop=CommandScheduler::GetInstance() .GetDefaultButtonLoop()) const |
Constructs a Trigger instance based around the 225 degree angle (down left) of the default (index 0) POV on the HID. | |
Trigger | POVLeft (frc::EventLoop *loop=CommandScheduler::GetInstance() .GetDefaultButtonLoop()) const |
Constructs a Trigger instance based around the 270 degree angle (left) of the default (index 0) POV on the HID. | |
Trigger | POVUpLeft (frc::EventLoop *loop=CommandScheduler::GetInstance() .GetDefaultButtonLoop()) const |
Constructs a Trigger instance based around the 315 degree angle (left up) of the default (index 0) POV on the HID. | |
Trigger | POVCenter (frc::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, frc::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, frc::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, frc::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 (frc::GenericHID::RumbleType type, double value) |
Set the rumble output for the HID. | |
bool | IsConnected () const |
Get if the HID is connected. | |
A version of frc::GenericHID
with Trigger
factories for command-based.
|
explicit |
Construct an instance of a device.
port | The port index on the Driver Station that the device is plugged into. |
Trigger frc2::CommandGenericHID::AxisGreaterThan | ( | int | axis, |
double | threshold, | ||
frc::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
.
axis | The axis to read, starting at 0. |
threshold | The value below which this trigger should return true. |
loop | the event loop instance to attach the event to. Defaults to the default command scheduler button loop . |
Trigger frc2::CommandGenericHID::AxisLessThan | ( | int | axis, |
double | threshold, | ||
frc::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
.
axis | The axis to read, starting at 0. |
threshold | The value below which this trigger should return true. |
loop | the event loop instance to attach the event to. Defaults to the default command scheduler button loop . |
Trigger frc2::CommandGenericHID::AxisMagnitudeGreaterThan | ( | int | axis, |
double | threshold, | ||
frc::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.
axis | The axis to read, starting at 0 |
threshold | The value above which this trigger should return true. |
loop | the event loop instance to attach the trigger to. |
Trigger frc2::CommandGenericHID::Button | ( | int | button, |
frc::EventLoop * | loop = CommandScheduler::GetInstance() .GetDefaultButtonLoop() ) const |
Constructs an event instance around this button's digital signal.
button | the button index |
loop | the event loop instance to attach the event to. Defaults to the CommandScheduler's default loop. |
frc::GenericHID & frc2::CommandGenericHID::GetHID | ( | ) |
Get the underlying GenericHID object.
bool frc2::CommandGenericHID::IsConnected | ( | ) | const |
Get if the HID is connected.
Trigger frc2::CommandGenericHID::POV | ( | int | angle, |
frc::EventLoop * | loop = CommandScheduler::GetInstance().GetDefaultButtonLoop() ) const |
Constructs a Trigger instance based around this angle of a POV on the HID.
The POV angles start at 0 in the up direction, and increase clockwise (eg right is 90, upper-left is 315).
loop | the event loop instance to attach the event to. Defaults to the default command scheduler button loop . |
angle | POV angle in degrees, or -1 for the center / not pressed. |
Trigger frc2::CommandGenericHID::POV | ( | int | pov, |
int | angle, | ||
frc::EventLoop * | loop = CommandScheduler::GetInstance().GetDefaultButtonLoop() ) const |
Constructs a Trigger instance based around this angle of a POV on the HID.
The POV angles start at 0 in the up direction, and increase clockwise (eg right is 90, upper-left is 315).
loop | the event loop instance to attach the event to. Defaults to the default command scheduler button loop . |
pov | index of the POV to read (starting at 0). Defaults to 0. |
angle | POV angle in degrees, or -1 for the center / not pressed. |
Trigger frc2::CommandGenericHID::POVCenter | ( | frc::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.
loop | the event loop instance to attach the event to. Defaults to the default command scheduler button loop . |
Trigger frc2::CommandGenericHID::POVDown | ( | frc::EventLoop * | loop = CommandScheduler::GetInstance() .GetDefaultButtonLoop() | ) | const |
Constructs a Trigger instance based around the 180 degree angle (down) of the default (index 0) POV on the HID.
loop | the event loop instance to attach the event to. Defaults to the default command scheduler button loop . |
Trigger frc2::CommandGenericHID::POVDownLeft | ( | frc::EventLoop * | loop = CommandScheduler::GetInstance() .GetDefaultButtonLoop() | ) | const |
Constructs a Trigger instance based around the 225 degree angle (down left) of the default (index 0) POV on the HID.
loop | the event loop instance to attach the event to. Defaults to the default command scheduler button loop . |
Trigger frc2::CommandGenericHID::POVDownRight | ( | frc::EventLoop * | loop = CommandScheduler::GetInstance().GetDefaultButtonLoop() | ) | const |
Trigger frc2::CommandGenericHID::POVLeft | ( | frc::EventLoop * | loop = CommandScheduler::GetInstance() .GetDefaultButtonLoop() | ) | const |
Constructs a Trigger instance based around the 270 degree angle (left) of the default (index 0) POV on the HID.
loop | the event loop instance to attach the event to. Defaults to the default command scheduler button loop . |
Trigger frc2::CommandGenericHID::POVRight | ( | frc::EventLoop * | loop = CommandScheduler::GetInstance() .GetDefaultButtonLoop() | ) | const |
Constructs a Trigger instance based around the 90 degree angle (right) of the default (index 0) POV on the HID.
loop | the event loop instance to attach the event to. Defaults to the default command scheduler button loop . |
Trigger frc2::CommandGenericHID::POVUp | ( | frc::EventLoop * | loop = CommandScheduler::GetInstance() .GetDefaultButtonLoop() | ) | const |
Constructs a Trigger instance based around the 0 degree angle (up) of the default (index 0) POV on the HID.
loop | the event loop instance to attach the event to. Defaults to the default command scheduler button loop . |
Trigger frc2::CommandGenericHID::POVUpLeft | ( | frc::EventLoop * | loop = CommandScheduler::GetInstance() .GetDefaultButtonLoop() | ) | const |
Constructs a Trigger instance based around the 315 degree angle (left up) of the default (index 0) POV on the HID.
loop | the event loop instance to attach the event to. Defaults to the default command scheduler button loop . |
Trigger frc2::CommandGenericHID::POVUpRight | ( | frc::EventLoop * | loop = CommandScheduler::GetInstance() .GetDefaultButtonLoop() | ) | const |
Constructs a Trigger instance based around the 45 degree angle (right up) of the default (index 0) POV on the HID.
loop | the event loop instance to attach the event to. Defaults to the default command scheduler button loop . |
void frc2::CommandGenericHID::SetRumble | ( | frc::GenericHID::RumbleType | type, |
double | value ) |
Set the rumble output for the HID.
The DS currently supports 2 rumble values, left rumble and right rumble.
type | Which rumble value to set |
value | The normalized value (0 to 1) to set the rumble to |