Class CommandPS4Controller
java.lang.Object
edu.wpi.first.wpilibj2.command.button.CommandGenericHID
edu.wpi.first.wpilibj2.command.button.CommandPS4Controller
public class CommandPS4Controller extends CommandGenericHID
A version of
PS4Controller
with Trigger
factories for command-based.- See Also:
PS4Controller
-
Constructor Summary
Constructors Constructor Description CommandPS4Controller(int port)
Construct an instance of a device. -
Method Summary
Modifier and Type Method Description Trigger
circle()
Constructs an event instance around the circle button's digital signal.Trigger
circle(EventLoop loop)
Constructs an event instance around the circle button's digital signal.Trigger
cross()
Constructs an event instance around the cross button's digital signal.Trigger
cross(EventLoop loop)
Constructs an event instance around the cross button's digital signal.PS4Controller
getHID()
Get the underlying GenericHID object.double
getL2Axis()
Get the L2 axis value of the controller.double
getLeftX()
Get the X axis value of left side of the controller.double
getLeftY()
Get the Y axis value of left side of the controller.double
getR2Axis()
Get the R2 axis value of the controller.double
getRightX()
Get the X axis value of right side of the controller.double
getRightY()
Get the Y axis value of right side of the controller.Trigger
L1()
Constructs an event instance around the L1 button's digital signal.Trigger
L1(EventLoop loop)
Constructs an event instance around the L1 button's digital signal.Trigger
L2()
Constructs an event instance around the L2 button's digital signal.Trigger
L2(EventLoop loop)
Constructs an event instance around the L2 button's digital signal.Trigger
L3()
Constructs an event instance around the L3 button's digital signal.Trigger
L3(EventLoop loop)
Constructs an event instance around the L3 button's digital signal.Trigger
options()
Constructs an event instance around the options button's digital signal.Trigger
options(EventLoop loop)
Constructs an event instance around the options button's digital signal.Trigger
PS()
Constructs an event instance around the PS button's digital signal.Trigger
PS(EventLoop loop)
Constructs an event instance around the PS button's digital signal.Trigger
R1()
Constructs an event instance around the R1 button's digital signal.Trigger
R1(EventLoop loop)
Constructs an event instance around the R1 button's digital signal.Trigger
R2()
Constructs an event instance around the R2 button's digital signal.Trigger
R2(EventLoop loop)
Constructs an event instance around the R2 button's digital signal.Trigger
R3()
Constructs an event instance around the R3 button's digital signal.Trigger
R3(EventLoop loop)
Constructs an event instance around the R3 button's digital signal.Trigger
share()
Constructs an event instance around the share button's digital signal.Trigger
share(EventLoop loop)
Constructs an event instance around the share button's digital signal.Trigger
square()
Constructs an event instance around the square button's digital signal.Trigger
square(EventLoop loop)
Constructs an event instance around the square button's digital signal.Trigger
touchpad()
Constructs an event instance around the touchpad's digital signal.Trigger
touchpad(EventLoop loop)
Constructs an event instance around the touchpad's digital signal.Trigger
triangle()
Constructs an event instance around the triangle button's digital signal.Trigger
triangle(EventLoop loop)
Constructs an event instance around the triangle button's digital signal.Methods inherited from class edu.wpi.first.wpilibj2.command.button.CommandGenericHID
button, button, getRawAxis, pov, pov, povCenter, povDown, povDownLeft, povDownRight, povLeft, povRight, povUp, povUpLeft, povUpRight
-
Constructor Details
-
CommandPS4Controller
Construct an instance of a device.- Parameters:
port
- The port index on the Driver Station that the device is plugged into.
-
-
Method Details
-
getHID
Get the underlying GenericHID object.- Overrides:
getHID
in classCommandGenericHID
- Returns:
- the wrapped GenericHID object
-
L2
Constructs an event instance around the L2 button's digital signal.- Returns:
- an event instance representing the L2 button's digital signal attached to the
default scheduler button loop
.
-
L2
Constructs an event instance around the L2 button's digital signal.- Parameters:
loop
- the event loop instance to attach the event to.- Returns:
- an event instance representing the L2 button's digital signal attached to the given loop.
-
R2
Constructs an event instance around the R2 button's digital signal.- Returns:
- an event instance representing the R2 button's digital signal attached to the
default scheduler button loop
.
-
R2
Constructs an event instance around the R2 button's digital signal.- Parameters:
loop
- the event loop instance to attach the event to.- Returns:
- an event instance representing the R2 button's digital signal attached to the given loop.
-
L1
Constructs an event instance around the L1 button's digital signal.- Returns:
- an event instance representing the L1 button's digital signal attached to the
default scheduler button loop
.
-
L1
Constructs an event instance around the L1 button's digital signal.- Parameters:
loop
- the event loop instance to attach the event to.- Returns:
- an event instance representing the L1 button's digital signal attached to the given loop.
-
R1
Constructs an event instance around the R1 button's digital signal.- Returns:
- an event instance representing the R1 button's digital signal attached to the
default scheduler button loop
.
-
R1
Constructs an event instance around the R1 button's digital signal.- Parameters:
loop
- the event loop instance to attach the event to.- Returns:
- an event instance representing the R1 button's digital signal attached to the given loop.
-
L3
Constructs an event instance around the L3 button's digital signal.- Returns:
- an event instance representing the L3 button's digital signal attached to the
default scheduler button loop
.
-
L3
Constructs an event instance around the L3 button's digital signal.- Parameters:
loop
- the event loop instance to attach the event to.- Returns:
- an event instance representing the L3 button's digital signal attached to the given loop.
-
R3
Constructs an event instance around the R3 button's digital signal.- Returns:
- an event instance representing the R3 button's digital signal attached to the
default scheduler button loop
.
-
R3
Constructs an event instance around the R3 button's digital signal.- Parameters:
loop
- the event loop instance to attach the event to.- Returns:
- an event instance representing the R3 button's digital signal attached to the given loop.
-
square
Constructs an event instance around the square button's digital signal.- Returns:
- an event instance representing the square button's digital signal attached to the
default scheduler button loop
.
-
square
Constructs an event instance around the square button's digital signal.- Parameters:
loop
- the event loop instance to attach the event to.- Returns:
- an event instance representing the square button's digital signal attached to the given loop.
-
cross
Constructs an event instance around the cross button's digital signal.- Returns:
- an event instance representing the cross button's digital signal attached to the
default scheduler button loop
.
-
cross
Constructs an event instance around the cross button's digital signal.- Parameters:
loop
- the event loop instance to attach the event to.- Returns:
- an event instance representing the cross button's digital signal attached to the given loop.
-
triangle
Constructs an event instance around the triangle button's digital signal.- Returns:
- an event instance representing the triangle button's digital signal attached to the
default scheduler button loop
.
-
triangle
Constructs an event instance around the triangle button's digital signal.- Parameters:
loop
- the event loop instance to attach the event to.- Returns:
- an event instance representing the triangle button's digital signal attached to the given loop.
-
circle
Constructs an event instance around the circle button's digital signal.- Returns:
- an event instance representing the circle button's digital signal attached to the
default scheduler button loop
.
-
circle
Constructs an event instance around the circle button's digital signal.- Parameters:
loop
- the event loop instance to attach the event to.- Returns:
- an event instance representing the circle button's digital signal attached to the given loop.
-
share
Constructs an event instance around the share button's digital signal.- Returns:
- an event instance representing the share button's digital signal attached to the
default scheduler button loop
.
-
share
Constructs an event instance around the share button's digital signal.- Parameters:
loop
- the event loop instance to attach the event to.- Returns:
- an event instance representing the share button's digital signal attached to the given loop.
-
PS
Constructs an event instance around the PS button's digital signal.- Returns:
- an event instance representing the PS button's digital signal attached to the
default scheduler button loop
.
-
PS
Constructs an event instance around the PS button's digital signal.- Parameters:
loop
- the event loop instance to attach the event to.- Returns:
- an event instance representing the PS button's digital signal attached to the given loop.
-
options
Constructs an event instance around the options button's digital signal.- Returns:
- an event instance representing the options button's digital signal attached to the
default scheduler button loop
.
-
options
Constructs an event instance around the options button's digital signal.- Parameters:
loop
- the event loop instance to attach the event to.- Returns:
- an event instance representing the options button's digital signal attached to the given loop.
-
touchpad
Constructs an event instance around the touchpad's digital signal.- Returns:
- an event instance representing the touchpad's digital signal attached to the
default scheduler button loop
.
-
touchpad
Constructs an event instance around the touchpad's digital signal.- Parameters:
loop
- the event loop instance to attach the event to.- Returns:
- an event instance representing the touchpad's digital signal attached to the given loop.
-
getLeftX
Get the X axis value of left side of the controller.- Returns:
- the axis value.
-
getRightX
Get the X axis value of right side of the controller.- Returns:
- the axis value.
-
getLeftY
Get the Y axis value of left side of the controller.- Returns:
- the axis value.
-
getRightY
Get the Y axis value of right side of the controller.- Returns:
- the axis value.
-
getL2Axis
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.
-
getR2Axis
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.
-