CommandPS4Controller
- class commands2.button.CommandPS4Controller(port: int)[source]
Bases:
CommandGenericHID
A version of PS4Controller with Trigger factories for command-based.
Construct an instance of a device.
- Parameters:
port – The port index on the Driver Station that the device is plugged into.
- L1(loop: EventLoop | None = None) Trigger [source]
Constructs an event instance around the L1 button’s digital signal.
- Parameters:
loop – the event loop instance to attach the event to, defaults to
commands2.CommandScheduler.getDefaultButtonLoop()
- Returns:
an event instance representing the L1 button’s digital signal attached to the given loop.
- L2(loop: EventLoop | None = None) Trigger [source]
Constructs an event instance around the L2 button’s digital signal.
- Parameters:
loop – the event loop instance to attach the event to, defaults to
commands2.CommandScheduler.getDefaultButtonLoop()
- Returns:
an event instance representing the L2 button’s digital signal attached to the given loop.
- L3(loop: EventLoop | None = None) Trigger [source]
Constructs an event instance around the L3 button’s digital signal.
- Parameters:
loop – the event loop instance to attach the event to, defaults to
commands2.CommandScheduler.getDefaultButtonLoop()
- Returns:
an event instance representing the L3 button’s digital signal attached to the given loop.
- PS(loop: EventLoop | None = None) Trigger [source]
Constructs an event instance around the PS button’s digital signal.
- Parameters:
loop – the event loop instance to attach the event to, defaults to
commands2.CommandScheduler.getDefaultButtonLoop()
- Returns:
an event instance representing the PS button’s digital signal attached to the given loop.
- R1(loop: EventLoop | None = None) Trigger [source]
Constructs an event instance around the R1 button’s digital signal.
- Parameters:
loop – the event loop instance to attach the event to, defaults to
commands2.CommandScheduler.getDefaultButtonLoop()
- Returns:
an event instance representing the R1 button’s digital signal attached to the given loop.
- R2(loop: EventLoop | None = None) Trigger [source]
Constructs an event instance around the R2 button’s digital signal.
- Parameters:
loop – the event loop instance to attach the event to, defaults to
commands2.CommandScheduler.getDefaultButtonLoop()
- Returns:
an event instance representing the R2 button’s digital signal attached to the given loop.
- R3(loop: EventLoop | None = None) Trigger [source]
Constructs an event instance around the R3 button’s digital signal.
- Parameters:
loop – the event loop instance to attach the event to, defaults to
commands2.CommandScheduler.getDefaultButtonLoop()
- Returns:
an event instance representing the R3 button’s digital signal attached to the given loop.
- circle(loop: EventLoop | None = None) Trigger [source]
Constructs an event instance around the circle button’s digital signal.
- Parameters:
loop – the event loop instance to attach the event to, defaults to
commands2.CommandScheduler.getDefaultButtonLoop()
- Returns:
an event instance representing the circle button’s digital signal attached to the given loop.
- cross(loop: EventLoop | None = None) Trigger [source]
Constructs an event instance around the cross button’s digital signal.
- Parameters:
loop – the event loop instance to attach the event to, defaults to
commands2.CommandScheduler.getDefaultButtonLoop()
- Returns:
an event instance representing the cross button’s digital signal attached to the given loop.
- getHID() PS4Controller [source]
Get the underlying GenericHID object.
- Returns:
the wrapped GenericHID object
- getL2Axis() float [source]
Get the L2 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.
- getLeftX() float [source]
Get the X axis value of left side of the controller.
- Returns:
the axis value.
- getLeftY() float [source]
Get the Y axis value of left side of the controller.
- Returns:
the axis value.
- getR2Axis() float [source]
Get the R2 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.
- getRightX() float [source]
Get the X axis value of right side of the controller.
- Returns:
the axis value.
- getRightY() float [source]
Get the Y axis value of right side of the controller.
- Returns:
the axis value.
- options(loop: EventLoop | None = None) Trigger [source]
Constructs an event instance around the options button’s digital signal.
- Parameters:
loop – the event loop instance to attach the event to, defaults to
commands2.CommandScheduler.getDefaultButtonLoop()
- Returns:
an event instance representing the options button’s digital signal attached to the given loop.
Constructs an event instance around the share button’s digital signal.
- Parameters:
loop – the event loop instance to attach the event to, defaults to
commands2.CommandScheduler.getDefaultButtonLoop()
- Returns:
an event instance representing the share button’s digital signal attached to the given loop.
- square(loop: EventLoop | None = None) Trigger [source]
Constructs an event instance around the square button’s digital signal.
- Parameters:
loop – the event loop instance to attach the event to, defaults to
commands2.CommandScheduler.getDefaultButtonLoop()
- Returns:
an event instance representing the square button’s digital signal attached to the given loop.
- touchpad(loop: EventLoop | None = None) Trigger [source]
Constructs an event instance around the touchpad’s digital signal.
- Parameters:
loop – the event loop instance to attach the event to, defaults to
commands2.CommandScheduler.getDefaultButtonLoop()
- Returns:
an event instance representing the touchpad’s digital signal attached to the given loop.
- triangle(loop: EventLoop | None = None) Trigger [source]
Constructs an event instance around the triangle button’s digital signal.
- Parameters:
loop – the event loop instance to attach the event to, defaults to
commands2.CommandScheduler.getDefaultButtonLoop()
- Returns:
an event instance representing the triangle button’s digital signal attached to the given loop.