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
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.
-
Field Summary
Fields inherited from class com.stuypulse.stuylib.input.Gamepad
ANALOG_THRESHOLD
-
Constructor Summary
-
Method Summary
Methods inherited from class com.stuypulse.stuylib.input.Gamepad
getBottomButton, getDPad, getDPadDown, getDPadLeft, getDPadRight, getDPadUp, getDPadX, getDPadY, getLeftBumper, getLeftButton, getLeftMenuButton, getLeftStick, getLeftStickButton, getLeftStickDown, getLeftStickLeft, getLeftStickRight, getLeftStickUp, getLeftTriggerButton, getLeftTriggerPressed, getRightBumper, getRightButton, getRightMenuButton, getRightStick, getRightStickButton, getRightStickDown, getRightStickLeft, getRightStickRight, getRightStickUp, getRightTriggerButton, getRightTriggerPressed, getTopButton, initSendable
-
Constructor Details
-
AutoGamepad
public AutoGamepad(int port) - Parameters:
port
- the port that the gamepad should read from
-
-
Method Details
-
getDetectedGamepad
- Returns:
- the internal gamepad class that this gamepad will be reading from
-
getGamepadName
- Overrides:
getGamepadName
in classGamepad
- Returns:
- The name of the gamepad being used
-
getLeftX
public double getLeftX() -
getLeftY
public double getLeftY() -
getRightX
public double getRightX() -
getRightY
public double getRightY() -
getRawDPadUp
public boolean getRawDPadUp()- Overrides:
getRawDPadUp
in classGamepad
- Returns:
- If the up d-pad button is pressed
-
getRawDPadDown
public boolean getRawDPadDown()- Overrides:
getRawDPadDown
in classGamepad
- Returns:
- If the down d-pad button is pressed
-
getRawDPadLeft
public boolean getRawDPadLeft()- Overrides:
getRawDPadLeft
in classGamepad
- Returns:
- If the left d-pad button is pressed
-
getRawDPadRight
public boolean getRawDPadRight()- Overrides:
getRawDPadRight
in classGamepad
- Returns:
- If the right d-pad button is pressed
-
getRawLeftBumper
public boolean getRawLeftBumper()- Overrides:
getRawLeftBumper
in classGamepad
- Returns:
- If the left bumper is pressed
-
getRawRightBumper
public boolean getRawRightBumper()- Overrides:
getRawRightBumper
in classGamepad
- Returns:
- If the right bumper is pressed
-
getLeftTrigger
public double getLeftTrigger()- Overrides:
getLeftTrigger
in classGamepad
- Returns:
- The amount that the left trigger is pressed
-
getRightTrigger
public double getRightTrigger()- Overrides:
getRightTrigger
in classGamepad
- Returns:
- The amount that the right trigger is pressed
-
getRawLeftButton
public boolean getRawLeftButton()- Overrides:
getRawLeftButton
in classGamepad
- Returns:
- If the face button on the left is pressed
-
getRawBottomButton
public boolean getRawBottomButton()- Overrides:
getRawBottomButton
in classGamepad
- Returns:
- If the face button on the bottom is pressed
-
getRawRightButton
public boolean getRawRightButton()- Overrides:
getRawRightButton
in classGamepad
- Returns:
- If the face button on the right is pressed
-
getRawTopButton
public boolean getRawTopButton()- Overrides:
getRawTopButton
in classGamepad
- Returns:
- If the face button on the top is pressed
-
getRawLeftMenuButton
public boolean getRawLeftMenuButton()- Overrides:
getRawLeftMenuButton
in classGamepad
- Returns:
- If the left menu button is pressed
-
getRawRightMenuButton
public boolean getRawRightMenuButton()- Overrides:
getRawRightMenuButton
in classGamepad
- Returns:
- If the right menu button is pressed
-
getRawLeftStickButton
public boolean getRawLeftStickButton()- Overrides:
getRawLeftStickButton
in classGamepad
- Returns:
- If the left analog stick is pressed down
-
getRawRightStickButton
public boolean getRawRightStickButton()- Overrides:
getRawRightStickButton
in classGamepad
- Returns:
- If the right analog stick is pressed down
-
setRumble
public void setRumble(double intensity)
-