NiDsStadiaController

class wpilib.NiDsStadiaController(*args, **kwargs)

Bases: HIDDevice, Sendable

Handle input from NiDsStadia controllers connected to the Driver Station.

This class handles NiDsStadia input that comes from the Driver Station. Each time a value is requested the most recent value is returned. There is a single class instance for each controller and the mapping of ports to hardware buttons depends on the code in the Driver Station.

Only first party controllers from Google are guaranteed to have the correct mapping, and only through the official NI DS. Sim is not guaranteed to have the same mapping, as well as any 3rd party controllers.

Overloaded function.

  1. __init__(self: wpilib._wpilib.NiDsStadiaController, port: typing.SupportsInt | typing.SupportsIndex) -> None

Construct an instance of a controller.

The controller index is the USB port on the Driver Station.

Parameters:

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

  1. __init__(self: wpilib._wpilib.NiDsStadiaController, hid: wpilib._wpilib.GenericHID) -> None

Construct an instance of a controller with a GenericHID object.

Parameters:

hid – The GenericHID object to use for this controller.

class Axis

Bases: pybind11_object

Represents an axis on an NiDsStadiaController.

LEFT_X = 0
LEFT_Y = 1
RIGHT_X = 3
RIGHT_Y = 4
class Button

Bases: pybind11_object

Represents a digital button on an NiDsStadiaController.

A = 0
B = 1
ELLIPSES = 8
FRAME = 14
GOOGLE = 13
HAMBURGER = 9
LEFT_BUMPER = 4
LEFT_STICK = 6
LEFT_TRIGGER = 12
RIGHT_BUMPER = 5
RIGHT_STICK = 7
RIGHT_TRIGGER = 11
STADIA = 10
X = 2
Y = 3
a(loop: wpilib._wpilib.EventLoop) wpilib._wpilib.BooleanEvent

Constructs an event instance around the A button’s digital signal.

Parameters:

loop – the event loop instance to attach the event to.

Returns:

an event instance representing the A button’s digital signal attached to the given loop.

b(loop: wpilib._wpilib.EventLoop) wpilib._wpilib.BooleanEvent

Constructs an event instance around the B button’s digital signal.

Parameters:

loop – the event loop instance to attach the event to.

Returns:

an event instance representing the B button’s digital signal attached to the given loop.

ellipses(loop: wpilib._wpilib.EventLoop) wpilib._wpilib.BooleanEvent

Constructs an event instance around the ellipses button’s digital signal.

Parameters:

loop – the event loop instance to attach the event to.

Returns:

an event instance representing the ellipses button’s digital signal attached to the given loop.

frame(loop: wpilib._wpilib.EventLoop) wpilib._wpilib.BooleanEvent

Constructs an event instance around the frame button’s digital signal.

Parameters:

loop – the event loop instance to attach the event to.

Returns:

an event instance representing the frame button’s digital signal attached to the given loop.

get_a_button() bool

Read the value of the A button on the controller.

Returns:

The state of the button.

get_a_button_pressed() bool

Whether the A button was pressed since the last check.

Returns:

Whether the button was pressed since the last check.

get_a_button_released() bool

Whether the A button was released since the last check.

Returns:

Whether the button was released since the last check.

get_b_button() bool

Read the value of the B button on the controller.

Returns:

The state of the button.

get_b_button_pressed() bool

Whether the B button was pressed since the last check.

Returns:

Whether the button was pressed since the last check.

get_b_button_released() bool

Whether the B button was released since the last check.

Returns:

Whether the button was released since the last check.

get_ellipses_button() bool

Read the value of the ellipses button on the controller.

Returns:

The state of the button.

get_ellipses_button_pressed() bool

Whether the ellipses button was pressed since the last check.

Returns:

Whether the button was pressed since the last check.

get_ellipses_button_released() bool

Whether the ellipses button was released since the last check.

Returns:

Whether the button was released since the last check.

get_frame_button() bool

Read the value of the frame button on the controller.

Returns:

The state of the button.

get_frame_button_pressed() bool

Whether the frame button was pressed since the last check.

Returns:

Whether the button was pressed since the last check.

get_frame_button_released() bool

Whether the frame button was released since the last check.

Returns:

Whether the button was released since the last check.

get_gamepad_type() wpilib._wpilib.GenericHID.HIDType

Get the type of the controller.

Returns:

the type of the controller.

get_google_button() bool

Read the value of the google button on the controller.

Returns:

The state of the button.

get_google_button_pressed() bool

Whether the google button was pressed since the last check.

Returns:

Whether the button was pressed since the last check.

get_google_button_released() bool

Whether the google button was released since the last check.

Returns:

Whether the button was released since the last check.

get_hamburger_button() bool

Read the value of the hamburger button on the controller.

Returns:

The state of the button.

get_hamburger_button_pressed() bool

Whether the hamburger button was pressed since the last check.

Returns:

Whether the button was pressed since the last check.

get_hamburger_button_released() bool

Whether the hamburger button was released since the last check.

Returns:

Whether the button was released since the last check.

get_hid() wpilib._wpilib.GenericHID

Get the underlying GenericHID object.

Returns:

the wrapped GenericHID object

get_left_bumper_button() bool

Read the value of the left bumper button on the controller.

Returns:

The state of the button.

get_left_bumper_button_pressed() bool

Whether the left bumper button was pressed since the last check.

Returns:

Whether the button was pressed since the last check.

get_left_bumper_button_released() bool

Whether the left bumper button was released since the last check.

Returns:

Whether the button was released since the last check.

get_left_stick_button() bool

Read the value of the left stick button on the controller.

Returns:

The state of the button.

get_left_stick_button_pressed() bool

Whether the left stick button was pressed since the last check.

Returns:

Whether the button was pressed since the last check.

get_left_stick_button_released() bool

Whether the left stick button was released since the last check.

Returns:

Whether the button was released since the last check.

get_left_trigger_button() bool

Read the value of the left trigger button on the controller.

Returns:

The state of the button.

get_left_trigger_button_pressed() bool

Whether the left trigger button was pressed since the last check.

Returns:

Whether the button was pressed since the last check.

get_left_trigger_button_released() bool

Whether the left trigger button was released since the last check.

Returns:

Whether the button was released since the last check.

get_left_x() float

Get the X axis value of left side of the controller. Right is positive.

Returns:

the axis value.

get_left_y() float

Get the Y axis value of left side of the controller. Back is positive.

Returns:

the axis value.

get_name() str

Get the name of the controller.

Returns:

the name of the controller.

get_port() int

Get the port number of the controller.

Returns:

The port number of the controller.

get_right_bumper_button() bool

Read the value of the right bumper button on the controller.

Returns:

The state of the button.

get_right_bumper_button_pressed() bool

Whether the right bumper button was pressed since the last check.

Returns:

Whether the button was pressed since the last check.

get_right_bumper_button_released() bool

Whether the right bumper button was released since the last check.

Returns:

Whether the button was released since the last check.

get_right_stick_button() bool

Read the value of the right stick button on the controller.

Returns:

The state of the button.

get_right_stick_button_pressed() bool

Whether the right stick button was pressed since the last check.

Returns:

Whether the button was pressed since the last check.

get_right_stick_button_released() bool

Whether the right stick button was released since the last check.

Returns:

Whether the button was released since the last check.

get_right_trigger_button() bool

Read the value of the right trigger button on the controller.

Returns:

The state of the button.

get_right_trigger_button_pressed() bool

Whether the right trigger button was pressed since the last check.

Returns:

Whether the button was pressed since the last check.

get_right_trigger_button_released() bool

Whether the right trigger button was released since the last check.

Returns:

Whether the button was released since the last check.

get_right_x() float

Get the X axis value of right side of the controller. Right is positive.

Returns:

the axis value.

get_right_y() float

Get the Y axis value of right side of the controller. Back is positive.

Returns:

the axis value.

get_stadia_button() bool

Read the value of the stadia button on the controller.

Returns:

The state of the button.

get_stadia_button_pressed() bool

Whether the stadia button was pressed since the last check.

Returns:

Whether the button was pressed since the last check.

get_stadia_button_released() bool

Whether the stadia button was released since the last check.

Returns:

Whether the button was released since the last check.

get_supported_outputs() wpilib._wpilib.GenericHID.SupportedOutputs

Get the supported outputs of the controller.

Returns:

the supported outputs of the controller.

get_x_button() bool

Read the value of the X button on the controller.

Returns:

The state of the button.

get_x_button_pressed() bool

Whether the X button was pressed since the last check.

Returns:

Whether the button was pressed since the last check.

get_x_button_released() bool

Whether the X button was released since the last check.

Returns:

Whether the button was released since the last check.

get_y_button() bool

Read the value of the Y button on the controller.

Returns:

The state of the button.

get_y_button_pressed() bool

Whether the Y button was pressed since the last check.

Returns:

Whether the button was pressed since the last check.

get_y_button_released() bool

Whether the Y button was released since the last check.

Returns:

Whether the button was released since the last check.

google(loop: wpilib._wpilib.EventLoop) wpilib._wpilib.BooleanEvent

Constructs an event instance around the google button’s digital signal.

Parameters:

loop – the event loop instance to attach the event to.

Returns:

an event instance representing the google button’s digital signal attached to the given loop.

hamburger(loop: wpilib._wpilib.EventLoop) wpilib._wpilib.BooleanEvent

Constructs an event instance around the hamburger button’s digital signal.

Parameters:

loop – the event loop instance to attach the event to.

Returns:

an event instance representing the hamburger button’s digital signal attached to the given loop.

init_sendable(builder: wpiutil._wpiutil.SendableBuilder) None
is_connected() bool

Get if the controller is connected.

Returns:

true if the controller is connected

left_bumper(loop: wpilib._wpilib.EventLoop) wpilib._wpilib.BooleanEvent

Constructs an event instance around the left bumper button’s digital signal.

Parameters:

loop – the event loop instance to attach the event to.

Returns:

an event instance representing the left bumper button’s digital signal attached to the given loop.

left_stick(loop: wpilib._wpilib.EventLoop) wpilib._wpilib.BooleanEvent

Constructs an event instance around the left stick button’s digital signal.

Parameters:

loop – the event loop instance to attach the event to.

Returns:

an event instance representing the left stick button’s digital signal attached to the given loop.

left_trigger(loop: wpilib._wpilib.EventLoop) wpilib._wpilib.BooleanEvent

Constructs an event instance around the left trigger button’s digital signal.

Parameters:

loop – the event loop instance to attach the event to.

Returns:

an event instance representing the left trigger button’s digital signal attached to the given loop.

right_bumper(loop: wpilib._wpilib.EventLoop) wpilib._wpilib.BooleanEvent

Constructs an event instance around the right bumper button’s digital signal.

Parameters:

loop – the event loop instance to attach the event to.

Returns:

an event instance representing the right bumper button’s digital signal attached to the given loop.

right_stick(loop: wpilib._wpilib.EventLoop) wpilib._wpilib.BooleanEvent

Constructs an event instance around the right stick button’s digital signal.

Parameters:

loop – the event loop instance to attach the event to.

Returns:

an event instance representing the right stick button’s digital signal attached to the given loop.

right_trigger(loop: wpilib._wpilib.EventLoop) wpilib._wpilib.BooleanEvent

Constructs an event instance around the right trigger button’s digital signal.

Parameters:

loop – the event loop instance to attach the event to.

Returns:

an event instance representing the right trigger button’s digital signal attached to the given loop.

set_rumble(type: wpilib._wpilib.GenericHID.RumbleType, value: SupportsFloat | SupportsIndex) None

Set the rumble output for the HID.

The DS currently supports 4 rumble values: left rumble, right rumble, left trigger rumble, and right trigger rumble.

Parameters:
  • type – Which rumble value to set

  • value – The normalized value (0 to 1) to set the rumble to

stadia(loop: wpilib._wpilib.EventLoop) wpilib._wpilib.BooleanEvent

Constructs an event instance around the stadia button’s digital signal.

Parameters:

loop – the event loop instance to attach the event to.

Returns:

an event instance representing the stadia button’s digital signal attached to the given loop.

x(loop: wpilib._wpilib.EventLoop) wpilib._wpilib.BooleanEvent

Constructs an event instance around the X button’s digital signal.

Parameters:

loop – the event loop instance to attach the event to.

Returns:

an event instance representing the X button’s digital signal attached to the given loop.

y(loop: wpilib._wpilib.EventLoop) wpilib._wpilib.BooleanEvent

Constructs an event instance around the Y button’s digital signal.

Parameters:

loop – the event loop instance to attach the event to.

Returns:

an event instance representing the Y button’s digital signal attached to the given loop.