CommandSwitchN64Controller
- class commands2.button.CommandSwitchN64Controller(hid: int | SwitchN64Controller)[source]
Bases:
objectA version of
wpilib.SwitchN64ControllerwithTriggerfactories 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 SwitchN64Controller 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.SwitchN64Controller.Axisto readthreshold – 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.SwitchN64Controller.Axisto readthreshold – 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.SwitchN64Controller.Axisto readthreshold – 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:
button – the
wpilib.SwitchN64Controller.Buttonto readloop – the event loop instance to attach the event to
- c_down(loop: EventLoop | None = None) Trigger[source]
Constructs a Trigger instance around the C 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 C Down button’s digital signal attached to the given loop.
- c_left(loop: EventLoop | None = None) Trigger[source]
Constructs a Trigger instance around the C 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 C Left button’s digital signal attached to the given loop.
- c_right(loop: EventLoop | None = None) Trigger[source]
Constructs a Trigger instance around the C 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 C Right button’s digital signal attached to the given loop.
- c_up(loop: EventLoop | None = None) Trigger[source]
Constructs a Trigger instance around the C 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 C Up button’s digital signal attached to the given loop.
- capture(loop: EventLoop | None = None) Trigger[source]
Constructs a Trigger instance around the Capture 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 Capture button’s digital signal attached to the given loop.
- 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.SwitchN64Controller.Axisto read
- get_controller() SwitchN64Controller[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
- home(loop: EventLoop | None = None) Trigger[source]
Constructs a Trigger instance around the Home 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 Home button’s digital signal attached to the given loop.
- l(loop: EventLoop | None = None) Trigger[source]
Constructs a Trigger instance around the L 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 L button’s digital signal attached to the given loop.
- r(loop: EventLoop | None = None) Trigger[source]
Constructs a Trigger instance around the R 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 R button’s digital signal attached to the given loop.
- start(loop: EventLoop | None = None) Trigger[source]
Constructs a Trigger instance around the Start 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 Start button’s digital signal attached to the given loop.
- zr(threshold: float = 0.5, loop: EventLoop | None = None) Trigger[source]
Constructs a Trigger instance around the ZR 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 ZR axis exceeds the provided threshold, attached to the given event loop.