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 Trigger
protected Trigger
protected Trigger
protected Trigger
protected Trigger
static final Trigger
protected Trigger
protected Trigger
protected Trigger
protected final ExpCurve
protected Trigger
protected Trigger
protected Trigger
protected Trigger
protected Trigger
protected Trigger
protected final ExpCurve
protected Trigger
protected Trigger
protected Trigger
protected Trigger
protected Trigger
protected Trigger
protected Trigger
protected final ExpCurve
protected Trigger
protected Trigger
protected Trigger
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
Gamepad
(Gamepad.Config config) Constructs a Gamepad object with the specified configuration. -
Method Summary
Modifier and TypeMethodDescriptiondouble
Get proper stick angles for each alliancevoid
double
protected edu.wpi.first.wpilibj.GenericHID
getHID()
double
edu.wpi.first.math.geometry.Rotation2d
double
protected double
protected double
getLeftX()
protected double
getLeftY()
double
Flips the stick direction for the red alliance.double
edu.wpi.first.math.geometry.Rotation2d
double
protected double
protected double
protected double
protected edu.wpi.first.wpilibj.GenericHID
protected double
getTwist()
boolean
leftStick
(double threshold) leftXTrigger
(Gamepad.Threshold t, double threshold) leftYTrigger
(Gamepad.Threshold t, double threshold) void
periodic()
void
rightStick
(double threshold) rightXTrigger
(Gamepad.Threshold t, double threshold) rightYTrigger
(Gamepad.Threshold t, double threshold) edu.wpi.first.wpilibj2.command.Command
rumbleCommand
(double intensity, double durationSeconds) edu.wpi.first.wpilibj2.command.Command
rumbleCommand
(double leftIntensity, double rightIntensity, double durationSeconds) Command that can be used to rumble the pilot controlleredu.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.void
rumbleController
(double leftIntensity, double rightIntensity) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface frc.spectrumLib.SpectrumSubsystem
setupDefaultCommand, setupStates
Methods 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:
periodic
in 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
-