Class AutoGamepad

java.lang.Object
com.stuypulse.stuylib.input.Gamepad
com.stuypulse.stuylib.input.gamepads.AutoGamepad
All Implemented Interfaces:
edu.wpi.first.util.sendable.Sendable

public final class AutoGamepad extends Gamepad
This class was created as a saftey measure to prevent issues that arise when the wrong gamepad is plugged in. After the robot smashed into a wall because we plugged in a PS4 controller when the code expected a Logitech controller, it was deemed that we needed this class. This class will ONLY RETURN SAFE VALUES, it will never return negatives or unusual values. This cannot be said about other gamepad classes.

The type of controllers supported are Logitech.DMode, Logitech.XMode, PS4, and Xbox. If none of these gamepads are detected, the code will default to a gamepad that does not do anything.

  • Constructor Details

    • AutoGamepad

      public AutoGamepad(int port)
      Parameters:
      port - the port that the gamepad should read from
  • Method Details

    • getDetectedGamepad

      public Gamepad getDetectedGamepad()
      Returns:
      the internal gamepad class that this gamepad will be reading from
    • getGamepadName

      public String getGamepadName()
      Overrides:
      getGamepadName in class Gamepad
      Returns:
      The name of the gamepad being used
    • getLeftX

      public double getLeftX()
      Overrides:
      getLeftX in class Gamepad
      Returns:
      The X position of the left analog stick
    • getLeftY

      public double getLeftY()
      Overrides:
      getLeftY in class Gamepad
      Returns:
      The Y position of the left analog stick
    • getRightX

      public double getRightX()
      Overrides:
      getRightX in class Gamepad
      Returns:
      The X position of the right analog stick
    • getRightY

      public double getRightY()
      Overrides:
      getRightY in class Gamepad
      Returns:
      The Y position of the right analog stick
    • getRawDPadUp

      public boolean getRawDPadUp()
      Overrides:
      getRawDPadUp in class Gamepad
      Returns:
      If the up d-pad button is pressed
    • getRawDPadDown

      public boolean getRawDPadDown()
      Overrides:
      getRawDPadDown in class Gamepad
      Returns:
      If the down d-pad button is pressed
    • getRawDPadLeft

      public boolean getRawDPadLeft()
      Overrides:
      getRawDPadLeft in class Gamepad
      Returns:
      If the left d-pad button is pressed
    • getRawDPadRight

      public boolean getRawDPadRight()
      Overrides:
      getRawDPadRight in class Gamepad
      Returns:
      If the right d-pad button is pressed
    • getRawLeftBumper

      public boolean getRawLeftBumper()
      Overrides:
      getRawLeftBumper in class Gamepad
      Returns:
      If the left bumper is pressed
    • getRawRightBumper

      public boolean getRawRightBumper()
      Overrides:
      getRawRightBumper in class Gamepad
      Returns:
      If the right bumper is pressed
    • getLeftTrigger

      public double getLeftTrigger()
      Overrides:
      getLeftTrigger in class Gamepad
      Returns:
      The amount that the left trigger is pressed
    • getRightTrigger

      public double getRightTrigger()
      Overrides:
      getRightTrigger in class Gamepad
      Returns:
      The amount that the right trigger is pressed
    • getRawLeftButton

      public boolean getRawLeftButton()
      Overrides:
      getRawLeftButton in class Gamepad
      Returns:
      If the face button on the left is pressed
    • getRawBottomButton

      public boolean getRawBottomButton()
      Overrides:
      getRawBottomButton in class Gamepad
      Returns:
      If the face button on the bottom is pressed
    • getRawRightButton

      public boolean getRawRightButton()
      Overrides:
      getRawRightButton in class Gamepad
      Returns:
      If the face button on the right is pressed
    • getRawTopButton

      public boolean getRawTopButton()
      Overrides:
      getRawTopButton in class Gamepad
      Returns:
      If the face button on the top is pressed
    • getRawLeftMenuButton

      public boolean getRawLeftMenuButton()
      Overrides:
      getRawLeftMenuButton in class Gamepad
      Returns:
      If the left menu button is pressed
    • getRawRightMenuButton

      public boolean getRawRightMenuButton()
      Overrides:
      getRawRightMenuButton in class Gamepad
      Returns:
      If the right menu button is pressed
    • getRawLeftStickButton

      public boolean getRawLeftStickButton()
      Overrides:
      getRawLeftStickButton in class Gamepad
      Returns:
      If the left analog stick is pressed down
    • getRawRightStickButton

      public boolean getRawRightStickButton()
      Overrides:
      getRawRightStickButton in class Gamepad
      Returns:
      If the right analog stick is pressed down
    • setRumble

      public void setRumble(double intensity)
      Overrides:
      setRumble in class Gamepad
      Parameters:
      intensity - amount to make the gamepad rumble