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
Constructors -
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:
getGamepadNamein 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:
getRawDPadUpin classGamepad- Returns:
- If the up d-pad button is pressed
-
getRawDPadDown
public boolean getRawDPadDown()- Overrides:
getRawDPadDownin classGamepad- Returns:
- If the down d-pad button is pressed
-
getRawDPadLeft
public boolean getRawDPadLeft()- Overrides:
getRawDPadLeftin classGamepad- Returns:
- If the left d-pad button is pressed
-
getRawDPadRight
public boolean getRawDPadRight()- Overrides:
getRawDPadRightin classGamepad- Returns:
- If the right d-pad button is pressed
-
getRawLeftBumper
public boolean getRawLeftBumper()- Overrides:
getRawLeftBumperin classGamepad- Returns:
- If the left bumper is pressed
-
getRawRightBumper
public boolean getRawRightBumper()- Overrides:
getRawRightBumperin classGamepad- Returns:
- If the right bumper is pressed
-
getLeftTrigger
public double getLeftTrigger()- Overrides:
getLeftTriggerin classGamepad- Returns:
- The amount that the left trigger is pressed
-
getRightTrigger
public double getRightTrigger()- Overrides:
getRightTriggerin classGamepad- Returns:
- The amount that the right trigger is pressed
-
getRawLeftButton
public boolean getRawLeftButton()- Overrides:
getRawLeftButtonin classGamepad- Returns:
- If the face button on the left is pressed
-
getRawBottomButton
public boolean getRawBottomButton()- Overrides:
getRawBottomButtonin classGamepad- Returns:
- If the face button on the bottom is pressed
-
getRawRightButton
public boolean getRawRightButton()- Overrides:
getRawRightButtonin classGamepad- Returns:
- If the face button on the right is pressed
-
getRawTopButton
public boolean getRawTopButton()- Overrides:
getRawTopButtonin classGamepad- Returns:
- If the face button on the top is pressed
-
getRawLeftMenuButton
public boolean getRawLeftMenuButton()- Overrides:
getRawLeftMenuButtonin classGamepad- Returns:
- If the left menu button is pressed
-
getRawRightMenuButton
public boolean getRawRightMenuButton()- Overrides:
getRawRightMenuButtonin classGamepad- Returns:
- If the right menu button is pressed
-
getRawLeftStickButton
public boolean getRawLeftStickButton()- Overrides:
getRawLeftStickButtonin classGamepad- Returns:
- If the left analog stick is pressed down
-
getRawRightStickButton
public boolean getRawRightStickButton()- Overrides:
getRawRightStickButtonin classGamepad- Returns:
- If the right analog stick is pressed down
-
setRumble
public void setRumble(double intensity)
-