Class PARTsController

java.lang.Object
org.parts3492.partslib.input.PARTsController

public class PARTsController extends Object
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static enum 
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    PARTsController(int port)
    Creates a new PARTsController that defaults to the PARTsController.ControllerType.XBOX type.
    PARTsController(int port, boolean disableAutoDetection)
    Creates a new PARTsController that defaults to the PARTsController.ControllerType.XBOX type.
     
  • Method Summary

    Modifier and Type
    Method
    Description
    edu.wpi.first.wpilibj.event.BooleanEvent
    a(edu.wpi.first.wpilibj.event.EventLoop loop)
    Constructs an event instance around the A button's digital signal.
    edu.wpi.first.wpilibj.event.BooleanEvent
    b(edu.wpi.first.wpilibj.event.EventLoop loop)
    Constructs an event instance around the B button's digital signal.
    edu.wpi.first.wpilibj.event.BooleanEvent
    back(edu.wpi.first.wpilibj.event.EventLoop loop)
    Constructs an event instance around the back button's digital signal.
    boolean
    Read the value of the A button on the controller.
    boolean
    Whether the A button was pressed since the last check.
    boolean
    Whether the A button was released since the last check.
    boolean
    Read the value of the back button on the controller.
    boolean
    Whether the back button was pressed since the last check.
    boolean
    Whether the back button was released since the last check.
    boolean
    Read the value of the B button on the controller.
    boolean
    Whether the B button was pressed since the last check.
    boolean
    Whether the B button was released since the last check.
    boolean
    Read the value of the left bumper button on the controller.
    boolean
    Whether the left bumper button was pressed since the last check.
    boolean
    Whether the left bumper button was released since the last check.
    boolean
    Read the value of the left stick button on the controller.
    boolean
    Whether the left stick button was pressed since the last check.
    boolean
    Whether the left stick button was released since the last check.
    double
    Get the left trigger axis value of the controller.
    double
    Get the X axis value of left side of the controller.
    double
    Get the Y axis value of left side of the controller.
    boolean
    Read the value of the right bumper button on the controller.
    boolean
    Whether the right bumper button was pressed since the last check.
    boolean
    Whether the right bumper button was released since the last check.
    boolean
    Read the value of the right stick button on the controller.
    boolean
    Whether the right stick button was pressed since the last check.
    boolean
    Whether the right stick button was released since the last check.
    double
    Get the right trigger axis value of the controller.
    double
    Get the X axis value of right side of the controller.
    double
    Get the Y axis value of right side of the controller.
    boolean
    Read the value of the start button on the controller.
    boolean
    Whether the start button was pressed since the last check.
    boolean
    Whether the start button was released since the last check.
    boolean
    Read the value of the X button on the controller.
    boolean
    Whether the X button was pressed since the last check.
    boolean
    Whether the X button was released since the last check.
    boolean
    Read the value of the Y button on the controller.
    boolean
    Whether the Y button was pressed since the last check.
    boolean
    Whether the Y button was released since the last check.
    edu.wpi.first.wpilibj.event.BooleanEvent
    leftBumper(edu.wpi.first.wpilibj.event.EventLoop loop)
    Constructs an event instance around the left bumper button's digital signal.
    edu.wpi.first.wpilibj.event.BooleanEvent
    leftStick(edu.wpi.first.wpilibj.event.EventLoop loop)
    Constructs an event instance around the left stick button's digital signal.
    edu.wpi.first.wpilibj.event.BooleanEvent
    leftTrigger(double threshold, edu.wpi.first.wpilibj.event.EventLoop loop)
    Constructs an event instance around the axis value of the left trigger.
    edu.wpi.first.wpilibj.event.BooleanEvent
    leftTrigger(edu.wpi.first.wpilibj.event.EventLoop loop)
    Constructs an event instance around the axis value of the left trigger.
    edu.wpi.first.wpilibj.event.BooleanEvent
    rightBumper(edu.wpi.first.wpilibj.event.EventLoop loop)
    Constructs an event instance around the right bumper button's digital signal.
    edu.wpi.first.wpilibj.event.BooleanEvent
    rightStick(edu.wpi.first.wpilibj.event.EventLoop loop)
    Constructs an event instance around the right stick button's digital signal.
    edu.wpi.first.wpilibj.event.BooleanEvent
    rightTrigger(double threshold, edu.wpi.first.wpilibj.event.EventLoop loop)
    Constructs an event instance around the axis value of the right trigger.
    edu.wpi.first.wpilibj.event.BooleanEvent
    rightTrigger(edu.wpi.first.wpilibj.event.EventLoop loop)
    Constructs an event instance around the axis value of the right trigger.
    edu.wpi.first.wpilibj.event.BooleanEvent
    start(edu.wpi.first.wpilibj.event.EventLoop loop)
    Constructs an event instance around the start button's digital signal.
    edu.wpi.first.wpilibj.event.BooleanEvent
    x(edu.wpi.first.wpilibj.event.EventLoop loop)
    Constructs an event instance around the X button's digital signal.
    edu.wpi.first.wpilibj.event.BooleanEvent
    y(edu.wpi.first.wpilibj.event.EventLoop loop)
    Constructs an event instance around the Y button's digital signal.

    Methods inherited from class java.lang.Object

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

    • PARTsController

      public PARTsController(int port)
      Creates a new PARTsController that defaults to the PARTsController.ControllerType.XBOX type.
      Parameters:
      port - The controller port.
    • PARTsController

      public PARTsController(int port, boolean disableAutoDetection)
      Creates a new PARTsController that defaults to the PARTsController.ControllerType.XBOX type.
      Parameters:
      port - The controller port.
      disableAutoDetection - Disable the auto-detection and use the default controller.
    • PARTsController

      public PARTsController(int port, PARTsController.ControllerType controllerType)
  • Method Details

    • getLeftX

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

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

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

      public double getRightY()
      Get the Y axis value of right side of the controller. Back is positive.
      Returns:
      The axis value.
    • getLeftTriggerAxis

      public double getLeftTriggerAxis()
      Get the left trigger 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.
    • leftTrigger

      public edu.wpi.first.wpilibj.event.BooleanEvent leftTrigger(double threshold, edu.wpi.first.wpilibj.event.EventLoop loop)
      Constructs an event instance around the axis value of the left trigger. The returned trigger will be true when the axis value is greater than threshold.
      Parameters:
      threshold - the minimum axis value for the returned BooleanEvent 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 event to.
      Returns:
      an event instance that is true when the left trigger's axis exceeds the provided threshold, attached to the given event loop
    • leftTrigger

      public edu.wpi.first.wpilibj.event.BooleanEvent leftTrigger(edu.wpi.first.wpilibj.event.EventLoop loop)
      Constructs an event instance around the axis value of the left trigger. The returned trigger will be true when the axis value is greater than 0.5.
      Parameters:
      loop - the event loop instance to attach the event to.
      Returns:
      an event instance that is true when the left trigger's axis exceeds the provided threshold, attached to the given event loop
    • getRightTriggerAxis

      public double getRightTriggerAxis()
      Get the right trigger 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.
    • rightTrigger

      public edu.wpi.first.wpilibj.event.BooleanEvent rightTrigger(double threshold, edu.wpi.first.wpilibj.event.EventLoop loop)
      Constructs an event instance around the axis value of the right trigger. The returned trigger will be true when the axis value is greater than threshold.
      Parameters:
      threshold - the minimum axis value for the returned BooleanEvent 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 event to.
      Returns:
      an event instance that is true when the right trigger's axis exceeds the provided threshold, attached to the given event loop
    • rightTrigger

      public edu.wpi.first.wpilibj.event.BooleanEvent rightTrigger(edu.wpi.first.wpilibj.event.EventLoop loop)
      Constructs an event instance around the axis value of the right trigger. The returned trigger will be true when the axis value is greater than 0.5.
      Parameters:
      loop - the event loop instance to attach the event to.
      Returns:
      an event instance that is true when the right trigger's axis exceeds the provided threshold, attached to the given event loop
    • getAButton

      public boolean getAButton()
      Read the value of the A button on the controller.
      Returns:
      The state of the button.
    • getAButtonPressed

      public boolean getAButtonPressed()
      Whether the A button was pressed since the last check.
      Returns:
      Whether the button was pressed since the last check.
    • getAButtonReleased

      public boolean getAButtonReleased()
      Whether the A button was released since the last check.
      Returns:
      Whether the button was released since the last check.
    • a

      public edu.wpi.first.wpilibj.event.BooleanEvent a(edu.wpi.first.wpilibj.event.EventLoop loop)
      Constructs an event instance around the A button's digital signal.
      Parameters:
      loop - the event loop instance to attach the event to.
      Returns:
      an event instance representing the A button's digital signal attached to the given loop.
    • getBButton

      public boolean getBButton()
      Read the value of the B button on the controller.
      Returns:
      The state of the button.
    • getBButtonPressed

      public boolean getBButtonPressed()
      Whether the B button was pressed since the last check.
      Returns:
      Whether the button was pressed since the last check.
    • getBButtonReleased

      public boolean getBButtonReleased()
      Whether the B button was released since the last check.
      Returns:
      Whether the button was released since the last check.
    • b

      public edu.wpi.first.wpilibj.event.BooleanEvent b(edu.wpi.first.wpilibj.event.EventLoop loop)
      Constructs an event instance around the B button's digital signal.
      Parameters:
      loop - the event loop instance to attach the event to.
      Returns:
      an event instance representing the B button's digital signal attached to the given loop.
    • getXButton

      public boolean getXButton()
      Read the value of the X button on the controller.
      Returns:
      The state of the button.
    • getXButtonPressed

      public boolean getXButtonPressed()
      Whether the X button was pressed since the last check.
      Returns:
      Whether the button was pressed since the last check.
    • getXButtonReleased

      public boolean getXButtonReleased()
      Whether the X button was released since the last check.
      Returns:
      Whether the button was released since the last check.
    • x

      public edu.wpi.first.wpilibj.event.BooleanEvent x(edu.wpi.first.wpilibj.event.EventLoop loop)
      Constructs an event instance around the X button's digital signal.
      Parameters:
      loop - the event loop instance to attach the event to.
      Returns:
      an event instance representing the X button's digital signal attached to the given loop.
    • getYButton

      public boolean getYButton()
      Read the value of the Y button on the controller.
      Returns:
      The state of the button.
    • getYButtonPressed

      public boolean getYButtonPressed()
      Whether the Y button was pressed since the last check.
      Returns:
      Whether the button was pressed since the last check.
    • getYButtonReleased

      public boolean getYButtonReleased()
      Whether the Y button was released since the last check.
      Returns:
      Whether the button was released since the last check.
    • y

      public edu.wpi.first.wpilibj.event.BooleanEvent y(edu.wpi.first.wpilibj.event.EventLoop loop)
      Constructs an event instance around the Y button's digital signal.
      Parameters:
      loop - the event loop instance to attach the event to.
      Returns:
      an event instance representing the Y button's digital signal attached to the given loop.
    • getLeftBumperButton

      public boolean getLeftBumperButton()
      Read the value of the left bumper button on the controller.
      Returns:
      The state of the button.
    • getLeftBumperButtonPressed

      public boolean getLeftBumperButtonPressed()
      Whether the left bumper button was pressed since the last check.
      Returns:
      Whether the button was pressed since the last check.
    • getLeftBumperButtonReleased

      public boolean getLeftBumperButtonReleased()
      Whether the left bumper button was released since the last check.
      Returns:
      Whether the button was released since the last check.
    • leftBumper

      public edu.wpi.first.wpilibj.event.BooleanEvent leftBumper(edu.wpi.first.wpilibj.event.EventLoop loop)
      Constructs an event instance around the left bumper button's digital signal.
      Parameters:
      loop - the event loop instance to attach the event to.
      Returns:
      an event instance representing the left bumper button's digital signal attached to the given loop.
    • getRightBumperButton

      public boolean getRightBumperButton()
      Read the value of the right bumper button on the controller.
      Returns:
      The state of the button.
    • getRightBumperButtonPressed

      public boolean getRightBumperButtonPressed()
      Whether the right bumper button was pressed since the last check.
      Returns:
      Whether the button was pressed since the last check.
    • getRightBumperButtonReleased

      public boolean getRightBumperButtonReleased()
      Whether the right bumper button was released since the last check.
      Returns:
      Whether the button was released since the last check.
    • rightBumper

      public edu.wpi.first.wpilibj.event.BooleanEvent rightBumper(edu.wpi.first.wpilibj.event.EventLoop loop)
      Constructs an event instance around the right bumper button's digital signal.
      Parameters:
      loop - the event loop instance to attach the event to.
      Returns:
      an event instance representing the right bumper button's digital signal attached to the given loop.
    • getBackButton

      public boolean getBackButton()
      Read the value of the back button on the controller.
      Returns:
      The state of the button.
    • getBackButtonPressed

      public boolean getBackButtonPressed()
      Whether the back button was pressed since the last check.
      Returns:
      Whether the button was pressed since the last check.
    • getBackButtonReleased

      public boolean getBackButtonReleased()
      Whether the back button was released since the last check.
      Returns:
      Whether the button was released since the last check.
    • back

      public edu.wpi.first.wpilibj.event.BooleanEvent back(edu.wpi.first.wpilibj.event.EventLoop loop)
      Constructs an event instance around the back button's digital signal.
      Parameters:
      loop - the event loop instance to attach the event to.
      Returns:
      an event instance representing the back button's digital signal attached to the given loop.
    • getStartButton

      public boolean getStartButton()
      Read the value of the start button on the controller.
      Returns:
      The state of the button.
    • getStartButtonPressed

      public boolean getStartButtonPressed()
      Whether the start button was pressed since the last check.
      Returns:
      Whether the button was pressed since the last check.
    • getStartButtonReleased

      public boolean getStartButtonReleased()
      Whether the start button was released since the last check.
      Returns:
      Whether the button was released since the last check.
    • start

      public edu.wpi.first.wpilibj.event.BooleanEvent start(edu.wpi.first.wpilibj.event.EventLoop loop)
      Constructs an event instance around the start button's digital signal.
      Parameters:
      loop - the event loop instance to attach the event to.
      Returns:
      an event instance representing the start button's digital signal attached to the given loop.
    • getLeftStickButton

      public boolean getLeftStickButton()
      Read the value of the left stick button on the controller.
      Returns:
      The state of the button.
    • getLeftStickButtonPressed

      public boolean getLeftStickButtonPressed()
      Whether the left stick button was pressed since the last check.
      Returns:
      Whether the button was pressed since the last check.
    • getLeftStickButtonReleased

      public boolean getLeftStickButtonReleased()
      Whether the left stick button was released since the last check.
      Returns:
      Whether the button was released since the last check.
    • leftStick

      public edu.wpi.first.wpilibj.event.BooleanEvent leftStick(edu.wpi.first.wpilibj.event.EventLoop loop)
      Constructs an event instance around the left stick button's digital signal.
      Parameters:
      loop - the event loop instance to attach the event to.
      Returns:
      an event instance representing the left stick button's digital signal attached to the given loop.
    • getRightStickButton

      public boolean getRightStickButton()
      Read the value of the right stick button on the controller.
      Returns:
      The state of the button.
    • getRightStickButtonPressed

      public boolean getRightStickButtonPressed()
      Whether the right stick button was pressed since the last check.
      Returns:
      Whether the button was pressed since the last check.
    • getRightStickButtonReleased

      public boolean getRightStickButtonReleased()
      Whether the right stick button was released since the last check.
      Returns:
      Whether the button was released since the last check.
    • rightStick

      public edu.wpi.first.wpilibj.event.BooleanEvent rightStick(edu.wpi.first.wpilibj.event.EventLoop loop)
      Constructs an event instance around the right stick button's digital signal.
      Parameters:
      loop - the event loop instance to attach the event to.
      Returns:
      an event instance representing the right stick button's digital signal attached to the given loop.