Package frc.spectrumLib.gamepads
Class Gamepad
java.lang.Object
frc.spectrumLib.gamepads.Gamepad
- All Implemented Interfaces:
Subsystem,SpectrumSubsystem
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Triggerprotected Triggerprotected Triggerprotected Triggerprotected Triggerstatic final Triggerprotected Triggerprotected Triggerprotected Triggerprotected final ExpCurveprotected Triggerprotected Triggerprotected Triggerprotected Triggerprotected Triggerprotected Triggerprotected final ExpCurveprotected Triggerprotected Triggerprotected Triggerprotected Triggerprotected Triggerprotected Triggerprotected Triggerprotected final ExpCurveprotected Triggerprotected Triggerprotected Trigger -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedGamepad(Gamepad.Config config) Constructs a Gamepad object with the specified configuration. -
Method Summary
Modifier and TypeMethodDescriptiondoubleGet proper stick angles for each alliancevoiddoubleprotected GenericHIDgetHID()doubledoubleprotected doubleprotected doublegetLeftX()protected doublegetLeftY()doubleFlips the stick direction for the red alliance.doubledoubleprotected doubleprotected doubleprotected doubleprotected GenericHIDprotected doublegetTwist()booleanleftStick(double threshold) leftXTrigger(Gamepad.Threshold t, double threshold) leftYTrigger(Gamepad.Threshold t, double threshold) voidperiodic()voidrightStick(double threshold) rightXTrigger(Gamepad.Threshold t, double threshold) rightYTrigger(Gamepad.Threshold t, double threshold) rumbleCommand(double intensity, double durationSeconds) Overloaded method for rumbleCommand that allows for the same intensity on both rumble motors.rumbleCommand(double leftIntensity, double rightIntensity, double durationSeconds) Command that can be used to rumble the pilot controller.rumbleCommand(Command command) Returns a new Command object that combines the given command with a rumble command.voidrumbleController(double leftIntensity, double rightIntensity) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface frc.spectrumLib.SpectrumSubsystem
setupDefaultCommand, setupStatesMethods inherited from interface edu.wpi.first.wpilibj2.command.Subsystem
defer, getCurrentCommand, getDefaultCommand, getName, idle, register, removeDefaultCommand, run, runEnd, runOnce, setDefaultCommand, simulationPeriodic, startEnd, startRun
-
Field Details
-
kFalse
-
A
-
B
-
X
-
Y
-
leftBumper
-
rightBumper
-
leftTrigger
-
rightTrigger
-
leftStickClick
-
rightStickClick
-
start
-
select
-
upDpad
-
downDpad
-
leftDpad
-
rightDpad
-
leftStickY
-
leftStickX
-
rightStickY
-
rightStickX
-
noBumpers
-
leftBumperOnly
-
rightBumperOnly
-
bothBumpers
-
noTriggers
-
leftTriggerOnly
-
rightTriggerOnly
-
bothTriggers
-
noModifiers
-
leftStickCurve
-
rightStickCurve
-
triggersCurve
-
teleop
-
autoMode
-
testMode
-
disabled
-
-
Constructor Details
-
Gamepad
Constructs a Gamepad object with the specified configuration.- Parameters:
config- the configuration object containing settings for the gamepadThe constructor initializes the following: - Superclass with port and attachment status from the configuration. - Curve objects for left stick, right stick, and triggers using exponential curves. - If the gamepad is attached, initializes the Xbox controller and its buttons, triggers, sticks, and D-pad.
-
-
Method Details
-
periodic
public void periodic() -
configure
public void configure() -
resetConfig
public void resetConfig() -
getLeftStickDirection
-
getRightStickDirection
-
getLeftStickCardinals
public double getLeftStickCardinals() -
getRightStickCardinals
public double getRightStickCardinals() -
getLeftStickMagnitude
public double getLeftStickMagnitude() -
getRightStickMagnitude
public double getRightStickMagnitude() -
chooseCardinalDirections
public double chooseCardinalDirections()Get proper stick angles for each alliance- Returns:
-
getBlueAllianceStickCardinals
public double getBlueAllianceStickCardinals() -
getRedAllianceStickCardinals
public double getRedAllianceStickCardinals()Flips the stick direction for the red alliance.- Returns:
-
leftYTrigger
-
leftXTrigger
-
rightYTrigger
-
rightXTrigger
-
rightStick
-
leftStick
-
rumbleCommand
Command that can be used to rumble the pilot controller. The intensity should be a value between 0 and 1, where 0 is no rumble and 1 is full rumble. The duration of the rumble is specified in seconds.- Parameters:
leftIntensity- the intensity of the left rumble motor (0 to 1)rightIntensity- the intensity of the right rumble motor (0 to 1)durationSeconds- the duration of the rumble in seconds- Returns:
- a Command object that can be used to rumble the controller with the specified intensities and duration
-
rumbleCommand
Overloaded method for rumbleCommand that allows for the same intensity on both rumble motors. The duration of the rumble is specified in seconds. The intensity should be a value between 0 and 1, where 0 is no rumble and 1 is full rumble.- Parameters:
intensity- the intensity of the rumble (0 to 1)durationSeconds- the duration of the rumble in seconds- Returns:
- a Command object that can be used to rumble the controller with the specified intensity and duration
-
rumbleCommand
Returns a new Command object that combines the given command with a rumble command. The rumble command has a rumble strength of 1 and a duration of 0.5 seconds. The name of the returned command is set to the name of the given command.- Parameters:
command- the command to be combined with the rumble command- Returns:
- a new Command object with rumble command
-
isConnected
public boolean isConnected() -
getRightTriggerAxis
protected double getRightTriggerAxis() -
getLeftTriggerAxis
protected double getLeftTriggerAxis() -
getTwist
protected double getTwist() -
getLeftX
protected double getLeftX() -
getLeftY
protected double getLeftY() -
getRightX
protected double getRightX() -
getRightY
protected double getRightY() -
getHID
-
getRumbleHID
-
rumbleController
public void rumbleController(double leftIntensity, double rightIntensity) -
getLeftStickCurve
-
getRightStickCurve
-
getTriggersCurve
-