WPILibC++ 2023.4.3-108-ge5452e3
frc::sim::JoystickSim Class Reference

Class to control a simulated joystick. More...

#include <frc/simulation/JoystickSim.h>

Inheritance diagram for frc::sim::JoystickSim:
frc::sim::GenericHIDSim

Public Member Functions

 JoystickSim (const Joystick &joystick)
 Constructs from a Joystick object. More...
 
 JoystickSim (int port)
 Constructs from a joystick port number. More...
 
void SetX (double value)
 Set the X value of the joystick. More...
 
void SetY (double value)
 Set the Y value of the joystick. More...
 
void SetZ (double value)
 Set the Z value of the joystick. More...
 
void SetTwist (double value)
 Set the twist value of the joystick. More...
 
void SetThrottle (double value)
 Set the throttle value of the joystick. More...
 
void SetTrigger (bool state)
 Set the trigger value of the joystick. More...
 
void SetTop (bool state)
 Set the top state 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
 

Detailed Description

Class to control a simulated joystick.

Constructor & Destructor Documentation

◆ JoystickSim() [1/2]

frc::sim::JoystickSim::JoystickSim ( const Joystick joystick)
explicit

Constructs from a Joystick object.

Parameters
joystickjoystick to simulate

◆ JoystickSim() [2/2]

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

Constructs from a joystick port number.

Parameters
portport number

Member Function Documentation

◆ SetThrottle()

void frc::sim::JoystickSim::SetThrottle ( double  value)

Set the throttle value of the joystick.

Parameters
valuethe new throttle value

◆ SetTop()

void frc::sim::JoystickSim::SetTop ( bool  state)

Set the top state of the joystick.

Parameters
statethe new state

◆ SetTrigger()

void frc::sim::JoystickSim::SetTrigger ( bool  state)

Set the trigger value of the joystick.

Parameters
statethe new value

◆ SetTwist()

void frc::sim::JoystickSim::SetTwist ( double  value)

Set the twist value of the joystick.

Parameters
valuethe new twist value

◆ SetX()

void frc::sim::JoystickSim::SetX ( double  value)

Set the X value of the joystick.

Parameters
valuethe new X value

◆ SetY()

void frc::sim::JoystickSim::SetY ( double  value)

Set the Y value of the joystick.

Parameters
valuethe new Y value

◆ SetZ()

void frc::sim::JoystickSim::SetZ ( double  value)

Set the Z value of the joystick.

Parameters
valuethe new Z value

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