DriverStation

class wpilib.DriverStation

Bases: pybind11_object

Provides access to Driver Station functionality.

static get_gamepad(port: SupportsInt | SupportsIndex) wpilib._wpilib.Gamepad

Gets the Gamepad object for the given port. Gamepad objects are cached, so this will always return the same object for the same port.

Parameters:

port – The port index on the Driver Station that the controller is plugged into (0-5).

Returns:

The Gamepad object for the given port.

static get_generic_hid(port: SupportsInt | SupportsIndex) wpilib._wpilib.GenericHID

Gets the GenericHID object for the given port. GenericHID objects are cached, so this will always return the same object for the same port.

Parameters:

port – The port index on the Driver Station that the controller is plugged into (0-5).

Returns:

The GenericHID object for the given port.

static provide_refreshed_data_event_handle(handle: SupportsInt | SupportsIndex) None

Registers the given handle for DS data refresh notifications.

Parameters:

handle – The event handle.

static remove_refreshed_data_event_handle(handle: SupportsInt | SupportsIndex) None

Unregisters the given handle from DS data refresh notifications.

Parameters:

handle – The event handle.

static start_data_log(*args, **kwargs)

Overloaded function.

  1. start_data_log(log: wpilog._wpilog.DataLog) -> None

Starts logging DriverStation data to data log, including joystick data. Repeated calls are ignored.

Parameters:

log – data log

  1. start_data_log(log: wpilog._wpilog.DataLog, log_joysticks: bool) -> None

Starts logging DriverStation data to data log. Repeated calls are ignored.

Parameters:
  • log – data log

  • log_joysticks – if true, log joystick data