DriverStationSim

class wpilib.simulation.DriverStationSim

Bases: pybind11_builtins.pybind11_object

Class to control a simulated driver station.

static getAllianceStationId()hal._wpiHal.AllianceStationID

Get the alliance station ID (color + number).

Returns

the alliance station color and number

static getAutonomous()bool

Check if the DS is in autonomous.

Returns

true if autonomous

static getDsAttached()bool

Check if the DS is attached.

Returns

true if attached

static getEStop()bool

Check if eStop has been activated.

Returns

true if eStopped

static getEnabled()bool

Check if the DS is enabled.

Returns

true if enabled

static getFmsAttached()bool

Check if the FMS is connected.

Returns

true if FMS is connected

static getJoystickOutputs(stick: int)int

Gets the joystick outputs.

Parameters

stick – The joystick number

Returns

The joystick outputs

static getJoystickRumble(stick: int, rumbleNum: int)int

Gets the joystick rumble.

Parameters
  • stick – The joystick number

  • rumbleNum – Rumble to get (0=left, 1=right)

Returns

The joystick rumble value

static getMatchTime()float

Get the current value of the match timer.

Returns

the current match time

static getTest()bool

Check if the DS is in test.

Returns

true if test

static notifyNewData()None

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

static registerAllianceStationIdCallback(callback: Callable[[str, HAL_Value], None], initialNotify: bool)wpilib.simulation.CallbackStore

Register a callback on the alliance station ID.

Parameters
  • callback – the callback that will be called whenever the alliance station changes

  • initialNotify – if true, the callback will be run on the initial value

Returns

the CallbackStore object associated with this callback

static registerAutonomousCallback(callback: Callable[[str, HAL_Value], None], initialNotify: bool)wpilib.simulation.CallbackStore

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

Parameters
  • callback – the callback that will be called on autonomous mode entrance/exit

  • initialNotify – if true, the callback will be run on the initial value

Returns

the CallbackStore object associated with this callback

static registerDsAttachedCallback(callback: Callable[[str, HAL_Value], None], initialNotify: bool)wpilib.simulation.CallbackStore

Register a callback on whether the DS is connected.

Parameters
  • callback – the callback that will be called whenever the DS connection changes

  • initialNotify – if true, the callback will be run on the initial value

Returns

the CallbackStore object associated with this callback

static registerEStopCallback(callback: Callable[[str, HAL_Value], None], initialNotify: bool)wpilib.simulation.CallbackStore

Register a callback on the eStop state.

Parameters
  • callback – the callback that will be called whenever the eStop state changes

  • initialNotify – if true, the callback will be run on the initial value

Returns

the CallbackStore object associated with this callback

static registerEnabledCallback(callback: Callable[[str, HAL_Value], None], initialNotify: bool)wpilib.simulation.CallbackStore

Register a callback on whether the DS is enabled.

Parameters
  • callback – the callback that will be called whenever the enabled state is changed

  • initialNotify – if true, the callback will be run on the initial value

Returns

the CallbackStore object associated with this callback

static registerFmsAttachedCallback(callback: Callable[[str, HAL_Value], None], initialNotify: bool)wpilib.simulation.CallbackStore

Register a callback on whether the FMS is connected.

Parameters
  • callback – the callback that will be called whenever the FMS connection changes

  • initialNotify – if true, the callback will be run on the initial value

Returns

the CallbackStore object associated with this callback

static registerMatchTimeCallback(callback: Callable[[str, HAL_Value], None], initialNotify: bool)wpilib.simulation.CallbackStore

Register a callback on match time.

Parameters
  • callback – the callback that will be called whenever match time changes

  • initialNotify – if true, the callback will be run on the initial value

Returns

the CallbackStore object associated with this callback

static registerTestCallback(callback: Callable[[str, HAL_Value], None], initialNotify: bool)wpilib.simulation.CallbackStore

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

Parameters
  • callback – the callback that will be called whenever the test mode is entered or left

  • initialNotify – if true, the callback will be run on the initial value

Returns

the CallbackStore object associated with this callback

static resetData()None

Reset all simulation data for the Driver Station.

static setAllianceStationId(allianceStationId: hal._wpiHal.AllianceStationID)None

Change the alliance station.

Parameters

allianceStationId – the new alliance station

static setAutonomous(autonomous: bool)None

Change whether the DS is in autonomous.

Parameters

autonomous – the new value

static setDsAttached(dsAttached: bool)None

Change whether the DS is attached.

Parameters

dsAttached – the new value

static setEStop(eStop: bool)None

Set whether eStop is active.

Parameters

eStop – true to activate

static setEnabled(enabled: bool)None

Change whether the DS is enabled.

Parameters

enabled – the new value

static setEventName(name: str)None

Sets the event name.

Parameters

name – the event name

static setFmsAttached(fmsAttached: bool)None

Change whether the FMS is connected.

Parameters

fmsAttached – the new value

static setGameSpecificMessage(message: str)None

Sets the game specific message.

Parameters

message – the game specific message

static setJoystickAxis(stick: int, axis: int, value: float)None

Gets the value of the axis on a joystick.

Parameters
  • stick – The joystick number

  • axis – The analog axis number

  • value – The value of the axis on the joystick

static setJoystickAxisCount(stick: int, count: int)None

Sets the number of axes for a joystick.

Parameters
  • stick – The joystick number

  • count – The number of axes on the indicated joystick

static setJoystickAxisType(stick: int, axis: int, type: int)None

Sets the types of Axes for a joystick.

Parameters
  • stick – The joystick number

  • axis – The target axis

  • type – The type of axis

static setJoystickButton(stick: int, button: int, state: bool)None

Sets the state of one joystick button. Button indexes begin at 1.

Parameters
  • stick – The joystick number

  • button – The button index, beginning at 1

  • state – The state of the joystick button

static setJoystickButtonCount(stick: int, count: int)None

Sets the number of buttons for a joystick.

Parameters
  • stick – The joystick number

  • count – The number of buttons on the indicated joystick

static setJoystickButtons(stick: int, buttons: int)None

Sets the state of all the buttons on a joystick.

Parameters
  • stick – The joystick number

  • buttons – The bitmap state of the buttons on the joystick

static setJoystickIsXbox(stick: int, isXbox: bool)None

Sets the value of isXbox for a joystick.

Parameters
  • stick – The joystick number

  • isXbox – The value of isXbox

static setJoystickName(stick: int, name: str)None

Sets the name of a joystick.

Parameters
  • stick – The joystick number

  • name – The value of name

static setJoystickPOV(stick: int, pov: int, value: int)None

Gets the state of a POV on a joystick.

Parameters
  • stick – The joystick number

  • pov – The POV number

  • value – the angle of the POV in degrees, or -1 for not pressed

static setJoystickPOVCount(stick: int, count: int)None

Sets the number of POVs for a joystick.

Parameters
  • stick – The joystick number

  • count – The number of POVs on the indicated joystick

static setJoystickType(stick: int, type: int)None

Sets the value of type for a joystick.

Parameters
  • stick – The joystick number

  • type – The value of type

static setMatchNumber(matchNumber: int)None

Sets the match number.

Parameters

matchNumber – the match number

static setMatchTime(matchTime: float)None

Sets the match timer.

Parameters

matchTime – the new match time

static setMatchType(type: wpilib._wpilib.DriverStation.MatchType)None

Sets the match type.

Parameters

type – the match type

static setReplayNumber(replayNumber: int)None

Sets the replay number.

Parameters

replayNumber – the replay number

static setSendConsoleLine(shouldSend: bool)None

Sets suppression of DriverStation::SendConsoleLine messages.

Parameters

shouldSend – If false then messages will be suppressed.

static setSendError(shouldSend: bool)None

Sets suppression of DriverStation::ReportError and ReportWarning messages.

Parameters

shouldSend – If false then messages will be suppressed.

static setTest(test: bool)None

Change whether the DS is in test.

Parameters

test – the new value