Class CommandSwitchProController

java.lang.Object
org.wpilib.command3.button.CommandSwitchProController

public class CommandSwitchProController extends Object
A version of SwitchProController with Trigger factories for command-based.
See Also:
  • Constructor Summary

    Constructors
    Constructor
    Description
    Construct an instance of a controller.
    CommandSwitchProController(Scheduler scheduler, int port)
    Construct an instance of a controller.
    Construct an instance of a controller.
    Construct an instance of a controller.
  • Method Summary

    Modifier and Type
    Method
    Description
    a()
    Constructs a Trigger instance around the A button's digital signal.
    a(EventLoop loop)
    Constructs a Trigger instance around the A button's digital signal.
    b()
    Constructs a Trigger instance around the B button's digital signal.
    b(EventLoop loop)
    Constructs a Trigger instance around the B button's digital signal.
    Constructs a Trigger instance around the Capture button's digital signal.
    Constructs a Trigger instance around the Capture button's digital signal.
    Constructs a Trigger instance around the Dpad Down button's digital signal.
    Constructs a Trigger instance around the Dpad Down button's digital signal.
    Constructs a Trigger instance around the Dpad Left button's digital signal.
    Constructs a Trigger instance around the Dpad Left button's digital signal.
    Constructs a Trigger instance around the Dpad Right button's digital signal.
    Constructs a Trigger instance around the Dpad Right button's digital signal.
    Constructs a Trigger instance around the Dpad Up button's digital signal.
    Constructs a Trigger instance around the Dpad Up button's digital signal.
    Get the wrapped controller object.
    Get the underlying CommandGenericHID object.
    double
    Get the Left X value of the controller.
    double
    Get the Left Y value of the controller.
    double
    Get the Right X value of the controller.
    double
    Get the Right Y value of the controller.
    double
    Get the ZL value of the controller.
    double
    Get the ZR value of the controller.
    Constructs a Trigger instance around the Home button's digital signal.
    Constructs a Trigger instance around the Home button's digital signal.
    L()
    Constructs a Trigger instance around the L button's digital signal.
    L(EventLoop loop)
    Constructs a Trigger instance around the L button's digital signal.
    Constructs a Trigger instance around the Left Stick button's digital signal.
    Constructs a Trigger instance around the Left Stick button's digital signal.
    Constructs a Trigger instance around the Minus button's digital signal.
    Constructs a Trigger instance around the Minus button's digital signal.
    Constructs a Trigger instance around the Plus button's digital signal.
    Constructs a Trigger instance around the Plus button's digital signal.
    R()
    Constructs a Trigger instance around the R button's digital signal.
    R(EventLoop loop)
    Constructs a Trigger instance around the R button's digital signal.
    Constructs a Trigger instance around the Right Stick button's digital signal.
    Constructs a Trigger instance around the Right Stick button's digital signal.
    x()
    Constructs a Trigger instance around the X button's digital signal.
    x(EventLoop loop)
    Constructs a Trigger instance around the X button's digital signal.
    y()
    Constructs a Trigger instance around the Y button's digital signal.
    y(EventLoop loop)
    Constructs a Trigger instance around the Y button's digital signal.
    ZL()
    Constructs a Trigger instance around the axis value of the ZL.
    ZL(double threshold)
    Constructs a Trigger instance around the axis value of the ZL.
    ZL(double threshold, EventLoop loop)
    Constructs a Trigger instance around the axis value of the ZL.
    ZR()
    Constructs a Trigger instance around the axis value of the ZR.
    ZR(double threshold)
    Constructs a Trigger instance around the axis value of the ZR.
    ZR(double threshold, EventLoop loop)
    Constructs a Trigger instance around the axis value of the ZR.

    Methods inherited from class Object

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

    • CommandSwitchProController

      public CommandSwitchProController(int port)
      Construct an instance of a controller. Commands bound to buttons on the controller will be scheduled on the default scheduler using its default event loop.
      Parameters:
      port - The port index on the Driver Station that the controller is plugged into.
    • CommandSwitchProController

      public CommandSwitchProController(SwitchProController controller)
      Construct an instance of a controller. Commands bound to buttons on the controller will be scheduled on the default scheduler using its default event loop.
      Parameters:
      controller - The SwitchProController object to use for this controller.
    • CommandSwitchProController

      public CommandSwitchProController(Scheduler scheduler, int port)
      Construct an instance of a controller. Commands bound to buttons on the controller will be scheduled on the given scheduler using its default event loop.
      Parameters:
      scheduler - The scheduler that should execute the triggered commands.
      port - The port index on the Driver Station that the controller is plugged into.
    • CommandSwitchProController

      public CommandSwitchProController(Scheduler scheduler, SwitchProController controller)
      Construct an instance of a controller. Commands bound to buttons on the controller will be scheduled on the given scheduler using its default event loop.
      Parameters:
      scheduler - The scheduler that should execute the triggered commands.
      controller - The SwitchProController object to use for this controller.
  • Method Details

    • getHID

      public CommandGenericHID getHID()
      Get the underlying CommandGenericHID object.
      Returns:
      the wrapped CommandGenericHID object
    • getController

      public SwitchProController getController()
      Get the wrapped controller object.
      Returns:
      the wrapped controller object
    • b

      public Trigger b()
      Constructs a Trigger instance around the B button's digital signal.
      Returns:
      a Trigger instance representing the B button's digital signal attached to the default scheduler event loop on the scheduler passed to the controller's constructor, or the default scheduler if a scheduler was not explicitly provided.
      See Also:
    • b

      public Trigger b(EventLoop loop)
      Constructs a Trigger instance around the B button's digital signal.
      Parameters:
      loop - the event loop instance to attach the event to.
      Returns:
      a Trigger instance representing the B button's digital signal attached to the given loop.
    • a

      public Trigger a()
      Constructs a Trigger instance around the A button's digital signal.
      Returns:
      a Trigger instance representing the A button's digital signal attached to the default scheduler event loop on the scheduler passed to the controller's constructor, or the default scheduler if a scheduler was not explicitly provided.
      See Also:
    • a

      public Trigger a(EventLoop loop)
      Constructs a Trigger instance around the A button's digital signal.
      Parameters:
      loop - the event loop instance to attach the event to.
      Returns:
      a Trigger instance representing the A button's digital signal attached to the given loop.
    • y

      public Trigger y()
      Constructs a Trigger instance around the Y button's digital signal.
      Returns:
      a Trigger instance representing the Y button's digital signal attached to the default scheduler event loop on the scheduler passed to the controller's constructor, or the default scheduler if a scheduler was not explicitly provided.
      See Also:
    • y

      public Trigger y(EventLoop loop)
      Constructs a Trigger instance around the Y button's digital signal.
      Parameters:
      loop - the event loop instance to attach the event to.
      Returns:
      a Trigger instance representing the Y button's digital signal attached to the given loop.
    • x

      public Trigger x()
      Constructs a Trigger instance around the X button's digital signal.
      Returns:
      a Trigger instance representing the X button's digital signal attached to the default scheduler event loop on the scheduler passed to the controller's constructor, or the default scheduler if a scheduler was not explicitly provided.
      See Also:
    • x

      public Trigger x(EventLoop loop)
      Constructs a Trigger instance around the X button's digital signal.
      Parameters:
      loop - the event loop instance to attach the event to.
      Returns:
      a Trigger instance representing the X button's digital signal attached to the given loop.
    • minus

      public Trigger minus()
      Constructs a Trigger instance around the Minus button's digital signal.
      Returns:
      a Trigger instance representing the Minus button's digital signal attached to the default scheduler event loop on the scheduler passed to the controller's constructor, or the default scheduler if a scheduler was not explicitly provided.
      See Also:
    • minus

      public Trigger minus(EventLoop loop)
      Constructs a Trigger instance around the Minus button's digital signal.
      Parameters:
      loop - the event loop instance to attach the event to.
      Returns:
      a Trigger instance representing the Minus button's digital signal attached to the given loop.
    • home

      public Trigger home()
      Constructs a Trigger instance around the Home button's digital signal.
      Returns:
      a Trigger instance representing the Home button's digital signal attached to the default scheduler event loop on the scheduler passed to the controller's constructor, or the default scheduler if a scheduler was not explicitly provided.
      See Also:
    • home

      public Trigger home(EventLoop loop)
      Constructs a Trigger instance around the Home button's digital signal.
      Parameters:
      loop - the event loop instance to attach the event to.
      Returns:
      a Trigger instance representing the Home button's digital signal attached to the given loop.
    • plus

      public Trigger plus()
      Constructs a Trigger instance around the Plus button's digital signal.
      Returns:
      a Trigger instance representing the Plus button's digital signal attached to the default scheduler event loop on the scheduler passed to the controller's constructor, or the default scheduler if a scheduler was not explicitly provided.
      See Also:
    • plus

      public Trigger plus(EventLoop loop)
      Constructs a Trigger instance around the Plus button's digital signal.
      Parameters:
      loop - the event loop instance to attach the event to.
      Returns:
      a Trigger instance representing the Plus button's digital signal attached to the given loop.
    • leftStick

      public Trigger leftStick()
      Constructs a Trigger instance around the Left Stick button's digital signal.
      Returns:
      a Trigger instance representing the Left Stick button's digital signal attached to the default scheduler event loop on the scheduler passed to the controller's constructor, or the default scheduler if a scheduler was not explicitly provided.
      See Also:
    • leftStick

      public Trigger leftStick(EventLoop loop)
      Constructs a Trigger instance around the Left Stick button's digital signal.
      Parameters:
      loop - the event loop instance to attach the event to.
      Returns:
      a Trigger instance representing the Left Stick button's digital signal attached to the given loop.
    • rightStick

      public Trigger rightStick()
      Constructs a Trigger instance around the Right Stick button's digital signal.
      Returns:
      a Trigger instance representing the Right Stick button's digital signal attached to the default scheduler event loop on the scheduler passed to the controller's constructor, or the default scheduler if a scheduler was not explicitly provided.
      See Also:
    • rightStick

      public Trigger rightStick(EventLoop loop)
      Constructs a Trigger instance around the Right Stick button's digital signal.
      Parameters:
      loop - the event loop instance to attach the event to.
      Returns:
      a Trigger instance representing the Right Stick button's digital signal attached to the given loop.
    • L

      public Trigger L()
      Constructs a Trigger instance around the L button's digital signal.
      Returns:
      a Trigger instance representing the L button's digital signal attached to the default scheduler event loop on the scheduler passed to the controller's constructor, or the default scheduler if a scheduler was not explicitly provided.
      See Also:
    • L

      public Trigger L(EventLoop loop)
      Constructs a Trigger instance around the L button's digital signal.
      Parameters:
      loop - the event loop instance to attach the event to.
      Returns:
      a Trigger instance representing the L button's digital signal attached to the given loop.
    • R

      public Trigger R()
      Constructs a Trigger instance around the R button's digital signal.
      Returns:
      a Trigger instance representing the R button's digital signal attached to the default scheduler event loop on the scheduler passed to the controller's constructor, or the default scheduler if a scheduler was not explicitly provided.
      See Also:
    • R

      public Trigger R(EventLoop loop)
      Constructs a Trigger instance around the R button's digital signal.
      Parameters:
      loop - the event loop instance to attach the event to.
      Returns:
      a Trigger instance representing the R button's digital signal attached to the given loop.
    • dpadUp

      public Trigger dpadUp()
      Constructs a Trigger instance around the Dpad Up button's digital signal.
      Returns:
      a Trigger instance representing the Dpad Up button's digital signal attached to the default scheduler event loop on the scheduler passed to the controller's constructor, or the default scheduler if a scheduler was not explicitly provided.
      See Also:
    • dpadUp

      public Trigger dpadUp(EventLoop loop)
      Constructs a Trigger instance around the Dpad Up button's digital signal.
      Parameters:
      loop - the event loop instance to attach the event to.
      Returns:
      a Trigger instance representing the Dpad Up button's digital signal attached to the given loop.
    • dpadDown

      public Trigger dpadDown()
      Constructs a Trigger instance around the Dpad Down button's digital signal.
      Returns:
      a Trigger instance representing the Dpad Down button's digital signal attached to the default scheduler event loop on the scheduler passed to the controller's constructor, or the default scheduler if a scheduler was not explicitly provided.
      See Also:
    • dpadDown

      public Trigger dpadDown(EventLoop loop)
      Constructs a Trigger instance around the Dpad Down button's digital signal.
      Parameters:
      loop - the event loop instance to attach the event to.
      Returns:
      a Trigger instance representing the Dpad Down button's digital signal attached to the given loop.
    • dpadLeft

      public Trigger dpadLeft()
      Constructs a Trigger instance around the Dpad Left button's digital signal.
      Returns:
      a Trigger instance representing the Dpad Left button's digital signal attached to the default scheduler event loop on the scheduler passed to the controller's constructor, or the default scheduler if a scheduler was not explicitly provided.
      See Also:
    • dpadLeft

      public Trigger dpadLeft(EventLoop loop)
      Constructs a Trigger instance around the Dpad Left button's digital signal.
      Parameters:
      loop - the event loop instance to attach the event to.
      Returns:
      a Trigger instance representing the Dpad Left button's digital signal attached to the given loop.
    • dpadRight

      public Trigger dpadRight()
      Constructs a Trigger instance around the Dpad Right button's digital signal.
      Returns:
      a Trigger instance representing the Dpad Right button's digital signal attached to the default scheduler event loop on the scheduler passed to the controller's constructor, or the default scheduler if a scheduler was not explicitly provided.
      See Also:
    • dpadRight

      public Trigger dpadRight(EventLoop loop)
      Constructs a Trigger instance around the Dpad Right button's digital signal.
      Parameters:
      loop - the event loop instance to attach the event to.
      Returns:
      a Trigger instance representing the Dpad Right button's digital signal attached to the given loop.
    • capture

      public Trigger capture()
      Constructs a Trigger instance around the Capture button's digital signal.
      Returns:
      a Trigger instance representing the Capture button's digital signal attached to the default scheduler event loop on the scheduler passed to the controller's constructor, or the default scheduler if a scheduler was not explicitly provided.
      See Also:
    • capture

      public Trigger capture(EventLoop loop)
      Constructs a Trigger instance around the Capture button's digital signal.
      Parameters:
      loop - the event loop instance to attach the event to.
      Returns:
      a Trigger instance representing the Capture button's digital signal attached to the given loop.
    • ZL

      public Trigger ZL(double threshold, EventLoop loop)
      Constructs a Trigger instance around the axis value of the ZL. The returned trigger will be true when the axis value is greater than 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.
      Returns:
      a Trigger instance that is true when the ZL axis exceeds the provided threshold, attached to the given event loop
    • ZL

      public Trigger ZL(double threshold)
      Constructs a Trigger instance around the axis value of the ZL. The returned trigger will be true when the axis value is greater than 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.
      Returns:
      a Trigger instance that is true when the ZL axis exceeds the provided threshold, attached to the default scheduler event loop on the scheduler passed to the controller's constructor, or the default scheduler if a scheduler was not explicitly provided.
    • ZL

      public Trigger ZL()
      Constructs a Trigger instance around the axis value of the ZL. The returned trigger will be true when the axis value is greater than 0.5.
      Returns:
      a Trigger instance that is true when the ZL axis exceeds 0.5, attached to the default scheduler event loop on the scheduler passed to the controller's constructor, or the default scheduler if a scheduler was not explicitly provided.
    • ZR

      public Trigger ZR(double threshold, EventLoop loop)
      Constructs a Trigger instance around the axis value of the ZR. The returned trigger will be true when the axis value is greater than 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.
      Returns:
      a Trigger instance that is true when the ZR axis exceeds the provided threshold, attached to the given event loop
    • ZR

      public Trigger ZR(double threshold)
      Constructs a Trigger instance around the axis value of the ZR. The returned trigger will be true when the axis value is greater than 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.
      Returns:
      a Trigger instance that is true when the ZR axis exceeds the provided threshold, attached to the default scheduler event loop on the scheduler passed to the controller's constructor, or the default scheduler if a scheduler was not explicitly provided.
    • ZR

      public Trigger ZR()
      Constructs a Trigger instance around the axis value of the ZR. The returned trigger will be true when the axis value is greater than 0.5.
      Returns:
      a Trigger instance that is true when the ZR axis exceeds 0.5, attached to the default scheduler event loop on the scheduler passed to the controller's constructor, or the default scheduler if a scheduler was not explicitly provided.
    • getLeftX

      public double getLeftX()
      Get the Left X value of the controller.
      Returns:
      The axis value.
    • getLeftY

      public double getLeftY()
      Get the Left Y value of the controller.
      Returns:
      The axis value.
    • getRightX

      public double getRightX()
      Get the Right X value of the controller.
      Returns:
      The axis value.
    • getRightY

      public double getRightY()
      Get the Right Y value of the controller.
      Returns:
      The axis value.
    • getZL

      public double getZL()
      Get the ZL value of the controller.
      Returns:
      The axis value.
    • getZR

      public double getZR()
      Get the ZR value of the controller.
      Returns:
      The axis value.