WPILibC++ 2025.2.1
Loading...
Searching...
No Matches
frc2::CommandPS5Controller Class Reference

A version of frc::PS5Controller with Trigger factories for command-based. More...

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

Inheritance diagram for frc2::CommandPS5Controller:
frc2::CommandGenericHID

Public Member Functions

 CommandPS5Controller (int port)
 Construct an instance of a controller.
 
frc::PS5ControllerGetHID ()
 Get the underlying GenericHID object.
 
Trigger Square (frc::EventLoop *loop=CommandScheduler::GetInstance() .GetDefaultButtonLoop()) const
 Constructs a Trigger instance around the square button's digital signal.
 
Trigger Cross (frc::EventLoop *loop=CommandScheduler::GetInstance() .GetDefaultButtonLoop()) const
 Constructs a Trigger instance around the cross button's digital signal.
 
Trigger Circle (frc::EventLoop *loop=CommandScheduler::GetInstance() .GetDefaultButtonLoop()) const
 Constructs a Trigger instance around the circle button's digital signal.
 
Trigger Triangle (frc::EventLoop *loop=CommandScheduler::GetInstance() .GetDefaultButtonLoop()) const
 Constructs a Trigger instance around the triangle button's digital signal.
 
Trigger L1 (frc::EventLoop *loop=CommandScheduler::GetInstance() .GetDefaultButtonLoop()) const
 Constructs a Trigger instance around the left trigger 1 button's digital signal.
 
Trigger R1 (frc::EventLoop *loop=CommandScheduler::GetInstance() .GetDefaultButtonLoop()) const
 Constructs a Trigger instance around the right trigger 1 button's digital signal.
 
Trigger L2 (frc::EventLoop *loop=CommandScheduler::GetInstance() .GetDefaultButtonLoop()) const
 Constructs a Trigger instance around the left trigger 2 button's digital signal.
 
Trigger R2 (frc::EventLoop *loop=CommandScheduler::GetInstance() .GetDefaultButtonLoop()) const
 Constructs a Trigger instance around the right trigger 2 button's digital signal.
 
Trigger Create (frc::EventLoop *loop=CommandScheduler::GetInstance() .GetDefaultButtonLoop()) const
 Constructs a Trigger instance around the create button's digital signal.
 
Trigger Options (frc::EventLoop *loop=CommandScheduler::GetInstance() .GetDefaultButtonLoop()) const
 Constructs a Trigger instance around the options button's digital signal.
 
Trigger L3 (frc::EventLoop *loop=CommandScheduler::GetInstance() .GetDefaultButtonLoop()) const
 Constructs a Trigger instance around the L3 (left stick) button's digital signal.
 
Trigger R3 (frc::EventLoop *loop=CommandScheduler::GetInstance() .GetDefaultButtonLoop()) const
 Constructs a Trigger instance around the R3 (right stick) button's digital signal.
 
Trigger PS (frc::EventLoop *loop=CommandScheduler::GetInstance() .GetDefaultButtonLoop()) const
 Constructs a Trigger instance around the PlayStation button's digital signal.
 
Trigger Touchpad (frc::EventLoop *loop=CommandScheduler::GetInstance() .GetDefaultButtonLoop()) const
 Constructs a Trigger instance around the touchpad button's digital signal.
 
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 GetL2Axis () const
 Get the left trigger 2 axis value of the controller.
 
double GetR2Axis () const
 Get the right trigger 2 axis value of the controller.
 
- Public Member Functions inherited from frc2::CommandGenericHID
 CommandGenericHID (int port)
 Construct an instance of a device.
 
frc::GenericHIDGetHID ()
 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.
 

Detailed Description

A version of frc::PS5Controller with Trigger factories for command-based.

See also
frc::PS5Controller

Constructor & Destructor Documentation

◆ CommandPS5Controller()

frc2::CommandPS5Controller::CommandPS5Controller ( int port)
explicit

Construct an instance of a controller.

Parameters
portThe port index on the Driver Station that the controller is plugged into.

Member Function Documentation

◆ Circle()

Trigger frc2::CommandPS5Controller::Circle ( frc::EventLoop * loop = CommandScheduler::GetInstance() .GetDefaultButtonLoop()) const

Constructs a Trigger instance around the circle button's digital signal.

Parameters
loopthe event loop instance to attach the event to. Defaults to the CommandScheduler's default loop.
Returns
a Trigger instance representing the circle button's digital signal attached to the given loop.

◆ Create()

Trigger frc2::CommandPS5Controller::Create ( frc::EventLoop * loop = CommandScheduler::GetInstance() .GetDefaultButtonLoop()) const

Constructs a Trigger instance around the create button's digital signal.

Parameters
loopthe event loop instance to attach the event to. Defaults to the CommandScheduler's default loop.
Returns
a Trigger instance representing the create button's digital signal attached to the given loop.

◆ Cross()

Trigger frc2::CommandPS5Controller::Cross ( frc::EventLoop * loop = CommandScheduler::GetInstance() .GetDefaultButtonLoop()) const

Constructs a Trigger instance around the cross button's digital signal.

Parameters
loopthe event loop instance to attach the event to. Defaults to the CommandScheduler's default loop.
Returns
a Trigger instance representing the cross button's digital signal attached to the given loop.

◆ GetHID()

frc::PS5Controller & frc2::CommandPS5Controller::GetHID ( )

Get the underlying GenericHID object.

Returns
the wrapped GenericHID object

◆ GetL2Axis()

double frc2::CommandPS5Controller::GetL2Axis ( ) const

Get the left trigger 2 axis value of the controller.

Note that this axis is bound to the range of [0, 1] as opposed to the usual [-1, 1].

Returns
The axis value.

◆ GetLeftX()

double frc2::CommandPS5Controller::GetLeftX ( ) const

Get the X axis value of left side of the controller.

Returns
The axis value.

◆ GetLeftY()

double frc2::CommandPS5Controller::GetLeftY ( ) const

Get the Y axis value of left side of the controller.

Returns
The axis value.

◆ GetR2Axis()

double frc2::CommandPS5Controller::GetR2Axis ( ) const

Get the right trigger 2 axis value of the controller.

Note that this axis is bound to the range of [0, 1] as opposed to the usual [-1, 1].

Returns
The axis value.

◆ GetRightX()

double frc2::CommandPS5Controller::GetRightX ( ) const

Get the X axis value of right side of the controller.

Returns
The axis value.

◆ GetRightY()

double frc2::CommandPS5Controller::GetRightY ( ) const

Get the Y axis value of right side of the controller.

Returns
The axis value.

◆ L1()

Trigger frc2::CommandPS5Controller::L1 ( frc::EventLoop * loop = CommandScheduler::GetInstance() .GetDefaultButtonLoop()) const

Constructs a Trigger instance around the left trigger 1 button's digital signal.

Parameters
loopthe event loop instance to attach the event to. Defaults to the CommandScheduler's default loop.
Returns
a Trigger instance representing the left trigger 1 button's digital signal attached to the given loop.

◆ L2()

Trigger frc2::CommandPS5Controller::L2 ( frc::EventLoop * loop = CommandScheduler::GetInstance() .GetDefaultButtonLoop()) const

Constructs a Trigger instance around the left trigger 2 button's digital signal.

Parameters
loopthe event loop instance to attach the event to. Defaults to the CommandScheduler's default loop.
Returns
a Trigger instance representing the left trigger 2 button's digital signal attached to the given loop.

◆ L3()

Trigger frc2::CommandPS5Controller::L3 ( frc::EventLoop * loop = CommandScheduler::GetInstance() .GetDefaultButtonLoop()) const

Constructs a Trigger instance around the L3 (left stick) button's digital signal.

Parameters
loopthe event loop instance to attach the event to. Defaults to the CommandScheduler's default loop.
Returns
a Trigger instance representing the L3 (left stick) button's digital signal attached to the given loop.

◆ Options()

Trigger frc2::CommandPS5Controller::Options ( frc::EventLoop * loop = CommandScheduler::GetInstance() .GetDefaultButtonLoop()) const

Constructs a Trigger instance around the options button's digital signal.

Parameters
loopthe event loop instance to attach the event to. Defaults to the CommandScheduler's default loop.
Returns
a Trigger instance representing the options button's digital signal attached to the given loop.

◆ PS()

Trigger frc2::CommandPS5Controller::PS ( frc::EventLoop * loop = CommandScheduler::GetInstance() .GetDefaultButtonLoop()) const

Constructs a Trigger instance around the PlayStation button's digital signal.

Parameters
loopthe event loop instance to attach the event to. Defaults to the CommandScheduler's default loop.
Returns
a Trigger instance representing the PlayStation button's digital signal attached to the given loop.

◆ R1()

Trigger frc2::CommandPS5Controller::R1 ( frc::EventLoop * loop = CommandScheduler::GetInstance() .GetDefaultButtonLoop()) const

Constructs a Trigger instance around the right trigger 1 button's digital signal.

Parameters
loopthe event loop instance to attach the event to. Defaults to the CommandScheduler's default loop.
Returns
a Trigger instance representing the right trigger 1 button's digital signal attached to the given loop.

◆ R2()

Trigger frc2::CommandPS5Controller::R2 ( frc::EventLoop * loop = CommandScheduler::GetInstance() .GetDefaultButtonLoop()) const

Constructs a Trigger instance around the right trigger 2 button's digital signal.

Parameters
loopthe event loop instance to attach the event to. Defaults to the CommandScheduler's default loop.
Returns
a Trigger instance representing the right trigger 2 button's digital signal attached to the given loop.

◆ R3()

Trigger frc2::CommandPS5Controller::R3 ( frc::EventLoop * loop = CommandScheduler::GetInstance() .GetDefaultButtonLoop()) const

Constructs a Trigger instance around the R3 (right stick) button's digital signal.

Parameters
loopthe event loop instance to attach the event to. Defaults to the CommandScheduler's default loop.
Returns
a Trigger instance representing the R3 (right stick) button's digital signal attached to the given loop.

◆ Square()

Trigger frc2::CommandPS5Controller::Square ( frc::EventLoop * loop = CommandScheduler::GetInstance() .GetDefaultButtonLoop()) const

Constructs a Trigger instance around the square button's digital signal.

Parameters
loopthe event loop instance to attach the event to. Defaults to the CommandScheduler's default loop.
Returns
a Trigger instance representing the square button's digital signal attached to the given loop.

◆ Touchpad()

Trigger frc2::CommandPS5Controller::Touchpad ( frc::EventLoop * loop = CommandScheduler::GetInstance() .GetDefaultButtonLoop()) const

Constructs a Trigger instance around the touchpad button's digital signal.

Parameters
loopthe event loop instance to attach the event to. Defaults to the CommandScheduler's default loop.
Returns
a Trigger instance representing the touchpad button's digital signal attached to the given loop.

◆ Triangle()

Trigger frc2::CommandPS5Controller::Triangle ( frc::EventLoop * loop = CommandScheduler::GetInstance() .GetDefaultButtonLoop()) const

Constructs a Trigger instance around the triangle button's digital signal.

Parameters
loopthe event loop instance to attach the event to. Defaults to the CommandScheduler's default loop.
Returns
a Trigger instance representing the triangle button's digital signal attached to the given loop.

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