CommandNiDsXboxController
- class commands2.button.CommandNiDsXboxController(port: int)[source]
Bases:
objectA version of NI DS XboxController with Trigger factories for command-based.
Construct an instance of a controller.
- Parameters:
port – The port index on the Driver Station that the controller is plugged into.
- a(loop: EventLoop | None = None) Trigger[source]
Constructs an event instance around the A button’s digital signal.
- Parameters:
loop – the event loop instance to attach the event to, defaults to
commands2.CommandScheduler.get_default_button_loop()- Returns:
an event instance representing the A button’s digital signal attached to the given loop.
- b(loop: EventLoop | None = None) Trigger[source]
Constructs an event instance around the B button’s digital signal.
- Parameters:
loop – the event loop instance to attach the event to, defaults to
commands2.CommandScheduler.get_default_button_loop()- Returns:
an event instance representing the B button’s digital signal attached to the given loop.
- back(loop: EventLoop | None = None) Trigger[source]
Constructs an event instance around the back button’s digital signal.
- Parameters:
loop – the event loop instance to attach the event to, defaults to
commands2.CommandScheduler.get_default_button_loop()- Returns:
an event instance representing the back button’s digital signal attached to the given loop.
- get_hid() CommandGenericHID[source]
Get the underlying CommandGenericHID object.
- Returns:
the wrapped CommandGenericHID object
- get_left_trigger_axis() float[source]
Get the left trigger (LT) axis value of the controller. Note that this axis is bound to the range of [0, 1] as opposed to the usual [-1, 1].
- Returns:
The axis value.
- get_left_x() float[source]
Get the X axis value of left side of the controller. Right is positive.
- Returns:
The axis value.
- get_left_y() float[source]
Get the Y axis value of left side of the controller. Back is positive.
- Returns:
The axis value.
- get_ni_ds_xbox_controller() NiDsXboxController[source]
Get the underlying NiDsXboxController object.
- Returns:
the wrapped NiDsXboxController object
- get_right_trigger_axis() float[source]
Get the right trigger (RT) axis value of the controller. Note that this axis is bound to the range of [0, 1] as opposed to the usual [-1, 1].
- Returns:
The axis value.
- get_right_x() float[source]
Get the X axis value of right side of the controller. Right is positive.
- Returns:
The axis value.
- get_right_y() float[source]
Get the Y axis value of right side of the controller. Back is positive.
- Returns:
The axis value.
- left_bumper(loop: EventLoop | None = None) Trigger[source]
Constructs an event instance around the left bumper’s digital signal.
- Parameters:
loop – the event loop instance to attach the event to, defaults to
commands2.CommandScheduler.get_default_button_loop()- Returns:
an event instance representing the right bumper’s digital signal attached to the given loop.
- left_stick(loop: EventLoop | None = None) Trigger[source]
Constructs an event instance around the left stick button’s digital signal.
- Parameters:
loop – the event loop instance to attach the event to, defaults to
commands2.CommandScheduler.get_default_button_loop()- Returns:
an event instance representing the left stick 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 axis value of the left trigger. The returned trigger will be true when the axis value is greater than {@code 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’s axis exceeds the provided threshold, attached to the given event loop
- right_bumper(loop: EventLoop | None = None) Trigger[source]
Constructs an event instance around the right bumper’s digital signal.
- Parameters:
loop – the event loop instance to attach the event to, defaults to
commands2.CommandScheduler.get_default_button_loop()- Returns:
an event instance representing the left bumper’s digital signal attached to the given loop.
- right_stick(loop: EventLoop | None = None) Trigger[source]
Constructs an event instance around the right stick button’s digital signal.
- Parameters:
loop – the event loop instance to attach the event to, defaults to
commands2.CommandScheduler.get_default_button_loop()- Returns:
an event instance representing the right stick 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 axis value of the right trigger. The returned trigger will be true when the axis value is greater than {@code 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’s axis exceeds the provided threshold, attached to the given event loop
- start(loop: EventLoop | None = None) Trigger[source]
Constructs an event instance around the start button’s digital signal.
- Parameters:
loop – the event loop instance to attach the event to, defaults to
commands2.CommandScheduler.get_default_button_loop()- Returns:
an event instance representing the start button’s digital signal attached to the given loop.
- x(loop: EventLoop | None = None) Trigger[source]
Constructs an event instance around the X button’s digital signal.
- Parameters:
loop – the event loop instance to attach the event to, defaults to
commands2.CommandScheduler.get_default_button_loop()- Returns:
an event instance representing the X button’s digital signal attached to the given loop.
- y(loop: EventLoop | None = None) Trigger[source]
Constructs an event instance around the Y button’s digital signal.
- Parameters:
loop – the event loop instance to attach the event to, defaults to
commands2.CommandScheduler.get_default_button_loop()- Returns:
an event instance representing the Y button’s digital signal attached to the given loop.