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