Class Gamepad

java.lang.Object
org.wpilib.driverstation.Gamepad
All Implemented Interfaces:
HIDDevice, TelemetryLoggable

public class Gamepad extends Object implements HIDDevice, TelemetryLoggable
Handle input from Gamepad controllers connected to the Driver Station.

This class handles Gamepad input that comes from the Driver Station. Each time a value is requested the most recent value is returned. There is a single class instance for each controller and the mapping of ports to hardware buttons depends on the code in the Driver Station.

  • Constructor Details

    • Gamepad

      public Gamepad(int port)
      Construct an instance of a gamepad.
      Parameters:
      port - The port index on the Driver Station that the gamepad is plugged into (0-5).
    • Gamepad

      public Gamepad(GenericHID hid)
      Construct an instance of a gamepad with a GenericHID object.
      Parameters:
      hid - The GenericHID object to use for this gamepad.
  • Method Details

    • getHID

      public GenericHID getHID()
      Get the underlying GenericHID object.
      Specified by:
      getHID in interface HIDDevice
      Returns:
      the wrapped GenericHID object
    • setLeftXDeadband

      public void setLeftXDeadband(double deadband)
      Set the deadband for the left X axis.

      The deadband is clamped to [0, 1).

      Parameters:
      deadband - The deadband to apply.
    • setLeftYDeadband

      public void setLeftYDeadband(double deadband)
      Set the deadband for the left Y axis.

      The deadband is clamped to [0, 1).

      Parameters:
      deadband - The deadband to apply.
    • setRightXDeadband

      public void setRightXDeadband(double deadband)
      Set the deadband for the right X axis.

      The deadband is clamped to [0, 1).

      Parameters:
      deadband - The deadband to apply.
    • setRightYDeadband

      public void setRightYDeadband(double deadband)
      Set the deadband for the right Y axis.

      The deadband is clamped to [0, 1).

      Parameters:
      deadband - The deadband to apply.
    • setLeftTriggerDeadband

      public void setLeftTriggerDeadband(double deadband)
      Set the deadband for the left trigger axis.

      The deadband is clamped to [0, 1).

      Parameters:
      deadband - The deadband to apply.
    • setRightTriggerDeadband

      public void setRightTriggerDeadband(double deadband)
      Set the deadband for the right trigger axis.

      The deadband is clamped to [0, 1).

      Parameters:
      deadband - The deadband to apply.
    • getLeftX

      public double getLeftX()
      Get the X axis value of left side of the controller. Right is positive.

      A deadband of 0.1 is applied by default. Use setLeftXDeadband(double) to change it.

      Returns:
      The axis value.
    • getLeftY

      public double getLeftY()
      Get the Y axis value of left side of the controller. Back is positive.

      A deadband of 0.1 is applied by default. Use setLeftYDeadband(double) to change it.

      Returns:
      The axis value.
    • getRightX

      public double getRightX()
      Get the X axis value of right side of the controller. Right is positive.

      A deadband of 0.1 is applied by default. Use setRightXDeadband(double) to change it.

      Returns:
      The axis value.
    • getRightY

      public double getRightY()
      Get the Y axis value of right side of the controller. Back is positive.

      A deadband of 0.1 is applied by default. Use setRightYDeadband(double) to change it.

      Returns:
      The axis value.
    • getLeftTrigger

      public double getLeftTrigger()
      Get the left trigger value of the controller. Note that this axis is bound to the range of [0, 1] as opposed to the usual [-1, 1].

      A deadband of 0.01 is applied by default. Use setLeftTriggerDeadband(double) to change it.

      Returns:
      The axis value.
    • leftTrigger

      public BooleanEvent leftTrigger(double threshold, 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 BooleanEvent leftTrigger(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
    • getRightTrigger

      public double getRightTrigger()
      Get the right trigger value of the controller. Note that this axis is bound to the range of [0, 1] as opposed to the usual [-1, 1].

      A deadband of 0.01 is applied by default. Use setRightTriggerDeadband(double) to change it.

      Returns:
      The axis value.
    • rightTrigger

      public BooleanEvent rightTrigger(double threshold, 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 BooleanEvent rightTrigger(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
    • getFaceDownButton

      public boolean getFaceDownButton()
      Read the value of the Face Down button on the controller.
      Returns:
      The state of the button.
    • getFaceDownButtonPressed

      public boolean getFaceDownButtonPressed()
      Whether the Face Down button was pressed since the last check.
      Returns:
      Whether the button was pressed since the last check.
    • getFaceDownButtonReleased

      public boolean getFaceDownButtonReleased()
      Whether the Face Down button was released since the last check.
      Returns:
      Whether the button was released since the last check.
    • faceDown

      public BooleanEvent faceDown(EventLoop loop)
      Constructs an event instance around the Face Down button's digital signal.
      Parameters:
      loop - the event loop instance to attach the event to.
      Returns:
      an event instance representing the Face Down button's digital signal attached to the given loop.
    • getFaceRightButton

      public boolean getFaceRightButton()
      Read the value of the Face Right button on the controller.
      Returns:
      The state of the button.
    • getFaceRightButtonPressed

      public boolean getFaceRightButtonPressed()
      Whether the Face Right button was pressed since the last check.
      Returns:
      Whether the button was pressed since the last check.
    • getFaceRightButtonReleased

      public boolean getFaceRightButtonReleased()
      Whether the Face Right button was released since the last check.
      Returns:
      Whether the button was released since the last check.
    • faceRight

      public BooleanEvent faceRight(EventLoop loop)
      Constructs an event instance around the Face Right button's digital signal.
      Parameters:
      loop - the event loop instance to attach the event to.
      Returns:
      an event instance representing the Face Right button's digital signal attached to the given loop.
    • getFaceLeftButton

      public boolean getFaceLeftButton()
      Read the value of the Face Left button on the controller.
      Returns:
      The state of the button.
    • getFaceLeftButtonPressed

      public boolean getFaceLeftButtonPressed()
      Whether the Face Left button was pressed since the last check.
      Returns:
      Whether the button was pressed since the last check.
    • getFaceLeftButtonReleased

      public boolean getFaceLeftButtonReleased()
      Whether the Face Left button was released since the last check.
      Returns:
      Whether the button was released since the last check.
    • faceLeft

      public BooleanEvent faceLeft(EventLoop loop)
      Constructs an event instance around the Face Left button's digital signal.
      Parameters:
      loop - the event loop instance to attach the event to.
      Returns:
      an event instance representing the Face Left button's digital signal attached to the given loop.
    • getFaceUpButton

      public boolean getFaceUpButton()
      Read the value of the Face Up button on the controller.
      Returns:
      The state of the button.
    • getFaceUpButtonPressed

      public boolean getFaceUpButtonPressed()
      Whether the Face Up button was pressed since the last check.
      Returns:
      Whether the button was pressed since the last check.
    • getFaceUpButtonReleased

      public boolean getFaceUpButtonReleased()
      Whether the Face Up button was released since the last check.
      Returns:
      Whether the button was released since the last check.
    • faceUp

      public BooleanEvent faceUp(EventLoop loop)
      Constructs an event instance around the Face Up button's digital signal.
      Parameters:
      loop - the event loop instance to attach the event to.
      Returns:
      an event instance representing the Face Up 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 BooleanEvent back(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.
    • getGuideButton

      public boolean getGuideButton()
      Read the value of the Guide button on the controller.
      Returns:
      The state of the button.
    • getGuideButtonPressed

      public boolean getGuideButtonPressed()
      Whether the Guide button was pressed since the last check.
      Returns:
      Whether the button was pressed since the last check.
    • getGuideButtonReleased

      public boolean getGuideButtonReleased()
      Whether the Guide button was released since the last check.
      Returns:
      Whether the button was released since the last check.
    • guide

      public BooleanEvent guide(EventLoop loop)
      Constructs an event instance around the Guide button's digital signal.
      Parameters:
      loop - the event loop instance to attach the event to.
      Returns:
      an event instance representing the Guide 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 BooleanEvent start(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 BooleanEvent leftStick(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 BooleanEvent rightStick(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.
    • getLeftBumperButton

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

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

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

      public BooleanEvent leftBumper(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.
    • 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 BooleanEvent rightBumper(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.
    • getDpadUpButton

      public boolean getDpadUpButton()
      Read the value of the D-pad up button on the controller.
      Returns:
      The state of the button.
    • getDpadUpButtonPressed

      public boolean getDpadUpButtonPressed()
      Whether the D-pad up button was pressed since the last check.
      Returns:
      Whether the button was pressed since the last check.
    • getDpadUpButtonReleased

      public boolean getDpadUpButtonReleased()
      Whether the D-pad up button was released since the last check.
      Returns:
      Whether the button was released since the last check.
    • dpadUp

      public BooleanEvent dpadUp(EventLoop loop)
      Constructs an event instance around the D-pad up button's digital signal.
      Parameters:
      loop - the event loop instance to attach the event to.
      Returns:
      an event instance representing the D-pad up button's digital signal attached to the given loop.
    • getDpadDownButton

      public boolean getDpadDownButton()
      Read the value of the D-pad down button on the controller.
      Returns:
      The state of the button.
    • getDpadDownButtonPressed

      public boolean getDpadDownButtonPressed()
      Whether the D-pad down button was pressed since the last check.
      Returns:
      Whether the button was pressed since the last check.
    • getDpadDownButtonReleased

      public boolean getDpadDownButtonReleased()
      Whether the D-pad down button was released since the last check.
      Returns:
      Whether the button was released since the last check.
    • dpadDown

      public BooleanEvent dpadDown(EventLoop loop)
      Constructs an event instance around the D-pad down button's digital signal.
      Parameters:
      loop - the event loop instance to attach the event to.
      Returns:
      an event instance representing the D-pad down button's digital signal attached to the given loop.
    • getDpadLeftButton

      public boolean getDpadLeftButton()
      Read the value of the D-pad left button on the controller.
      Returns:
      The state of the button.
    • getDpadLeftButtonPressed

      public boolean getDpadLeftButtonPressed()
      Whether the D-pad left button was pressed since the last check.
      Returns:
      Whether the button was pressed since the last check.
    • getDpadLeftButtonReleased

      public boolean getDpadLeftButtonReleased()
      Whether the D-pad left button was released since the last check.
      Returns:
      Whether the button was released since the last check.
    • dpadLeft

      public BooleanEvent dpadLeft(EventLoop loop)
      Constructs an event instance around the D-pad left button's digital signal.
      Parameters:
      loop - the event loop instance to attach the event to.
      Returns:
      an event instance representing the D-pad left button's digital signal attached to the given loop.
    • getDpadRightButton

      public boolean getDpadRightButton()
      Read the value of the D-pad right button on the controller.
      Returns:
      The state of the button.
    • getDpadRightButtonPressed

      public boolean getDpadRightButtonPressed()
      Whether the D-pad right button was pressed since the last check.
      Returns:
      Whether the button was pressed since the last check.
    • getDpadRightButtonReleased

      public boolean getDpadRightButtonReleased()
      Whether the D-pad right button was released since the last check.
      Returns:
      Whether the button was released since the last check.
    • dpadRight

      public BooleanEvent dpadRight(EventLoop loop)
      Constructs an event instance around the D-pad right button's digital signal.
      Parameters:
      loop - the event loop instance to attach the event to.
      Returns:
      an event instance representing the D-pad right button's digital signal attached to the given loop.
    • getMisc1Button

      public boolean getMisc1Button()
      Read the value of the Miscellaneous 1 button on the controller.
      Returns:
      The state of the button.
    • getMisc1ButtonPressed

      public boolean getMisc1ButtonPressed()
      Whether the Miscellaneous 1 button was pressed since the last check.
      Returns:
      Whether the button was pressed since the last check.
    • getMisc1ButtonReleased

      public boolean getMisc1ButtonReleased()
      Whether the Miscellaneous 1 button was released since the last check.
      Returns:
      Whether the button was released since the last check.
    • misc1

      public BooleanEvent misc1(EventLoop loop)
      Constructs an event instance around the Miscellaneous 1 button's digital signal.
      Parameters:
      loop - the event loop instance to attach the event to.
      Returns:
      an event instance representing the Miscellaneous 1 button's digital signal attached to the given loop.
    • getRightPaddle1Button

      public boolean getRightPaddle1Button()
      Read the value of the Right Paddle 1 button on the controller.
      Returns:
      The state of the button.
    • getRightPaddle1ButtonPressed

      public boolean getRightPaddle1ButtonPressed()
      Whether the Right Paddle 1 button was pressed since the last check.
      Returns:
      Whether the button was pressed since the last check.
    • getRightPaddle1ButtonReleased

      public boolean getRightPaddle1ButtonReleased()
      Whether the Right Paddle 1 button was released since the last check.
      Returns:
      Whether the button was released since the last check.
    • rightPaddle1

      public BooleanEvent rightPaddle1(EventLoop loop)
      Constructs an event instance around the Right Paddle 1 button's digital signal.
      Parameters:
      loop - the event loop instance to attach the event to.
      Returns:
      an event instance representing the Right Paddle 1 button's digital signal attached to the given loop.
    • getLeftPaddle1Button

      public boolean getLeftPaddle1Button()
      Read the value of the Left Paddle 1 button on the controller.
      Returns:
      The state of the button.
    • getLeftPaddle1ButtonPressed

      public boolean getLeftPaddle1ButtonPressed()
      Whether the Left Paddle 1 button was pressed since the last check.
      Returns:
      Whether the button was pressed since the last check.
    • getLeftPaddle1ButtonReleased

      public boolean getLeftPaddle1ButtonReleased()
      Whether the Left Paddle 1 button was released since the last check.
      Returns:
      Whether the button was released since the last check.
    • leftPaddle1

      public BooleanEvent leftPaddle1(EventLoop loop)
      Constructs an event instance around the Left Paddle 1 button's digital signal.
      Parameters:
      loop - the event loop instance to attach the event to.
      Returns:
      an event instance representing the Left Paddle 1 button's digital signal attached to the given loop.
    • getRightPaddle2Button

      public boolean getRightPaddle2Button()
      Read the value of the Right Paddle 2 button on the controller.
      Returns:
      The state of the button.
    • getRightPaddle2ButtonPressed

      public boolean getRightPaddle2ButtonPressed()
      Whether the Right Paddle 2 button was pressed since the last check.
      Returns:
      Whether the button was pressed since the last check.
    • getRightPaddle2ButtonReleased

      public boolean getRightPaddle2ButtonReleased()
      Whether the Right Paddle 2 button was released since the last check.
      Returns:
      Whether the button was released since the last check.
    • rightPaddle2

      public BooleanEvent rightPaddle2(EventLoop loop)
      Constructs an event instance around the Right Paddle 2 button's digital signal.
      Parameters:
      loop - the event loop instance to attach the event to.
      Returns:
      an event instance representing the Right Paddle 2 button's digital signal attached to the given loop.
    • getLeftPaddle2Button

      public boolean getLeftPaddle2Button()
      Read the value of the Left Paddle 2 button on the controller.
      Returns:
      The state of the button.
    • getLeftPaddle2ButtonPressed

      public boolean getLeftPaddle2ButtonPressed()
      Whether the Left Paddle 2 button was pressed since the last check.
      Returns:
      Whether the button was pressed since the last check.
    • getLeftPaddle2ButtonReleased

      public boolean getLeftPaddle2ButtonReleased()
      Whether the Left Paddle 2 button was released since the last check.
      Returns:
      Whether the button was released since the last check.
    • leftPaddle2

      public BooleanEvent leftPaddle2(EventLoop loop)
      Constructs an event instance around the Left Paddle 2 button's digital signal.
      Parameters:
      loop - the event loop instance to attach the event to.
      Returns:
      an event instance representing the Left Paddle 2 button's digital signal attached to the given loop.
    • getTouchpadButton

      public boolean getTouchpadButton()
      Read the value of the Touchpad button on the controller.
      Returns:
      The state of the button.
    • getTouchpadButtonPressed

      public boolean getTouchpadButtonPressed()
      Whether the Touchpad button was pressed since the last check.
      Returns:
      Whether the button was pressed since the last check.
    • getTouchpadButtonReleased

      public boolean getTouchpadButtonReleased()
      Whether the Touchpad button was released since the last check.
      Returns:
      Whether the button was released since the last check.
    • touchpad

      public BooleanEvent touchpad(EventLoop loop)
      Constructs an event instance around the Touchpad button's digital signal.
      Parameters:
      loop - the event loop instance to attach the event to.
      Returns:
      an event instance representing the Touchpad button's digital signal attached to the given loop.
    • getMisc2Button

      public boolean getMisc2Button()
      Read the value of the Miscellaneous 2 button on the controller.
      Returns:
      The state of the button.
    • getMisc2ButtonPressed

      public boolean getMisc2ButtonPressed()
      Whether the Miscellaneous 2 button was pressed since the last check.
      Returns:
      Whether the button was pressed since the last check.
    • getMisc2ButtonReleased

      public boolean getMisc2ButtonReleased()
      Whether the Miscellaneous 2 button was released since the last check.
      Returns:
      Whether the button was released since the last check.
    • misc2

      public BooleanEvent misc2(EventLoop loop)
      Constructs an event instance around the Miscellaneous 2 button's digital signal.
      Parameters:
      loop - the event loop instance to attach the event to.
      Returns:
      an event instance representing the Miscellaneous 2 button's digital signal attached to the given loop.
    • getMisc3Button

      public boolean getMisc3Button()
      Read the value of the Miscellaneous 3 button on the controller.
      Returns:
      The state of the button.
    • getMisc3ButtonPressed

      public boolean getMisc3ButtonPressed()
      Whether the Miscellaneous 3 button was pressed since the last check.
      Returns:
      Whether the button was pressed since the last check.
    • getMisc3ButtonReleased

      public boolean getMisc3ButtonReleased()
      Whether the Miscellaneous 3 button was released since the last check.
      Returns:
      Whether the button was released since the last check.
    • misc3

      public BooleanEvent misc3(EventLoop loop)
      Constructs an event instance around the Miscellaneous 3 button's digital signal.
      Parameters:
      loop - the event loop instance to attach the event to.
      Returns:
      an event instance representing the Miscellaneous 3 button's digital signal attached to the given loop.
    • getMisc4Button

      public boolean getMisc4Button()
      Read the value of the Miscellaneous 4 button on the controller.
      Returns:
      The state of the button.
    • getMisc4ButtonPressed

      public boolean getMisc4ButtonPressed()
      Whether the Miscellaneous 4 button was pressed since the last check.
      Returns:
      Whether the button was pressed since the last check.
    • getMisc4ButtonReleased

      public boolean getMisc4ButtonReleased()
      Whether the Miscellaneous 4 button was released since the last check.
      Returns:
      Whether the button was released since the last check.
    • misc4

      public BooleanEvent misc4(EventLoop loop)
      Constructs an event instance around the Miscellaneous 4 button's digital signal.
      Parameters:
      loop - the event loop instance to attach the event to.
      Returns:
      an event instance representing the Miscellaneous 4 button's digital signal attached to the given loop.
    • getMisc5Button

      public boolean getMisc5Button()
      Read the value of the Miscellaneous 5 button on the controller.
      Returns:
      The state of the button.
    • getMisc5ButtonPressed

      public boolean getMisc5ButtonPressed()
      Whether the Miscellaneous 5 button was pressed since the last check.
      Returns:
      Whether the button was pressed since the last check.
    • getMisc5ButtonReleased

      public boolean getMisc5ButtonReleased()
      Whether the Miscellaneous 5 button was released since the last check.
      Returns:
      Whether the button was released since the last check.
    • misc5

      public BooleanEvent misc5(EventLoop loop)
      Constructs an event instance around the Miscellaneous 5 button's digital signal.
      Parameters:
      loop - the event loop instance to attach the event to.
      Returns:
      an event instance representing the Miscellaneous 5 button's digital signal attached to the given loop.
    • getMisc6Button

      public boolean getMisc6Button()
      Read the value of the Miscellaneous 6 button on the controller.
      Returns:
      The state of the button.
    • getMisc6ButtonPressed

      public boolean getMisc6ButtonPressed()
      Whether the Miscellaneous 6 button was pressed since the last check.
      Returns:
      Whether the button was pressed since the last check.
    • getMisc6ButtonReleased

      public boolean getMisc6ButtonReleased()
      Whether the Miscellaneous 6 button was released since the last check.
      Returns:
      Whether the button was released since the last check.
    • misc6

      public BooleanEvent misc6(EventLoop loop)
      Constructs an event instance around the Miscellaneous 6 button's digital signal.
      Parameters:
      loop - the event loop instance to attach the event to.
      Returns:
      an event instance representing the Miscellaneous 6 button's digital signal attached to the given loop.
    • getButton

      public boolean getButton(Gamepad.Button button)
      Get the button value (starting at button 1).

      This method returns true if the button is being held down at the time that this method is being called.

      Parameters:
      button - The button
      Returns:
      The state of the button.
    • getButtonPressed

      public boolean getButtonPressed(Gamepad.Button button)
      Whether the button was pressed since the last check.

      This method returns true if the button went from not pressed to held down since the last time this method was called. This is useful if you only want to call a function once when you press the button.

      Parameters:
      button - The button
      Returns:
      Whether the button was pressed since the last check.
    • getButtonReleased

      public boolean getButtonReleased(Gamepad.Button button)
      Whether the button was released since the last check.

      This method returns true if the button went from held down to not pressed since the last time this method was called. This is useful if you only want to call a function once when you release the button.

      Parameters:
      button - The button
      Returns:
      Whether the button was released since the last check.
    • button

      public BooleanEvent button(Gamepad.Button button, EventLoop loop)
      Constructs an event instance around this button's digital signal.
      Parameters:
      button - the button
      loop - the event loop instance to attach the event to.
      Returns:
      an event instance representing the button's digital signal attached to the given loop.
    • getAxis

      public double getAxis(Gamepad.Axis axis)
      Get the value of the axis.
      Parameters:
      axis - The axis to read
      Returns:
      The value of the axis.
    • axisLessThan

      public BooleanEvent axisLessThan(Gamepad.Axis axis, double threshold, EventLoop loop)
      Constructs an event instance that is true when the axis value is less than threshold, attached to the given loop.
      Parameters:
      axis - The axis to read, starting at 0
      threshold - The value below which this event should return true.
      loop - the event loop instance to attach the event to.
      Returns:
      an event instance that is true when the axis value is less than the provided threshold.
    • axisGreaterThan

      public BooleanEvent axisGreaterThan(Gamepad.Axis axis, double threshold, EventLoop loop)
      Constructs an event instance that is true when the axis value is greater than threshold, attached to the given loop.
      Parameters:
      axis - The axis to read, starting at 0
      threshold - The value above which this event should return true.
      loop - the event loop instance to attach the event to.
      Returns:
      an event instance that is true when the axis value is greater than the provided threshold.
    • getAxesAvailable

      public int getAxesAvailable()
      Get the bitmask of axes for the gamepad.
      Returns:
      the number of axis for the current gamepad
    • getButtonsAvailable

      public long getButtonsAvailable()
      For the current gamepad, return the bitmask of available buttons.
      Returns:
      the bitmask of buttons for the current gamepad
    • isConnected

      public boolean isConnected()
      Get if the gamepad is connected.
      Returns:
      true if the gamepad is connected
    • getGamepadType

      public GenericHID.HIDType getGamepadType()
      Get the type of the gamepad.
      Returns:
      the type of the gamepad.
    • getSupportedOutputs

      public EnumSet<GenericHID.SupportedOutput> getSupportedOutputs()
      Get the supported outputs for the gamepad.
      Returns:
      the supported outputs for the gamepad.
    • getName

      public String getName()
      Get the name of the gamepad.
      Returns:
      the name of the gamepad.
    • setLeds

      public void setLeds(int r, int g, int b)
      Set leds on the gamepad. If only mono is supported, the system will use the highest value passed in.
      Parameters:
      r - Red value from 0-255
      g - Green value from 0-255
      b - Blue value from 0-255
    • setRumble

      public void setRumble(GenericHID.RumbleType type, double value)
      Set the rumble output for the HID. The DS currently supports 4 rumble values: left rumble, right rumble, left trigger rumble, and right trigger rumble.
      Parameters:
      type - Which rumble value to set
      value - The normalized value (0 to 1) to set the rumble to
    • getTouchpadFingerAvailable

      public boolean getTouchpadFingerAvailable(int touchpad, int finger)
      Check if a touchpad finger is available.
      Parameters:
      touchpad - The touchpad to check.
      finger - The finger to check.
      Returns:
      true if the touchpad finger is available.
    • getTouchpadFinger

      public TouchpadFinger getTouchpadFinger(int touchpad, int finger)
      Get the touchpad finger data.
      Parameters:
      touchpad - The touchpad to read.
      finger - The finger to read.
      Returns:
      The touchpad finger data.
    • logTo

      public void logTo(TelemetryTable table)
      Description copied from interface: TelemetryLoggable
      Logs the object to a TelemetryTable.
      Specified by:
      logTo in interface TelemetryLoggable
      Parameters:
      table - telemetry table
    • getTelemetryType

      public String getTelemetryType()
      Description copied from interface: TelemetryLoggable
      Gets the telemetry table type. Default is no specified table type (null). A mismatch in type during logging results in a reported warning, so this should always return the same value.
      Specified by:
      getTelemetryType in interface TelemetryLoggable
      Returns:
      Table type