WPILibC++ 2025.0.0-alpha-1-14-g3b6f38d
frc::sim::XboxControllerSim Class Reference

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

#include <frc/simulation/XboxControllerSim.h>

Inheritance diagram for frc::sim::XboxControllerSim:
frc::sim::GenericHIDSim

Public Member Functions

 XboxControllerSim (const XboxController &joystick)
 Constructs from a XboxController object. More...
 
 XboxControllerSim (int port)
 Constructs from a joystick port number. More...
 
void SetLeftX (double value)
 Change the left X value of the controller's joystick. More...
 
void SetRightX (double value)
 Change the right X value of the controller's joystick. More...
 
void SetLeftY (double value)
 Change the left Y value of the controller's joystick. More...
 
void SetRightY (double value)
 Change the right Y value of the controller's joystick. More...
 
void SetLeftTriggerAxis (double value)
 Change the value of the left trigger axis on the controller. More...
 
void SetRightTriggerAxis (double value)
 Change the value of the right trigger axis on the controller. More...
 
void SetAButton (bool value)
 Change the value of the A button on the controller. More...
 
void SetBButton (bool value)
 Change the value of the B button on the controller. More...
 
void SetXButton (bool value)
 Change the value of the X button on the controller. More...
 
void SetYButton (bool value)
 Change the value of the Y button on the controller. More...
 
void SetLeftBumperButton (bool value)
 Change the value of the left bumper button on the controller. More...
 
void SetRightBumperButton (bool value)
 Change the value of the right bumper button on the controller. More...
 
void SetBackButton (bool value)
 Change the value of the back button on the controller. More...
 
void SetStartButton (bool value)
 Change the value of the start button on the controller. More...
 
void SetLeftStickButton (bool value)
 Change the value of the left stick button on the controller. More...
 
void SetRightStickButton (bool value)
 Change the value of the right stick button on the controller. More...
 
void SetLeftBumper (bool value)
 Change the left bumper value of the joystick. More...
 
void SetRightBumper (bool value)
 Change the right bumper value of the joystick. 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 Xbox controller.

Constructor & Destructor Documentation

◆ XboxControllerSim() [1/2]

frc::sim::XboxControllerSim::XboxControllerSim ( const XboxController joystick)
explicit

Constructs from a XboxController object.

Parameters
joystickcontroller to simulate

◆ XboxControllerSim() [2/2]

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

Constructs from a joystick port number.

Parameters
portport number

Member Function Documentation

◆ SetAButton()

void frc::sim::XboxControllerSim::SetAButton ( bool  value)

Change the value of the A button on the controller.

Parameters
valuethe new value

◆ SetBackButton()

void frc::sim::XboxControllerSim::SetBackButton ( bool  value)

Change the value of the back button on the controller.

Parameters
valuethe new value

◆ SetBButton()

void frc::sim::XboxControllerSim::SetBButton ( bool  value)

Change the value of the B button on the controller.

Parameters
valuethe new value

◆ SetLeftBumper()

void frc::sim::XboxControllerSim::SetLeftBumper ( bool  value)

Change the left bumper value of the joystick.

Parameters
valuethe new value

◆ SetLeftBumperButton()

void frc::sim::XboxControllerSim::SetLeftBumperButton ( bool  value)

Change the value of the left bumper button on the controller.

Parameters
valuethe new value

◆ SetLeftStickButton()

void frc::sim::XboxControllerSim::SetLeftStickButton ( bool  value)

Change the value of the left stick button on the controller.

Parameters
valuethe new value

◆ SetLeftTriggerAxis()

void frc::sim::XboxControllerSim::SetLeftTriggerAxis ( double  value)

Change the value of the left trigger axis on the controller.

Parameters
valuethe new value

◆ SetLeftX()

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

Change the left X value of the controller's joystick.

Parameters
valuethe new value

◆ SetLeftY()

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

Change the left Y value of the controller's joystick.

Parameters
valuethe new value

◆ SetRightBumper()

void frc::sim::XboxControllerSim::SetRightBumper ( bool  value)

Change the right bumper value of the joystick.

Parameters
valuethe new value

◆ SetRightBumperButton()

void frc::sim::XboxControllerSim::SetRightBumperButton ( bool  value)

Change the value of the right bumper button on the controller.

Parameters
valuethe new value

◆ SetRightStickButton()

void frc::sim::XboxControllerSim::SetRightStickButton ( bool  value)

Change the value of the right stick button on the controller.

Parameters
valuethe new value

◆ SetRightTriggerAxis()

void frc::sim::XboxControllerSim::SetRightTriggerAxis ( double  value)

Change the value of the right trigger axis on the controller.

Parameters
valuethe new value

◆ SetRightX()

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

Change the right X value of the controller's joystick.

Parameters
valuethe new value

◆ SetRightY()

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

Change the right Y value of the controller's joystick.

Parameters
valuethe new value

◆ SetStartButton()

void frc::sim::XboxControllerSim::SetStartButton ( bool  value)

Change the value of the start button on the controller.

Parameters
valuethe new value

◆ SetXButton()

void frc::sim::XboxControllerSim::SetXButton ( bool  value)

Change the value of the X button on the controller.

Parameters
valuethe new value

◆ SetYButton()

void frc::sim::XboxControllerSim::SetYButton ( bool  value)

Change the value of the Y button on the controller.

Parameters
valuethe new value

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