wpilib.simulation functions

wpilib.simulation.get_program_started() bool

Returns true if the user program has started.

Returns:

True if the user program has started.

wpilib.simulation.get_program_state() hal._wpi_hal.ControlWord

Gets the user program state (control word).

Returns:

Control word

wpilib.simulation.is_timing_paused() bool

Check if the simulator time is paused.

Returns:

true if paused

wpilib.simulation.pause_timing() None

Pause the simulator time.

wpilib.simulation.restart_timing() None

Restart the simulator time.

wpilib.simulation.resume_timing() None

Resume the simulator time.

wpilib.simulation.set_program_started(started: bool) None

Sets flag that indicates if the user program has started.

Parameters:

started – true if started

wpilib.simulation.set_program_state(control_word: hal._wpi_hal.ControlWord) None

Sets the user program state (control word).

Parameters:

control_word – control word

wpilib.simulation.set_runtime_type(type: hal._wpi_hal.RuntimeType) None

Override the HAL runtime type (simulated/real).

Parameters:

type – runtime type

wpilib.simulation.step_timing(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.step_timing_async(delta: wpimath.units.seconds) None

Advance the simulator time and return immediately.

Parameters:

delta – the amount to advance (in seconds)

wpilib.simulation.wait_for_program_start(timeout: float | None = None, delta: float = 0.001, wait_for_first_notifier: bool = True)[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

  • wait_for_first_notifier – Wait for the first notifier alarm to be armed