wpilib.simulation functions

wpilib.simulation.getProgramStarted() bool

Returns true if the user program has started.

Returns:

True if the user program has started.

wpilib.simulation.getProgramState() hal._wpiHal.ControlWord

Gets the user program state (control word).

Returns:

Control word

wpilib.simulation.isTimingPaused() bool

Check if the simulator time is paused.

Returns:

true if paused

wpilib.simulation.pauseTiming() None

Pause the simulator time.

wpilib.simulation.restartTiming() None

Restart the simulator time.

wpilib.simulation.resumeTiming() None

Resume the simulator time.

wpilib.simulation.setProgramStarted(started: bool) None

Sets flag that indicates if the user program has started.

Parameters:

started – true if started

wpilib.simulation.setProgramState(controlWord: hal._wpiHal.ControlWord) None

Sets the user program state (control word).

Parameters:

controlWord – control word

wpilib.simulation.setRuntimeType(type: hal._wpiHal.RuntimeType) None

Override the HAL runtime type (simulated/real).

Parameters:

type – runtime type

wpilib.simulation.stepTiming(delta: wpimath.units.seconds) None

Advance the simulator time and wait for all notifiers to run.

Parameters:

delta – the amount to advance (in seconds)

wpilib.simulation.stepTimingAsync(delta: wpimath.units.seconds) None

Advance the simulator time and return immediately.

Parameters:

delta – the amount to advance (in seconds)

wpilib.simulation.waitForProgramStart(timeout: float | None = None, delta: float = 0.001)[source]

Polls robot program and returns when it has reported that it started

Parameters:
  • timeout – Amount of time to wait

  • delta – Amount of time to sleep between checks