WPILibC++ 2027.0.0-alpha-4
Loading...
Searching...
No Matches
wpi::sim::DriverStationSim Class Reference

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

#include <wpi/simulation/DriverStationSim.hpp>

Static Public Member Functions

static std::unique_ptr< CallbackStoreRegisterEnabledCallback (NotifyCallback callback, bool initialNotify)
 Register a callback on whether the DS is enabled.
static bool GetEnabled ()
 Check if the DS is enabled.
static void SetEnabled (bool enabled)
 Change whether the DS is enabled.
static std::unique_ptr< CallbackStoreRegisterRobotModeCallback (NotifyCallback callback, bool initialNotify)
 Register a callback on DS robot mode changes.
static HAL_RobotMode GetRobotMode ()
 Get the robot mode set by the DS.
static void SetRobotMode (HAL_RobotMode robotMode)
 Change the robot mode set by the DS.
static std::unique_ptr< CallbackStoreRegisterEStopCallback (NotifyCallback callback, bool initialNotify)
 Register a callback on the eStop state.
static bool GetEStop ()
 Check if eStop has been activated.
static void SetEStop (bool eStop)
 Set whether eStop is active.
static std::unique_ptr< CallbackStoreRegisterFmsAttachedCallback (NotifyCallback callback, bool initialNotify)
 Register a callback on whether the FMS is connected.
static bool GetFmsAttached ()
 Check if the FMS is connected.
static void SetFmsAttached (bool fmsAttached)
 Change whether the FMS is connected.
static std::unique_ptr< CallbackStoreRegisterDsAttachedCallback (NotifyCallback callback, bool initialNotify)
 Register a callback on whether the DS is connected.
static bool GetDsAttached ()
 Check if the DS is attached.
static void SetDsAttached (bool dsAttached)
 Change whether the DS is attached.
static std::unique_ptr< CallbackStoreRegisterAllianceStationIdCallback (NotifyCallback callback, bool initialNotify)
 Register a callback on the alliance station ID.
static HAL_AllianceStationID GetAllianceStationId ()
 Get the alliance station ID (color + number).
static void SetAllianceStationId (HAL_AllianceStationID allianceStationId)
 Change the alliance station.
static std::unique_ptr< CallbackStoreRegisterMatchTimeCallback (NotifyCallback callback, bool initialNotify)
 Register a callback on match time.
static double GetMatchTime ()
 Get the current value of the match timer.
static void SetMatchTime (double matchTime)
 Sets the match timer.
static std::unique_ptr< CallbackStoreRegisterOpModeCallback (NotifyCallback callback, bool initialNotify)
 Register a callback on DS opmode changes.
static int64_t GetOpMode ()
 Get the opmode set by the DS.
static void SetOpMode (int64_t opmode)
 Change the opmode set by the DS.
static std::unique_ptr< CallbackStoreRegisterOpModeOptionsCallback (OpModeOptionsCallback callback, bool initialNotify)
 Register a callback on opmode options changes.
static OpModeOptions GetOpModeOptions ()
 Gets the list of opmode options.
static void NotifyNewData ()
 Updates DriverStation data so that new values are visible to the user program.
static void SetSendError (bool shouldSend)
 Sets suppression of DriverStation::ReportError and ReportWarning messages.
static void SetSendConsoleLine (bool shouldSend)
 Sets suppression of DriverStation::SendConsoleLine messages.
static int32_t GetJoystickLeds (int stick)
 Gets the joystick outputs.
static int GetJoystickRumble (int stick, int rumbleNum)
 Gets the joystick rumble.
static void SetJoystickButton (int stick, int button, bool state)
 Sets the state of one joystick button.
static void SetJoystickAxis (int stick, int axis, double value)
 Gets the value of the axis on a joystick.
static void SetJoystickPOV (int stick, int pov, DriverStation::POVDirection value)
 Gets the state of a POV on a joystick.
static void SetJoystickAxesMaximumIndex (int stick, int maximumIndex)
 Sets the number of axes for a joystick.
static void SetJoystickAxesAvailable (int stick, int available)
 Sets the number of axes for a joystick.
static void SetJoystickPOVsMaximumIndex (int stick, int maximumIndex)
 Sets the number of POVs for a joystick.
static void SetJoystickPOVsAvailable (int stick, int available)
 Sets the number of POVs for a joystick.
static void SetJoystickButtonsMaximumIndex (int stick, int count)
 Sets the number of buttons for a joystick.
static void SetJoystickButtonsAvailable (int stick, uint64_t available)
static void SetJoystickIsGamepad (int stick, bool isGamepad)
 Sets the value of isGamepad for a joystick.
static void SetJoystickGamepadType (int stick, int type)
 Sets the value of type for a joystick.
static void SetJoystickName (int stick, std::string_view name)
 Sets the name of a joystick.
static void SetJoystickSupportedOutputs (int stick, int supportedOutputs)
 Sets the supported outputs for a joystick.
static void SetGameData (std::string_view message)
 Sets the game specific message.
static void SetEventName (std::string_view name)
 Sets the event name.
static void SetMatchType (DriverStation::MatchType type)
 Sets the match type.
static void SetMatchNumber (int matchNumber)
 Sets the match number.
static void SetReplayNumber (int replayNumber)
 Sets the replay number.
static void ResetData ()
 Reset all simulation data for the Driver Station.

Detailed Description

Class to control a simulated driver station.

Member Function Documentation

◆ GetAllianceStationId()

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

Get the alliance station ID (color + number).

Returns
the alliance station color and number

◆ GetDsAttached()

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

Check if the DS is attached.

Returns
true if attached

◆ GetEnabled()

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

Check if the DS is enabled.

Returns
true if enabled

◆ GetEStop()

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

Check if eStop has been activated.

Returns
true if eStopped

◆ GetFmsAttached()

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

Check if the FMS is connected.

Returns
true if FMS is connected

◆ GetJoystickLeds()

int32_t wpi::sim::DriverStationSim::GetJoystickLeds ( int stick)
static

Gets the joystick outputs.

Parameters
stickThe joystick number
Returns
The joystick outputs

◆ GetJoystickRumble()

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

Gets the joystick rumble.

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

◆ GetMatchTime()

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

Get the current value of the match timer.

Returns
the current match time

◆ GetOpMode()

int64_t wpi::sim::DriverStationSim::GetOpMode ( )
static

Get the opmode set by the DS.

Returns
opmode

◆ GetOpModeOptions()

OpModeOptions wpi::sim::DriverStationSim::GetOpModeOptions ( )
static

Gets the list of opmode options.

Returns
opmodes list

◆ GetRobotMode()

HAL_RobotMode wpi::sim::DriverStationSim::GetRobotMode ( )
static

Get the robot mode set by the DS.

Returns
robot mode

◆ NotifyNewData()

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

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

◆ RegisterAllianceStationIdCallback()

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

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

◆ RegisterDsAttachedCallback()

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

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()

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

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()

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

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()

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

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()

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

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

◆ RegisterOpModeCallback()

std::unique_ptr< CallbackStore > wpi::sim::DriverStationSim::RegisterOpModeCallback ( NotifyCallback callback,
bool initialNotify )
staticnodiscard

Register a callback on DS opmode changes.

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

◆ RegisterOpModeOptionsCallback()

std::unique_ptr< CallbackStore > wpi::sim::DriverStationSim::RegisterOpModeOptionsCallback ( OpModeOptionsCallback callback,
bool initialNotify )
staticnodiscard

Register a callback on opmode options changes.

Parameters
callbackthe callback that will be called when the list of opmodes changes
initialNotifyif true, the callback will be run on the initial value
Returns
the CallbackStore object associated with this callback.

◆ RegisterRobotModeCallback()

std::unique_ptr< CallbackStore > wpi::sim::DriverStationSim::RegisterRobotModeCallback ( NotifyCallback callback,
bool initialNotify )
staticnodiscard

Register a callback on DS robot mode changes.

Parameters
callbackthe callback that will be called when robot mode changes
initialNotifyif true, the callback will be run on the initial value
Returns
the CallbackStore object associated with this callback

◆ ResetData()

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

Reset all simulation data for the Driver Station.

◆ SetAllianceStationId()

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

Change the alliance station.

Parameters
allianceStationIdthe new alliance station

◆ SetDsAttached()

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

Change whether the DS is attached.

Parameters
dsAttachedthe new value

◆ SetEnabled()

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

Change whether the DS is enabled.

Parameters
enabledthe new value

◆ SetEStop()

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

Set whether eStop is active.

Parameters
eStoptrue to activate

◆ SetEventName()

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

Sets the event name.

Parameters
namethe event name

◆ SetFmsAttached()

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

Change whether the FMS is connected.

Parameters
fmsAttachedthe new value

◆ SetGameData()

void wpi::sim::DriverStationSim::SetGameData ( std::string_view message)
static

Sets the game specific message.

Parameters
messagethe game specific message

◆ SetJoystickAxesAvailable()

void wpi::sim::DriverStationSim::SetJoystickAxesAvailable ( int stick,
int available )
static

Sets the number of axes for a joystick.

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

◆ SetJoystickAxesMaximumIndex()

void wpi::sim::DriverStationSim::SetJoystickAxesMaximumIndex ( int stick,
int maximumIndex )
static

Sets the number of axes for a joystick.

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

◆ SetJoystickAxis()

void wpi::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

◆ SetJoystickButton()

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

Sets the state of one joystick button.

Button indexes begin at 0.

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

◆ SetJoystickButtonsAvailable()

void wpi::sim::DriverStationSim::SetJoystickButtonsAvailable ( int stick,
uint64_t available )
static

◆ SetJoystickButtonsMaximumIndex()

void wpi::sim::DriverStationSim::SetJoystickButtonsMaximumIndex ( 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

◆ SetJoystickGamepadType()

void wpi::sim::DriverStationSim::SetJoystickGamepadType ( int stick,
int type )
static

Sets the value of type for a joystick.

Parameters
stickThe joystick number
typeThe value of type

◆ SetJoystickIsGamepad()

void wpi::sim::DriverStationSim::SetJoystickIsGamepad ( int stick,
bool isGamepad )
static

Sets the value of isGamepad for a joystick.

Parameters
stickThe joystick number
isGamepadThe value of isGamepad

◆ SetJoystickName()

void wpi::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()

void wpi::sim::DriverStationSim::SetJoystickPOV ( int stick,
int pov,
DriverStation::POVDirection value )
static

Gets the state of a POV on a joystick.

Parameters
stickThe joystick number
povThe POV number
valuethe angle of the POV

◆ SetJoystickPOVsAvailable()

void wpi::sim::DriverStationSim::SetJoystickPOVsAvailable ( int stick,
int available )
static

Sets the number of POVs for a joystick.

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

◆ SetJoystickPOVsMaximumIndex()

void wpi::sim::DriverStationSim::SetJoystickPOVsMaximumIndex ( int stick,
int maximumIndex )
static

Sets the number of POVs for a joystick.

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

◆ SetJoystickSupportedOutputs()

void wpi::sim::DriverStationSim::SetJoystickSupportedOutputs ( int stick,
int supportedOutputs )
static

Sets the supported outputs for a joystick.

Parameters
stickThe joystick number
supportedOutputsThe supported outputs for the joystick

◆ SetMatchNumber()

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

Sets the match number.

Parameters
matchNumberthe match number

◆ SetMatchTime()

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

Sets the match timer.

Parameters
matchTimethe new match time

◆ SetMatchType()

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

Sets the match type.

Parameters
typethe match type

◆ SetOpMode()

void wpi::sim::DriverStationSim::SetOpMode ( int64_t opmode)
static

Change the opmode set by the DS.

Parameters
opmodethe new value

◆ SetReplayNumber()

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

Sets the replay number.

Parameters
replayNumberthe replay number

◆ SetRobotMode()

void wpi::sim::DriverStationSim::SetRobotMode ( HAL_RobotMode robotMode)
static

Change the robot mode set by the DS.

Parameters
robotModethe new value

◆ SetSendConsoleLine()

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

Sets suppression of DriverStation::SendConsoleLine messages.

Parameters
shouldSendIf false then messages will be suppressed.

◆ SetSendError()

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

Sets suppression of DriverStation::ReportError and ReportWarning messages.

Parameters
shouldSendIf false then messages will be suppressed.

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