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

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

  • Method Details

    • getHID

      Get the underlying GenericHID object.
      Overrides:
      getHID in class CommandGenericHID
      Returns:
      the wrapped GenericHID object
    • L2

      public Trigger 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

      public Trigger L2​(EventLoop loop)
      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

      public Trigger 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

      public Trigger R2​(EventLoop loop)
      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

      public Trigger 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

      public Trigger L1​(EventLoop loop)
      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

      public Trigger 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

      public Trigger R1​(EventLoop loop)
      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

      public Trigger 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

      public Trigger L3​(EventLoop loop)
      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

      public Trigger 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

      public Trigger R3​(EventLoop loop)
      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

      public Trigger 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

      public Trigger square​(EventLoop loop)
      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

      public Trigger 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

      public Trigger cross​(EventLoop loop)
      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

      public Trigger 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

      public Trigger triangle​(EventLoop loop)
      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

      public Trigger 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

      public Trigger circle​(EventLoop loop)
      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

      public Trigger 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

      public Trigger share​(EventLoop loop)
      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

      public Trigger 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

      public Trigger PS​(EventLoop loop)
      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

      public Trigger 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

      public Trigger options​(EventLoop loop)
      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

      public Trigger 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

      public Trigger touchpad​(EventLoop loop)
      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

      public double getLeftX()
      Get the X axis value of left side of the controller.
      Returns:
      the axis value.
    • getRightX

      public double getRightX()
      Get the X axis value of right side of the controller.
      Returns:
      the axis value.
    • getLeftY

      public double getLeftY()
      Get the Y axis value of left side of the controller.
      Returns:
      the axis value.
    • getRightY

      public double getRightY()
      Get the Y axis value of right side of the controller.
      Returns:
      the axis value.
    • getL2Axis

      public double 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

      public double 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.