WPILibC++ 2024.3.1
frc::sim::DriverStationSim Class Reference

Class to control a simulated driver station. More...

#include <frc/simulation/DriverStationSim.h>

Static Public Member Functions

static std::unique_ptr< CallbackStoreRegisterEnabledCallback (NotifyCallback callback, bool initialNotify)
 Register a callback on whether the DS is enabled. More...
 
static bool GetEnabled ()
 Check if the DS is enabled. More...
 
static void SetEnabled (bool enabled)
 Change whether the DS is enabled. More...
 
static std::unique_ptr< CallbackStoreRegisterAutonomousCallback (NotifyCallback callback, bool initialNotify)
 Register a callback on whether the DS is in autonomous mode. More...
 
static bool GetAutonomous ()
 Check if the DS is in autonomous. More...
 
static void SetAutonomous (bool autonomous)
 Change whether the DS is in autonomous. More...
 
static std::unique_ptr< CallbackStoreRegisterTestCallback (NotifyCallback callback, bool initialNotify)
 Register a callback on whether the DS is in test mode. More...
 
static bool GetTest ()
 Check if the DS is in test. More...
 
static void SetTest (bool test)
 Change whether the DS is in test. More...
 
static std::unique_ptr< CallbackStoreRegisterEStopCallback (NotifyCallback callback, bool initialNotify)
 Register a callback on the eStop state. More...
 
static bool GetEStop ()
 Check if eStop has been activated. More...
 
static void SetEStop (bool eStop)
 Set whether eStop is active. More...
 
static std::unique_ptr< CallbackStoreRegisterFmsAttachedCallback (NotifyCallback callback, bool initialNotify)
 Register a callback on whether the FMS is connected. More...
 
static bool GetFmsAttached ()
 Check if the FMS is connected. More...
 
static void SetFmsAttached (bool fmsAttached)
 Change whether the FMS is connected. More...
 
static std::unique_ptr< CallbackStoreRegisterDsAttachedCallback (NotifyCallback callback, bool initialNotify)
 Register a callback on whether the DS is connected. More...
 
static bool GetDsAttached ()
 Check if the DS is attached. More...
 
static void SetDsAttached (bool dsAttached)
 Change whether the DS is attached. More...
 
static std::unique_ptr< CallbackStoreRegisterAllianceStationIdCallback (NotifyCallback callback, bool initialNotify)
 Register a callback on the alliance station ID. More...
 
static HAL_AllianceStationID GetAllianceStationId ()
 Get the alliance station ID (color + number). More...
 
static void SetAllianceStationId (HAL_AllianceStationID allianceStationId)
 Change the alliance station. More...
 
static std::unique_ptr< CallbackStoreRegisterMatchTimeCallback (NotifyCallback callback, bool initialNotify)
 Register a callback on match time. More...
 
static double GetMatchTime ()
 Get the current value of the match timer. More...
 
static void SetMatchTime (double matchTime)
 Sets the match timer. More...
 
static void NotifyNewData ()
 Updates DriverStation data so that new values are visible to the user program. More...
 
static void SetSendError (bool shouldSend)
 Sets suppression of DriverStation::ReportError and ReportWarning messages. More...
 
static void SetSendConsoleLine (bool shouldSend)
 Sets suppression of DriverStation::SendConsoleLine messages. More...
 
static int64_t GetJoystickOutputs (int stick)
 Gets the joystick outputs. More...
 
static int GetJoystickRumble (int stick, int rumbleNum)
 Gets the joystick rumble. More...
 
static void SetJoystickButton (int stick, int button, bool state)
 Sets the state of one joystick button. More...
 
static void SetJoystickAxis (int stick, int axis, double value)
 Gets the value of the axis on a joystick. More...
 
static void SetJoystickPOV (int stick, int pov, int value)
 Gets the state of a POV on a joystick. More...
 
static void SetJoystickButtons (int stick, uint32_t buttons)
 Sets the state of all the buttons on a joystick. More...
 
static void SetJoystickAxisCount (int stick, int count)
 Sets the number of axes for a joystick. More...
 
static void SetJoystickPOVCount (int stick, int count)
 Sets the number of POVs for a joystick. More...
 
static void SetJoystickButtonCount (int stick, int count)
 Sets the number of buttons for a joystick. More...
 
static void SetJoystickIsXbox (int stick, bool isXbox)
 Sets the value of isXbox for a joystick. More...
 
static void SetJoystickType (int stick, int type)
 Sets the value of type for a joystick. More...
 
static void SetJoystickName (int stick, std::string_view name)
 Sets the name of a joystick. More...
 
static void SetJoystickAxisType (int stick, int axis, int type)
 Sets the types of Axes for a joystick. More...
 
static void SetGameSpecificMessage (std::string_view message)
 Sets the game specific message. More...
 
static void SetEventName (std::string_view name)
 Sets the event name. More...
 
static void SetMatchType (DriverStation::MatchType type)
 Sets the match type. More...
 
static void SetMatchNumber (int matchNumber)
 Sets the match number. More...
 
static void SetReplayNumber (int replayNumber)
 Sets the replay number. More...
 
static void ResetData ()
 Reset all simulation data for the Driver Station. More...
 

Detailed Description

Class to control a simulated driver station.

Member Function Documentation

◆ GetAllianceStationId()

static HAL_AllianceStationID frc::sim::DriverStationSim::GetAllianceStationId ( )
static

Get the alliance station ID (color + number).

Returns
the alliance station color and number

◆ GetAutonomous()

static bool frc::sim::DriverStationSim::GetAutonomous ( )
static

Check if the DS is in autonomous.

Returns
true if autonomous

◆ GetDsAttached()

static bool frc::sim::DriverStationSim::GetDsAttached ( )
static

Check if the DS is attached.

Returns
true if attached

◆ GetEnabled()

static bool frc::sim::DriverStationSim::GetEnabled ( )
static

Check if the DS is enabled.

Returns
true if enabled

◆ GetEStop()

static bool frc::sim::DriverStationSim::GetEStop ( )
static

Check if eStop has been activated.

Returns
true if eStopped

◆ GetFmsAttached()

static bool frc::sim::DriverStationSim::GetFmsAttached ( )
static

Check if the FMS is connected.

Returns
true if FMS is connected

◆ GetJoystickOutputs()

static int64_t frc::sim::DriverStationSim::GetJoystickOutputs ( int  stick)
static

Gets the joystick outputs.

Parameters
stickThe joystick number
Returns
The joystick outputs

◆ GetJoystickRumble()

static int frc::sim::DriverStationSim::GetJoystickRumble ( int  stick,
int  rumbleNum 
)
static

Gets the joystick rumble.

Parameters
stickThe joystick number
rumbleNumRumble to get (0=left, 1=right)
Returns
The joystick rumble value

◆ GetMatchTime()

static double frc::sim::DriverStationSim::GetMatchTime ( )
static

Get the current value of the match timer.

Returns
the current match time

◆ GetTest()

static bool frc::sim::DriverStationSim::GetTest ( )
static

Check if the DS is in test.

Returns
true if test

◆ NotifyNewData()

static void frc::sim::DriverStationSim::NotifyNewData ( )
static

Updates DriverStation data so that new values are visible to the user program.

◆ RegisterAllianceStationIdCallback()

static std::unique_ptr< CallbackStore > frc::sim::DriverStationSim::RegisterAllianceStationIdCallback ( NotifyCallback  callback,
bool  initialNotify 
)
static

Register a callback on the alliance station ID.

Parameters
callbackthe callback that will be called whenever the alliance station changes
initialNotifyif true, the callback will be run on the initial value
Returns
the CallbackStore object associated with this callback

◆ RegisterAutonomousCallback()

static std::unique_ptr< CallbackStore > frc::sim::DriverStationSim::RegisterAutonomousCallback ( NotifyCallback  callback,
bool  initialNotify 
)
static

Register a callback on whether the DS is in autonomous mode.

Parameters
callbackthe callback that will be called on autonomous mode entrance/exit
initialNotifyif true, the callback will be run on the initial value
Returns
the CallbackStore object associated with this callback

◆ RegisterDsAttachedCallback()

static std::unique_ptr< CallbackStore > frc::sim::DriverStationSim::RegisterDsAttachedCallback ( NotifyCallback  callback,
bool  initialNotify 
)
static

Register a callback on whether the DS is connected.

Parameters
callbackthe callback that will be called whenever the DS connection changes
initialNotifyif true, the callback will be run on the initial value
Returns
the CallbackStore object associated with this callback

◆ RegisterEnabledCallback()

static std::unique_ptr< CallbackStore > frc::sim::DriverStationSim::RegisterEnabledCallback ( NotifyCallback  callback,
bool  initialNotify 
)
static

Register a callback on whether the DS is enabled.

Parameters
callbackthe callback that will be called whenever the enabled state is changed
initialNotifyif true, the callback will be run on the initial value
Returns
the CallbackStore object associated with this callback

◆ RegisterEStopCallback()

static std::unique_ptr< CallbackStore > frc::sim::DriverStationSim::RegisterEStopCallback ( NotifyCallback  callback,
bool  initialNotify 
)
static

Register a callback on the eStop state.

Parameters
callbackthe callback that will be called whenever the eStop state changes
initialNotifyif true, the callback will be run on the initial value
Returns
the CallbackStore object associated with this callback

◆ RegisterFmsAttachedCallback()

static std::unique_ptr< CallbackStore > frc::sim::DriverStationSim::RegisterFmsAttachedCallback ( NotifyCallback  callback,
bool  initialNotify 
)
static

Register a callback on whether the FMS is connected.

Parameters
callbackthe callback that will be called whenever the FMS connection changes
initialNotifyif true, the callback will be run on the initial value
Returns
the CallbackStore object associated with this callback

◆ RegisterMatchTimeCallback()

static std::unique_ptr< CallbackStore > frc::sim::DriverStationSim::RegisterMatchTimeCallback ( NotifyCallback  callback,
bool  initialNotify 
)
static

Register a callback on match time.

Parameters
callbackthe callback that will be called whenever match time changes
initialNotifyif true, the callback will be run on the initial value
Returns
the CallbackStore object associated with this callback

◆ RegisterTestCallback()

static std::unique_ptr< CallbackStore > frc::sim::DriverStationSim::RegisterTestCallback ( NotifyCallback  callback,
bool  initialNotify 
)
static

Register a callback on whether the DS is in test mode.

Parameters
callbackthe callback that will be called whenever the test mode is entered or left
initialNotifyif true, the callback will be run on the initial value
Returns
the CallbackStore object associated with this callback

◆ ResetData()

static void frc::sim::DriverStationSim::ResetData ( )
static

Reset all simulation data for the Driver Station.

◆ SetAllianceStationId()

static void frc::sim::DriverStationSim::SetAllianceStationId ( HAL_AllianceStationID  allianceStationId)
static

Change the alliance station.

Parameters
allianceStationIdthe new alliance station

◆ SetAutonomous()

static void frc::sim::DriverStationSim::SetAutonomous ( bool  autonomous)
static

Change whether the DS is in autonomous.

Parameters
autonomousthe new value

◆ SetDsAttached()

static void frc::sim::DriverStationSim::SetDsAttached ( bool  dsAttached)
static

Change whether the DS is attached.

Parameters
dsAttachedthe new value

◆ SetEnabled()

static void frc::sim::DriverStationSim::SetEnabled ( bool  enabled)
static

Change whether the DS is enabled.

Parameters
enabledthe new value

◆ SetEStop()

static void frc::sim::DriverStationSim::SetEStop ( bool  eStop)
static

Set whether eStop is active.

Parameters
eStoptrue to activate

◆ SetEventName()

static void frc::sim::DriverStationSim::SetEventName ( std::string_view  name)
static

Sets the event name.

Parameters
namethe event name

◆ SetFmsAttached()

static void frc::sim::DriverStationSim::SetFmsAttached ( bool  fmsAttached)
static

Change whether the FMS is connected.

Parameters
fmsAttachedthe new value

◆ SetGameSpecificMessage()

static void frc::sim::DriverStationSim::SetGameSpecificMessage ( std::string_view  message)
static

Sets the game specific message.

Parameters
messagethe game specific message

◆ SetJoystickAxis()

static void frc::sim::DriverStationSim::SetJoystickAxis ( int  stick,
int  axis,
double  value 
)
static

Gets the value of the axis on a joystick.

Parameters
stickThe joystick number
axisThe analog axis number
valueThe value of the axis on the joystick

◆ SetJoystickAxisCount()

static void frc::sim::DriverStationSim::SetJoystickAxisCount ( int  stick,
int  count 
)
static

Sets the number of axes for a joystick.

Parameters
stickThe joystick number
countThe number of axes on the indicated joystick

◆ SetJoystickAxisType()

static void frc::sim::DriverStationSim::SetJoystickAxisType ( int  stick,
int  axis,
int  type 
)
static

Sets the types of Axes for a joystick.

Parameters
stickThe joystick number
axisThe target axis
typeThe type of axis

◆ SetJoystickButton()

static void frc::sim::DriverStationSim::SetJoystickButton ( int  stick,
int  button,
bool  state 
)
static

Sets the state of one joystick button.

Button indexes begin at 1.

Parameters
stickThe joystick number
buttonThe button index, beginning at 1
stateThe state of the joystick button

◆ SetJoystickButtonCount()

static void frc::sim::DriverStationSim::SetJoystickButtonCount ( int  stick,
int  count 
)
static

Sets the number of buttons for a joystick.

Parameters
stickThe joystick number
countThe number of buttons on the indicated joystick

◆ SetJoystickButtons()

static void frc::sim::DriverStationSim::SetJoystickButtons ( int  stick,
uint32_t  buttons 
)
static

Sets the state of all the buttons on a joystick.

Parameters
stickThe joystick number
buttonsThe bitmap state of the buttons on the joystick

◆ SetJoystickIsXbox()

static void frc::sim::DriverStationSim::SetJoystickIsXbox ( int  stick,
bool  isXbox 
)
static

Sets the value of isXbox for a joystick.

Parameters
stickThe joystick number
isXboxThe value of isXbox

◆ SetJoystickName()

static void frc::sim::DriverStationSim::SetJoystickName ( int  stick,
std::string_view  name 
)
static

Sets the name of a joystick.

Parameters
stickThe joystick number
nameThe value of name

◆ SetJoystickPOV()

static void frc::sim::DriverStationSim::SetJoystickPOV ( int  stick,
int  pov,
int  value 
)
static

Gets the state of a POV on a joystick.

Parameters
stickThe joystick number
povThe POV number
valuethe angle of the POV in degrees, or -1 for not pressed

◆ SetJoystickPOVCount()

static void frc::sim::DriverStationSim::SetJoystickPOVCount ( int  stick,
int  count 
)
static

Sets the number of POVs for a joystick.

Parameters
stickThe joystick number
countThe number of POVs on the indicated joystick

◆ SetJoystickType()

static void frc::sim::DriverStationSim::SetJoystickType ( int  stick,
int  type 
)
static

Sets the value of type for a joystick.

Parameters
stickThe joystick number
typeThe value of type

◆ SetMatchNumber()

static void frc::sim::DriverStationSim::SetMatchNumber ( int  matchNumber)
static

Sets the match number.

Parameters
matchNumberthe match number

◆ SetMatchTime()

static void frc::sim::DriverStationSim::SetMatchTime ( double  matchTime)
static

Sets the match timer.

Parameters
matchTimethe new match time

◆ SetMatchType()

static void frc::sim::DriverStationSim::SetMatchType ( DriverStation::MatchType  type)
static

Sets the match type.

Parameters
typethe match type

◆ SetReplayNumber()

static void frc::sim::DriverStationSim::SetReplayNumber ( int  replayNumber)
static

Sets the replay number.

Parameters
replayNumberthe replay number

◆ SetSendConsoleLine()

static void frc::sim::DriverStationSim::SetSendConsoleLine ( bool  shouldSend)
static

Sets suppression of DriverStation::SendConsoleLine messages.

Parameters
shouldSendIf false then messages will be suppressed.

◆ SetSendError()

static void frc::sim::DriverStationSim::SetSendError ( bool  shouldSend)
static

Sets suppression of DriverStation::ReportError and ReportWarning messages.

Parameters
shouldSendIf false then messages will be suppressed.

◆ SetTest()

static void frc::sim::DriverStationSim::SetTest ( bool  test)
static

Change whether the DS is in test.

Parameters
testthe new value

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