WPILibC++ 2023.4.3
frc2::CommandGenericHID Class Reference

A subclass of GenericHID with Trigger factories for command-based. More...

#include <frc2/command/button/CommandGenericHID.h>

Inheritance diagram for frc2::CommandGenericHID:
frc::GenericHID

Public Member Functions

Trigger Button (int button, frc::EventLoop *loop=CommandScheduler::GetInstance() .GetDefaultButtonLoop()) const
 Constructs an event instance around this button's digital signal. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
- Public Member Functions inherited from frc::GenericHID
 GenericHID (int port)
 
virtual ~GenericHID ()=default
 
 GenericHID (GenericHID &&)=default
 
GenericHIDoperator= (GenericHID &&)=default
 
bool GetRawButton (int button) const
 Get the button value (starting at button 1). More...
 
bool GetRawButtonPressed (int button)
 Whether the button was pressed since the last check. More...
 
bool GetRawButtonReleased (int button)
 Whether the button was released since the last check. More...
 
BooleanEvent Button (int button, EventLoop *loop) const
 Constructs an event instance around this button's digital signal. More...
 
double GetRawAxis (int axis) const
 Get the value of the axis. More...
 
int GetPOV (int pov=0) const
 Get the angle in degrees of a POV on the HID. More...
 
BooleanEvent POV (int angle, EventLoop *loop) const
 Constructs a BooleanEvent instance based around this angle of a POV on the HID. More...
 
BooleanEvent POV (int pov, int angle, EventLoop *loop) const
 Constructs a BooleanEvent instance based around this angle of a POV on the HID. More...
 
BooleanEvent POVUp (EventLoop *loop) const
 Constructs a BooleanEvent instance based around the 0 degree angle (up) of the default (index 0) POV on the HID. More...
 
BooleanEvent POVUpRight (EventLoop *loop) const
 Constructs a BooleanEvent instance based around the 45 degree angle (right up) of the default (index 0) POV on the HID. More...
 
BooleanEvent POVRight (EventLoop *loop) const
 Constructs a BooleanEvent instance based around the 90 degree angle (right) of the default (index 0) POV on the HID. More...
 
BooleanEvent POVDownRight (EventLoop *loop) const
 Constructs a BooleanEvent instance based around the 135 degree angle (right down) of the default (index 0) POV on the HID. More...
 
BooleanEvent POVDown (EventLoop *loop) const
 Constructs a BooleanEvent instance based around the 180 degree angle (down) of the default (index 0) POV on the HID. More...
 
BooleanEvent POVDownLeft (EventLoop *loop) const
 Constructs a BooleanEvent instance based around the 225 degree angle (down left) of the default (index 0) POV on the HID. More...
 
BooleanEvent POVLeft (EventLoop *loop) const
 Constructs a BooleanEvent instance based around the 270 degree angle (left) of the default (index 0) POV on the HID. More...
 
BooleanEvent POVUpLeft (EventLoop *loop) const
 Constructs a BooleanEvent instance based around the 315 degree angle (left up) of the default (index 0) POV on the HID. More...
 
BooleanEvent POVCenter (EventLoop *loop) const
 Constructs a BooleanEvent instance based around the center (not pressed) of the default (index 0) POV on the HID. More...
 
BooleanEvent AxisLessThan (int axis, double threshold, EventLoop *loop) const
 Constructs an event instance that is true when the axis value is less than threshold. More...
 
BooleanEvent AxisGreaterThan (int axis, double threshold, EventLoop *loop) const
 Constructs an event instance that is true when the axis value is greater than threshold. More...
 
int GetAxisCount () const
 Get the number of axes for the HID. More...
 
int GetPOVCount () const
 Get the number of POVs for the HID. More...
 
int GetButtonCount () const
 Get the number of buttons for the HID. More...
 
bool IsConnected () const
 Get if the HID is connected. More...
 
GenericHID::HIDType GetType () const
 Get the type of the HID. More...
 
std::string GetName () const
 Get the name of the HID. More...
 
int GetAxisType (int axis) const
 Get the axis type of a joystick axis. More...
 
int GetPort () const
 Get the port number of the HID. More...
 
void SetOutput (int outputNumber, bool value)
 Set a single HID output value for the HID. More...
 
void SetOutputs (int value)
 Set all output values for the HID. More...
 
void SetRumble (RumbleType type, double value)
 Set the rumble output for the HID. More...
 

Additional Inherited Members

- Public Types inherited from frc::GenericHID
enum  RumbleType { kLeftRumble , kRightRumble , kBothRumble }
 
enum  HIDType {
  kUnknown = -1 , kXInputUnknown = 0 , kXInputGamepad = 1 , kXInputWheel = 2 ,
  kXInputArcadeStick = 3 , kXInputFlightStick = 4 , kXInputDancePad = 5 , kXInputGuitar = 6 ,
  kXInputGuitar2 = 7 , kXInputDrumKit = 8 , kXInputGuitar3 = 11 , kXInputArcadePad = 19 ,
  kHIDJoystick = 20 , kHIDGamepad = 21 , kHIDDriving = 22 , kHIDFlight = 23 ,
  kHID1stPerson = 24
}
 

Detailed Description

A subclass of GenericHID with Trigger factories for command-based.

See also
GenericHID

Member Function Documentation

◆ AxisGreaterThan()

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.

Parameters
axisThe axis to read, starting at 0.
thresholdThe value below which this trigger should return true.
loopthe event loop instance to attach the event to. Defaults to the default command scheduler button loop.
Returns
a Trigger instance that is true when the axis value is greater than the provided threshold.

◆ AxisLessThan()

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.

Parameters
axisThe axis to read, starting at 0.
thresholdThe value below which this trigger should return true.
loopthe event loop instance to attach the event to. Defaults to the default command scheduler button loop.
Returns
a Trigger instance that is true when the axis value is less than the provided threshold.

◆ Button()

Trigger frc2::CommandGenericHID::Button ( int  button,
frc::EventLoop loop = CommandScheduler::GetInstance() .GetDefaultButtonLoop() 
) const

Constructs an event instance around this button's digital signal.

Parameters
buttonthe button index
loopthe event loop instance to attach the event to. Defaults to the CommandScheduler's default loop.
Returns
an event instance representing the button's digital signal attached to the given loop.

◆ POV() [1/2]

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).

Parameters
loopthe event loop instance to attach the event to. Defaults to the default command scheduler button loop.
anglePOV angle in degrees, or -1 for the center / not pressed.
Returns
a Trigger instance based around this angle of a POV on the HID.

◆ POV() [2/2]

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).

Parameters
loopthe event loop instance to attach the event to. Defaults to the default command scheduler button loop.
povindex of the POV to read (starting at 0). Defaults to 0.
anglePOV angle in degrees, or -1 for the center / not pressed.
Returns
a Trigger instance based around this angle of a POV on the HID.

◆ POVCenter()

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.

Parameters
loopthe event loop instance to attach the event to. Defaults to the default command scheduler button loop.
Returns
a Trigger instance based around the center position of a POV on the HID.

◆ POVDown()

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.

Parameters
loopthe event loop instance to attach the event to. Defaults to the default command scheduler button loop.
Returns
a Trigger instance based around the 180 degree angle of a POV on the HID.

◆ POVDownLeft()

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.

Parameters
loopthe event loop instance to attach the event to. Defaults to the default command scheduler button loop.
Returns
a Trigger instance based around the 225 degree angle of a POV on the HID.

◆ POVDownRight()

Trigger frc2::CommandGenericHID::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.

Returns
a Trigger instance based around the 135 degree angle of a POV on the HID.

◆ POVLeft()

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.

Parameters
loopthe event loop instance to attach the event to. Defaults to the default command scheduler button loop.
Returns
a Trigger instance based around the 270 degree angle of a POV on the HID.

◆ POVRight()

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.

Parameters
loopthe event loop instance to attach the event to. Defaults to the default command scheduler button loop.
Returns
a Trigger instance based around the 90 degree angle of a POV on the HID.

◆ POVUp()

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.

Parameters
loopthe event loop instance to attach the event to. Defaults to the default command scheduler button loop.
Returns
a Trigger instance based around the 0 degree angle of a POV on the HID.

◆ POVUpLeft()

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.

Parameters
loopthe event loop instance to attach the event to. Defaults to the default command scheduler button loop.
Returns
a Trigger instance based around the 315 degree angle of a POV on the HID.

◆ POVUpRight()

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.

Parameters
loopthe event loop instance to attach the event to. Defaults to the default command scheduler button loop.
Returns
a Trigger instance based around the 45 degree angle of a POV on the HID.

The documentation for this class was generated from the following file: