WPILibC++ 2024.3.2
frc::sim::PS4ControllerSim Class Reference

Class to control a simulated PS4 controller. More...

#include <frc/simulation/PS4ControllerSim.h>

Inheritance diagram for frc::sim::PS4ControllerSim:
frc::sim::GenericHIDSim

Public Member Functions

 PS4ControllerSim (const PS4Controller &joystick)
 Constructs from a PS4Controller object. More...
 
 PS4ControllerSim (int port)
 Constructs from a joystick port number. More...
 
void SetLeftX (double value)
 Change the X axis value of the controller's left stick. More...
 
void SetRightX (double value)
 Change the X axis value of the controller's right stick. More...
 
void SetLeftY (double value)
 Change the Y axis value of the controller's left stick. More...
 
void SetRightY (double value)
 Change the Y axis value of the controller's right stick. More...
 
void SetL2Axis (double value)
 Change the L2 axis axis value of the controller. More...
 
void SetR2Axis (double value)
 Change the R2 axis value of the controller. More...
 
void SetSquareButton (bool value)
 Change the value of the Square button on the controller. More...
 
void SetCrossButton (bool value)
 Change the value of the Cross button on the controller. More...
 
void SetCircleButton (bool value)
 Change the value of the Circle button on the controller. More...
 
void SetTriangleButton (bool value)
 Change the value of the Triangle button on the controller. More...
 
void SetL1Button (bool value)
 Change the value of the L1 button on the controller. More...
 
void SetR1Button (bool value)
 Change the value of the R1 button on the controller. More...
 
void SetL2Button (bool value)
 Change the value of the L2 button on the controller. More...
 
void SetR2Button (bool value)
 Change the value of the R2 button on the controller. More...
 
void SetShareButton (bool value)
 Change the value of the Share button on the controller. More...
 
void SetOptionsButton (bool value)
 Change the value of the Options button on the controller. More...
 
void SetL3Button (bool value)
 Change the value of the L3 (left stick) button on the controller. More...
 
void SetR3Button (bool value)
 Change the value of the R3 (right stick) button on the controller. More...
 
void SetPSButton (bool value)
 Change the value of the PS button on the controller. More...
 
void SetTouchpad (bool value)
 Change the value of the touchpad button on the controller. More...
 
- Public Member Functions inherited from frc::sim::GenericHIDSim
 GenericHIDSim (const GenericHID &joystick)
 Constructs from a GenericHID object. More...
 
 GenericHIDSim (int port)
 Constructs from a joystick port number. More...
 
void NotifyNewData ()
 Updates joystick data so that new values are visible to the user program. More...
 
void SetRawButton (int button, bool value)
 Set the value of a given button. More...
 
void SetRawAxis (int axis, double value)
 Set the value of a given axis. More...
 
void SetPOV (int pov, int value)
 Set the value of a given POV. More...
 
void SetPOV (int value)
 Set the value of the default POV (port 0). More...
 
void SetAxisCount (int count)
 Set the axis count of this device. More...
 
void SetPOVCount (int count)
 Set the POV count of this device. More...
 
void SetButtonCount (int count)
 Set the button count of this device. More...
 
void SetType (GenericHID::HIDType type)
 Set the type of this device. More...
 
void SetName (const char *name)
 Set the name of this device. More...
 
void SetAxisType (int axis, int type)
 Set the type of an axis. More...
 
bool GetOutput (int outputNumber)
 Read the output of a button. More...
 
int64_t GetOutputs ()
 Get the encoded 16-bit integer that passes button values. More...
 
double GetRumble (GenericHID::RumbleType type)
 Get the joystick rumble. More...
 

Additional Inherited Members

- Protected Attributes inherited from frc::sim::GenericHIDSim
int m_port
 GenericHID port. More...
 

Detailed Description

Class to control a simulated PS4 controller.

Constructor & Destructor Documentation

◆ PS4ControllerSim() [1/2]

frc::sim::PS4ControllerSim::PS4ControllerSim ( const PS4Controller joystick)
explicit

Constructs from a PS4Controller object.

Parameters
joystickcontroller to simulate

◆ PS4ControllerSim() [2/2]

frc::sim::PS4ControllerSim::PS4ControllerSim ( int  port)
explicit

Constructs from a joystick port number.

Parameters
portport number

Member Function Documentation

◆ SetCircleButton()

void frc::sim::PS4ControllerSim::SetCircleButton ( bool  value)

Change the value of the Circle button on the controller.

Parameters
valuethe new value

◆ SetCrossButton()

void frc::sim::PS4ControllerSim::SetCrossButton ( bool  value)

Change the value of the Cross button on the controller.

Parameters
valuethe new value

◆ SetL1Button()

void frc::sim::PS4ControllerSim::SetL1Button ( bool  value)

Change the value of the L1 button on the controller.

Parameters
valuethe new value

◆ SetL2Axis()

void frc::sim::PS4ControllerSim::SetL2Axis ( double  value)

Change the L2 axis axis value of the controller.

Parameters
valuethe new value

◆ SetL2Button()

void frc::sim::PS4ControllerSim::SetL2Button ( bool  value)

Change the value of the L2 button on the controller.

Parameters
valuethe new value

◆ SetL3Button()

void frc::sim::PS4ControllerSim::SetL3Button ( bool  value)

Change the value of the L3 (left stick) button on the controller.

Parameters
valuethe new value

◆ SetLeftX()

void frc::sim::PS4ControllerSim::SetLeftX ( double  value)

Change the X axis value of the controller's left stick.

Parameters
valuethe new value

◆ SetLeftY()

void frc::sim::PS4ControllerSim::SetLeftY ( double  value)

Change the Y axis value of the controller's left stick.

Parameters
valuethe new value

◆ SetOptionsButton()

void frc::sim::PS4ControllerSim::SetOptionsButton ( bool  value)

Change the value of the Options button on the controller.

Parameters
valuethe new value

◆ SetPSButton()

void frc::sim::PS4ControllerSim::SetPSButton ( bool  value)

Change the value of the PS button on the controller.

Parameters
valuethe new value

◆ SetR1Button()

void frc::sim::PS4ControllerSim::SetR1Button ( bool  value)

Change the value of the R1 button on the controller.

Parameters
valuethe new value

◆ SetR2Axis()

void frc::sim::PS4ControllerSim::SetR2Axis ( double  value)

Change the R2 axis value of the controller.

Parameters
valuethe new value

◆ SetR2Button()

void frc::sim::PS4ControllerSim::SetR2Button ( bool  value)

Change the value of the R2 button on the controller.

Parameters
valuethe new value

◆ SetR3Button()

void frc::sim::PS4ControllerSim::SetR3Button ( bool  value)

Change the value of the R3 (right stick) button on the controller.

Parameters
valuethe new value

◆ SetRightX()

void frc::sim::PS4ControllerSim::SetRightX ( double  value)

Change the X axis value of the controller's right stick.

Parameters
valuethe new value

◆ SetRightY()

void frc::sim::PS4ControllerSim::SetRightY ( double  value)

Change the Y axis value of the controller's right stick.

Parameters
valuethe new value

◆ SetShareButton()

void frc::sim::PS4ControllerSim::SetShareButton ( bool  value)

Change the value of the Share button on the controller.

Parameters
valuethe new value

◆ SetSquareButton()

void frc::sim::PS4ControllerSim::SetSquareButton ( bool  value)

Change the value of the Square button on the controller.

Parameters
valuethe new value

◆ SetTouchpad()

void frc::sim::PS4ControllerSim::SetTouchpad ( bool  value)

Change the value of the touchpad button on the controller.

Parameters
valuethe new value

◆ SetTriangleButton()

void frc::sim::PS4ControllerSim::SetTriangleButton ( bool  value)

Change the value of the Triangle button on the controller.

Parameters
valuethe new value

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