CommandSteamController

class commands2.button.CommandSteamController(hid: int | SteamController)[source]

Bases: object

A version of wpilib.SteamController with Trigger factories for command-based.

Construct an instance of a controller.

Parameters:

hid – The port index on the Driver Station that the controller is plugged into, or the SteamController object to use for this controller.

a(loop: EventLoop | None = None) Trigger[source]

Constructs a Trigger instance around the A button’s digital signal.

Parameters:

loop – the event loop instance to attach the Trigger to, defaults to commands2.CommandScheduler.get_default_button_loop()

Returns:

a Trigger instance representing the A button’s digital signal attached to the given loop.

axis_greater_than(axis: Axis, threshold: float, loop: EventLoop | None = None) Trigger[source]

Constructs a Trigger instance that is true when the axis value is greater than threshold, attached to the given loop.

Parameters:
  • axis – the wpilib.SteamController.Axis to read

  • threshold – the value above which this Trigger should return true.

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

Returns:

a Trigger instance that is true when the axis value is greater than the provided threshold.

axis_less_than(axis: Axis, threshold: float, loop: EventLoop | None = None) Trigger[source]

Constructs a Trigger instance that is true when the axis value is less than threshold, attached to the given loop.

Parameters:
  • axis – the wpilib.SteamController.Axis to read

  • threshold – the value below which this Trigger should return true.

  • loop – the event loop instance to attach the Trigger to

Returns:

a Trigger instance that is true when the axis value is less than the provided threshold.

axis_magnitude_greater_than(axis: Axis, threshold: float, loop: EventLoop | None = None) Trigger[source]

Constructs a Trigger instance that is true when the axis magnitude is greater than threshold, attached to the given loop.

Parameters:
  • axis – the wpilib.SteamController.Axis to read

  • threshold – the value above which this Trigger should return true.

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

Returns:

a Trigger instance that is true when the axis magnitude is greater than the provided threshold.

b(loop: EventLoop | None = None) Trigger[source]

Constructs a Trigger instance around the B button’s digital signal.

Parameters:

loop – the event loop instance to attach the Trigger to, defaults to commands2.CommandScheduler.get_default_button_loop()

Returns:

a Trigger instance representing the B button’s digital signal attached to the given loop.

button(button: Button, loop: EventLoop | None = None) Trigger[source]

Constructs an event instance around this button’s digital signal.

Parameters:
dpad_down(loop: EventLoop | None = None) Trigger[source]

Constructs a Trigger instance around the Dpad Down button’s digital signal.

Parameters:

loop – the event loop instance to attach the Trigger to, defaults to commands2.CommandScheduler.get_default_button_loop()

Returns:

a Trigger instance representing the Dpad Down button’s digital signal attached to the given loop.

dpad_left(loop: EventLoop | None = None) Trigger[source]

Constructs a Trigger instance around the Dpad Left button’s digital signal.

Parameters:

loop – the event loop instance to attach the Trigger to, defaults to commands2.CommandScheduler.get_default_button_loop()

Returns:

a Trigger instance representing the Dpad Left button’s digital signal attached to the given loop.

dpad_right(loop: EventLoop | None = None) Trigger[source]

Constructs a Trigger instance around the Dpad Right button’s digital signal.

Parameters:

loop – the event loop instance to attach the Trigger to, defaults to commands2.CommandScheduler.get_default_button_loop()

Returns:

a Trigger instance representing the Dpad Right button’s digital signal attached to the given loop.

dpad_up(loop: EventLoop | None = None) Trigger[source]

Constructs a Trigger instance around the Dpad Up button’s digital signal.

Parameters:

loop – the event loop instance to attach the Trigger to, defaults to commands2.CommandScheduler.get_default_button_loop()

Returns:

a Trigger instance representing the Dpad Up button’s digital signal attached to the given loop.

get_axis(axis: Axis) float[source]

Get the value of the axis.

Parameters:

axis – the wpilib.SteamController.Axis to read

get_controller() SteamController[source]

Get the wrapped controller object.

Returns:

the wrapped controller object

get_hid() CommandGenericHID[source]

Get the underlying CommandGenericHID object.

Returns:

the wrapped CommandGenericHID object

get_left_trigger() float[source]

Get the Left Trigger value of the controller.

Returns:

the axis value.

get_left_x() float[source]

Get the Left X value of the controller.

Returns:

the axis value.

get_left_y() float[source]

Get the Left Y value of the controller.

Returns:

the axis value.

get_right_trigger() float[source]

Get the Right Trigger value of the controller.

Returns:

the axis value.

get_right_x() float[source]

Get the Right X value of the controller.

Returns:

the axis value.

get_right_y() float[source]

Get the Right Y value of the controller.

Returns:

the axis value.

left_bumper(loop: EventLoop | None = None) Trigger[source]

Constructs a Trigger instance around the Left Bumper button’s digital signal.

Parameters:

loop – the event loop instance to attach the Trigger to, defaults to commands2.CommandScheduler.get_default_button_loop()

Returns:

a Trigger instance representing the Left Bumper button’s digital signal attached to the given loop.

left_grip_touch(loop: EventLoop | None = None) Trigger[source]

Constructs a Trigger instance around the Left Grip Touch button’s digital signal.

Parameters:

loop – the event loop instance to attach the Trigger to, defaults to commands2.CommandScheduler.get_default_button_loop()

Returns:

a Trigger instance representing the Left Grip Touch button’s digital signal attached to the given loop.

left_paddle1(loop: EventLoop | None = None) Trigger[source]

Constructs a Trigger instance around the Left Paddle 1 button’s digital signal.

Parameters:

loop – the event loop instance to attach the Trigger to, defaults to commands2.CommandScheduler.get_default_button_loop()

Returns:

a Trigger instance representing the Left Paddle 1 button’s digital signal attached to the given loop.

left_paddle2(loop: EventLoop | None = None) Trigger[source]

Constructs a Trigger instance around the Left Paddle 2 button’s digital signal.

Parameters:

loop – the event loop instance to attach the Trigger to, defaults to commands2.CommandScheduler.get_default_button_loop()

Returns:

a Trigger instance representing the Left Paddle 2 button’s digital signal attached to the given loop.

left_stick(loop: EventLoop | None = None) Trigger[source]

Constructs a Trigger instance around the Left Stick button’s digital signal.

Parameters:

loop – the event loop instance to attach the Trigger to, defaults to commands2.CommandScheduler.get_default_button_loop()

Returns:

a Trigger instance representing the Left Stick button’s digital signal attached to the given loop.

left_stick_touch(loop: EventLoop | None = None) Trigger[source]

Constructs a Trigger instance around the Left Stick Touch button’s digital signal.

Parameters:

loop – the event loop instance to attach the Trigger to, defaults to commands2.CommandScheduler.get_default_button_loop()

Returns:

a Trigger instance representing the Left Stick Touch button’s digital signal attached to the given loop.

left_touchpad(loop: EventLoop | None = None) Trigger[source]

Constructs a Trigger instance around the Left Touchpad button’s digital signal.

Parameters:

loop – the event loop instance to attach the Trigger to, defaults to commands2.CommandScheduler.get_default_button_loop()

Returns:

a Trigger instance representing the Left Touchpad button’s digital signal attached to the given loop.

left_trigger(threshold: float = 0.5, loop: EventLoop | None = None) Trigger[source]

Constructs a Trigger instance around the Left Trigger axis value. The returned Trigger will be true when the axis value is greater than threshold.

Parameters:
  • threshold – the minimum axis value for the returned Trigger to be true. This value should be in the range [0, 1] where 0 is the unpressed state of the axis.

  • loop – the event loop instance to attach the Trigger to, defaults to commands2.CommandScheduler.get_default_button_loop()

Returns:

a Trigger instance that is true when the Left Trigger axis exceeds the provided threshold, attached to the given event loop.

menu(loop: EventLoop | None = None) Trigger[source]

Constructs a Trigger instance around the Menu button’s digital signal.

Parameters:

loop – the event loop instance to attach the Trigger to, defaults to commands2.CommandScheduler.get_default_button_loop()

Returns:

a Trigger instance representing the Menu button’s digital signal attached to the given loop.

qam(loop: EventLoop | None = None) Trigger[source]

Constructs a Trigger instance around the QAM button’s digital signal.

Parameters:

loop – the event loop instance to attach the Trigger to, defaults to commands2.CommandScheduler.get_default_button_loop()

Returns:

a Trigger instance representing the QAM button’s digital signal attached to the given loop.

right_bumper(loop: EventLoop | None = None) Trigger[source]

Constructs a Trigger instance around the Right Bumper button’s digital signal.

Parameters:

loop – the event loop instance to attach the Trigger to, defaults to commands2.CommandScheduler.get_default_button_loop()

Returns:

a Trigger instance representing the Right Bumper button’s digital signal attached to the given loop.

right_grip_touch(loop: EventLoop | None = None) Trigger[source]

Constructs a Trigger instance around the Right Grip Touch button’s digital signal.

Parameters:

loop – the event loop instance to attach the Trigger to, defaults to commands2.CommandScheduler.get_default_button_loop()

Returns:

a Trigger instance representing the Right Grip Touch button’s digital signal attached to the given loop.

right_paddle1(loop: EventLoop | None = None) Trigger[source]

Constructs a Trigger instance around the Right Paddle 1 button’s digital signal.

Parameters:

loop – the event loop instance to attach the Trigger to, defaults to commands2.CommandScheduler.get_default_button_loop()

Returns:

a Trigger instance representing the Right Paddle 1 button’s digital signal attached to the given loop.

right_paddle2(loop: EventLoop | None = None) Trigger[source]

Constructs a Trigger instance around the Right Paddle 2 button’s digital signal.

Parameters:

loop – the event loop instance to attach the Trigger to, defaults to commands2.CommandScheduler.get_default_button_loop()

Returns:

a Trigger instance representing the Right Paddle 2 button’s digital signal attached to the given loop.

right_stick(loop: EventLoop | None = None) Trigger[source]

Constructs a Trigger instance around the Right Stick button’s digital signal.

Parameters:

loop – the event loop instance to attach the Trigger to, defaults to commands2.CommandScheduler.get_default_button_loop()

Returns:

a Trigger instance representing the Right Stick button’s digital signal attached to the given loop.

right_stick_touch(loop: EventLoop | None = None) Trigger[source]

Constructs a Trigger instance around the Right Stick Touch button’s digital signal.

Parameters:

loop – the event loop instance to attach the Trigger to, defaults to commands2.CommandScheduler.get_default_button_loop()

Returns:

a Trigger instance representing the Right Stick Touch button’s digital signal attached to the given loop.

right_touchpad(loop: EventLoop | None = None) Trigger[source]

Constructs a Trigger instance around the Right Touchpad button’s digital signal.

Parameters:

loop – the event loop instance to attach the Trigger to, defaults to commands2.CommandScheduler.get_default_button_loop()

Returns:

a Trigger instance representing the Right Touchpad button’s digital signal attached to the given loop.

right_trigger(threshold: float = 0.5, loop: EventLoop | None = None) Trigger[source]

Constructs a Trigger instance around the Right Trigger axis value. The returned Trigger will be true when the axis value is greater than threshold.

Parameters:
  • threshold – the minimum axis value for the returned Trigger to be true. This value should be in the range [0, 1] where 0 is the unpressed state of the axis.

  • loop – the event loop instance to attach the Trigger to, defaults to commands2.CommandScheduler.get_default_button_loop()

Returns:

a Trigger instance that is true when the Right Trigger axis exceeds the provided threshold, attached to the given event loop.

steam(loop: EventLoop | None = None) Trigger[source]

Constructs a Trigger instance around the Steam button’s digital signal.

Parameters:

loop – the event loop instance to attach the Trigger to, defaults to commands2.CommandScheduler.get_default_button_loop()

Returns:

a Trigger instance representing the Steam button’s digital signal attached to the given loop.

view(loop: EventLoop | None = None) Trigger[source]

Constructs a Trigger instance around the View button’s digital signal.

Parameters:

loop – the event loop instance to attach the Trigger to, defaults to commands2.CommandScheduler.get_default_button_loop()

Returns:

a Trigger instance representing the View button’s digital signal attached to the given loop.

x(loop: EventLoop | None = None) Trigger[source]

Constructs a Trigger instance around the X button’s digital signal.

Parameters:

loop – the event loop instance to attach the Trigger to, defaults to commands2.CommandScheduler.get_default_button_loop()

Returns:

a Trigger instance representing the X button’s digital signal attached to the given loop.

y(loop: EventLoop | None = None) Trigger[source]

Constructs a Trigger instance around the Y button’s digital signal.

Parameters:

loop – the event loop instance to attach the Trigger to, defaults to commands2.CommandScheduler.get_default_button_loop()

Returns:

a Trigger instance representing the Y button’s digital signal attached to the given loop.