Package frc.spectrumLib.gamepads
Class Gamepad
java.lang.Object
frc.spectrumLib.gamepads.Gamepad
- All Implemented Interfaces:
edu.wpi.first.wpilibj2.command.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 edu.wpi.first.wpilibj.GenericHIDgetHID()doubleedu.wpi.first.math.geometry.Rotation2ddoubleprotected doubleprotected doublegetLeftX()protected doublegetLeftY()doubleFlips the stick direction for the red alliance.doubleedu.wpi.first.math.geometry.Rotation2ddoubleprotected doubleprotected doubleprotected doubleprotected edu.wpi.first.wpilibj.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) edu.wpi.first.wpilibj2.command.CommandrumbleCommand(double intensity, double durationSeconds) edu.wpi.first.wpilibj2.command.CommandrumbleCommand(double leftIntensity, double rightIntensity, double durationSeconds) Command that can be used to rumble the pilot controlleredu.wpi.first.wpilibj2.command.CommandrumbleCommand(edu.wpi.first.wpilibj2.command.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, 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()- Specified by:
periodicin interfaceedu.wpi.first.wpilibj2.command.Subsystem
-
configure
public void configure() -
resetConfig
public void resetConfig() -
getLeftStickDirection
public edu.wpi.first.math.geometry.Rotation2d getLeftStickDirection() -
getRightStickDirection
public edu.wpi.first.math.geometry.Rotation2d 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
public edu.wpi.first.wpilibj2.command.Command rumbleCommand(double leftIntensity, double rightIntensity, double durationSeconds) Command that can be used to rumble the pilot controller -
rumbleCommand
public edu.wpi.first.wpilibj2.command.Command rumbleCommand(double intensity, double durationSeconds) -
rumbleCommand
public edu.wpi.first.wpilibj2.command.Command rumbleCommand(edu.wpi.first.wpilibj2.command.Command command) 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
protected edu.wpi.first.wpilibj.GenericHID getHID() -
getRumbleHID
protected edu.wpi.first.wpilibj.GenericHID getRumbleHID() -
rumbleController
public void rumbleController(double leftIntensity, double rightIntensity) -
getLeftStickCurve
-
getRightStickCurve
-
getTriggersCurve
-