hal.simulation functions

hal.simulation.cancel_all_sim_periodic_callbacks() None
hal.simulation.cancel_driver_station_alliance_station_id_callback(uid: SupportsInt | SupportsIndex) None
hal.simulation.cancel_driver_station_ds_attached_callback(uid: SupportsInt | SupportsIndex) None
hal.simulation.cancel_driver_station_e_stop_callback(uid: SupportsInt | SupportsIndex) None
hal.simulation.cancel_driver_station_enabled_callback(uid: SupportsInt | SupportsIndex) None
hal.simulation.cancel_driver_station_fms_attached_callback(uid: SupportsInt | SupportsIndex) None
hal.simulation.cancel_driver_station_match_time_callback(uid: SupportsInt | SupportsIndex) None
hal.simulation.cancel_driver_station_new_data_callback(uid: SupportsInt | SupportsIndex) None
hal.simulation.cancel_driver_station_opmode_callback(uid: SupportsInt | SupportsIndex) None
hal.simulation.cancel_driver_station_robot_mode_callback(uid: SupportsInt | SupportsIndex) None
hal.simulation.cancel_game_data_callback(uid: SupportsInt | SupportsIndex) None
hal.simulation.cancel_joystick_axes_callback(uid: SupportsInt | SupportsIndex) None
hal.simulation.cancel_joystick_buttons_callback(uid: SupportsInt | SupportsIndex) None
hal.simulation.cancel_joystick_descriptor_callback(uid: SupportsInt | SupportsIndex) None
hal.simulation.cancel_joystick_leds_callback(uid: SupportsInt | SupportsIndex) None
hal.simulation.cancel_joystick_povs_callback(uid: SupportsInt | SupportsIndex) None
hal.simulation.cancel_joystick_rumbles_callback(uid: SupportsInt | SupportsIndex) None
hal.simulation.cancel_joystick_touchpads_callback(uid: SupportsInt | SupportsIndex) None
hal.simulation.cancel_match_info_callback(uid: SupportsInt | SupportsIndex) None
hal.simulation.cancel_opmode_options_callback(uid: SupportsInt | SupportsIndex) None
hal.simulation.free_opmode_options_array(arr: hal._wpi_hal.OpModeOption, length: SupportsInt | SupportsIndex) None
hal.simulation.get_driver_station_alliance_station_id() hal._wpi_hal._AllianceStationID
hal.simulation.get_driver_station_ds_attached() int
hal.simulation.get_driver_station_e_stop() int
hal.simulation.get_driver_station_enabled() int
hal.simulation.get_driver_station_fms_attached() int
hal.simulation.get_driver_station_match_time() float
hal.simulation.get_driver_station_opmode() int
hal.simulation.get_driver_station_robot_mode() hal._wpi_hal._RobotMode
hal.simulation.get_game_data(game_data: hal._wpi_hal.GameData) None
hal.simulation.get_joystick_availables(stick: SupportsInt | SupportsIndex) tuple[int, int, int]
hal.simulation.get_joystick_axes(joystick_num: SupportsInt | SupportsIndex, axes: hal._wpi_hal.JoystickAxes) None
hal.simulation.get_joystick_buttons(joystick_num: SupportsInt | SupportsIndex, buttons: hal._wpi_hal.JoystickButtons) None
hal.simulation.get_joystick_descriptor(joystick_num: SupportsInt | SupportsIndex, descriptor: hal._wpi_hal.JoystickDescriptor) None
hal.simulation.get_joystick_leds(joystick_num: SupportsInt | SupportsIndex) int
hal.simulation.get_joystick_povs(joystick_num: SupportsInt | SupportsIndex, povs: hal._wpi_hal.JoystickPOVs) None
hal.simulation.get_joystick_rumbles(joystick_num: SupportsInt | SupportsIndex) tuple[int, int, int, int]
hal.simulation.get_joystick_touchpads(joystick_num: SupportsInt | SupportsIndex, touchpads: hal._wpi_hal.JoystickTouchpads) None
hal.simulation.get_match_info(info: hal._wpi_hal.MatchInfo) None
hal.simulation.get_next_notifier_timeout() int
hal.simulation.get_notifier_info(arr: hal.simulation._simulation.NotifierInfo, size: SupportsInt | SupportsIndex) int

Gets detailed information about each notifier.

Parameters:
  • arr – array of information to be filled

  • size – size of arr

Returns:

Number of notifiers; note: may be larger than passed-in size

hal.simulation.get_num_notifiers() int
hal.simulation.get_opmode_options() tuple[hal._wpi_hal.OpModeOption, int]
hal.simulation.get_program_started() int
hal.simulation.get_program_state(*args, **kwargs)

Overloaded function.

  1. get_program_state(control_word: hal._wpi_hal._ControlWord) -> None

  2. get_program_state() -> hal._wpi_hal.ControlWord

hal.simulation.get_sim_device_handle(name: str) int
hal.simulation.get_sim_device_name(handle: SupportsInt | SupportsIndex) str
hal.simulation.get_sim_value_device_handle(handle: SupportsInt | SupportsIndex) int
hal.simulation.get_sim_value_handle(device: SupportsInt | SupportsIndex, name: str) int
hal.simulation.is_sim_device_enabled(name: str) int
hal.simulation.is_timing_paused() int
hal.simulation.notify_driver_station_new_data() None
hal.simulation.pause_timing() None
hal.simulation.register_sim_periodic_after_callback(callback: collections.abc.Callable[[], None]) hal.simulation._simulation.SimCB
hal.simulation.register_sim_periodic_before_callback(callback: collections.abc.Callable[[], None]) hal.simulation._simulation.SimCB
hal.simulation.register_sim_value_changed_callback(value: hal._wpi_hal.SimValue, callback: collections.abc.Callable[[str, SupportsInt | SupportsIndex, hal._wpi_hal.SimValueDirection, hal._wpi_hal.Value], None], initial_notify: bool) hal.simulation._simulation.SimValueCB
hal.simulation.register_sim_value_created_callback(device: hal._wpi_hal.SimDevice, callback: collections.abc.Callable[[str, SupportsInt | SupportsIndex, hal._wpi_hal.SimValueDirection, hal._wpi_hal.Value], None], initial_notify: bool) hal.simulation._simulation.SimValueCB
hal.simulation.register_sim_value_reset_callback(value: hal._wpi_hal.SimValue, callback: collections.abc.Callable[[str, SupportsInt | SupportsIndex, hal._wpi_hal.SimValueDirection, hal._wpi_hal.Value], None], initial_notify: bool) hal.simulation._simulation.SimValueCB

Register a callback for HAL_SimValueReset(). The callback is called with the old value.

Parameters:
  • value – simulated value handle

  • param – parameter for callback

  • callback – callback

  • initial_notify – ignored (present for consistency)

hal.simulation.reset_all_sim_data() None
hal.simulation.reset_driver_station_data() None
hal.simulation.reset_global_handles() None
hal.simulation.reset_sim_device_data() None
hal.simulation.restart_timing() None
hal.simulation.resume_timing() None
hal.simulation.set_driver_station_alliance_station_id(alliance_station_id: hal._wpi_hal._AllianceStationID) None
hal.simulation.set_driver_station_ds_attached(ds_attached: SupportsInt | SupportsIndex) None
hal.simulation.set_driver_station_e_stop(e_stop: SupportsInt | SupportsIndex) None
hal.simulation.set_driver_station_enabled(enabled: SupportsInt | SupportsIndex) None
hal.simulation.set_driver_station_fms_attached(fms_attached: SupportsInt | SupportsIndex) None
hal.simulation.set_driver_station_match_time(match_time: SupportsFloat | SupportsIndex) None
hal.simulation.set_driver_station_opmode(opmode: SupportsInt | SupportsIndex) None
hal.simulation.set_driver_station_robot_mode(mode: hal._wpi_hal._RobotMode) None
hal.simulation.set_event_name(name: str) None
hal.simulation.set_game_data(game_data: hal._wpi_hal.GameData) None
hal.simulation.set_game_data_string(name: str) None
hal.simulation.set_joystick_axes(joystick_num: SupportsInt | SupportsIndex, axes: hal._wpi_hal.JoystickAxes) None
hal.simulation.set_joystick_axes_available(stick: SupportsInt | SupportsIndex, available: SupportsInt | SupportsIndex) None
hal.simulation.set_joystick_axis(stick: SupportsInt | SupportsIndex, axis: SupportsInt | SupportsIndex, value: SupportsFloat | SupportsIndex) None
hal.simulation.set_joystick_button(stick: SupportsInt | SupportsIndex, button: SupportsInt | SupportsIndex, state: SupportsInt | SupportsIndex) None
hal.simulation.set_joystick_buttons(joystick_num: SupportsInt | SupportsIndex, buttons: hal._wpi_hal.JoystickButtons) None
hal.simulation.set_joystick_buttons_available(stick: SupportsInt | SupportsIndex, available: SupportsInt | SupportsIndex) None
hal.simulation.set_joystick_buttons_value(stick: SupportsInt | SupportsIndex, buttons: SupportsInt | SupportsIndex) None
hal.simulation.set_joystick_descriptor(joystick_num: SupportsInt | SupportsIndex, descriptor: hal._wpi_hal.JoystickDescriptor) None
hal.simulation.set_joystick_gamepad_type(stick: SupportsInt | SupportsIndex, type: SupportsInt | SupportsIndex) None
hal.simulation.set_joystick_is_gamepad(stick: SupportsInt | SupportsIndex, is_gamepad: SupportsInt | SupportsIndex) None
hal.simulation.set_joystick_leds(joystick_num: SupportsInt | SupportsIndex, leds: SupportsInt | SupportsIndex) None
hal.simulation.set_joystick_name(stick: SupportsInt | SupportsIndex, name: str) None
hal.simulation.set_joystick_pov(stick: SupportsInt | SupportsIndex, pov: SupportsInt | SupportsIndex, value: hal._wpi_hal.JoystickPOV) None
hal.simulation.set_joystick_povs(joystick_num: SupportsInt | SupportsIndex, povs: hal._wpi_hal.JoystickPOVs) None
hal.simulation.set_joystick_povs_available(stick: SupportsInt | SupportsIndex, available: SupportsInt | SupportsIndex) None
hal.simulation.set_joystick_rumbles(joystick_num: SupportsInt | SupportsIndex, left_rumble: SupportsInt | SupportsIndex, right_rumble: SupportsInt | SupportsIndex, left_trigger_rumble: SupportsInt | SupportsIndex, right_trigger_rumble: SupportsInt | SupportsIndex) None
hal.simulation.set_joystick_supported_outputs(stick: SupportsInt | SupportsIndex, supported_outputs: SupportsInt | SupportsIndex) None
hal.simulation.set_joystick_touchpad_counts(stick: SupportsInt | SupportsIndex, touchpad_count: SupportsInt | SupportsIndex, finger_count: SupportsInt | SupportsIndex) None
hal.simulation.set_joystick_touchpad_finger(stick: SupportsInt | SupportsIndex, touchpad: SupportsInt | SupportsIndex, finger: SupportsInt | SupportsIndex, down: SupportsInt | SupportsIndex, x: SupportsFloat | SupportsIndex, y: SupportsFloat | SupportsIndex) None
hal.simulation.set_joystick_touchpads(joystick_num: SupportsInt | SupportsIndex, touchpads: hal._wpi_hal.JoystickTouchpads) None
hal.simulation.set_match_info(info: hal._wpi_hal.MatchInfo) None
hal.simulation.set_match_number(match_number: SupportsInt | SupportsIndex) None
hal.simulation.set_match_type(type: hal._wpi_hal.MatchType) None
hal.simulation.set_program_started(started: SupportsInt | SupportsIndex) None
hal.simulation.set_program_state(*args, **kwargs)

Overloaded function.

  1. set_program_state(control_word: hal._wpi_hal._ControlWord) -> None

  2. set_program_state(control_word: hal._wpi_hal.ControlWord) -> None

hal.simulation.set_replay_number(replay_number: SupportsInt | SupportsIndex) None
hal.simulation.set_runtime_type(type: hal._wpi_hal.RuntimeType) None
hal.simulation.set_sim_device_enabled(prefix: str, enabled: SupportsInt | SupportsIndex) None
hal.simulation.step_timing(delta: SupportsInt | SupportsIndex) None
hal.simulation.step_timing_async(delta: SupportsInt | SupportsIndex) None
hal.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