Package frc.robot.swerve
Class SwerveStates
java.lang.Object
frc.robot.swerve.SwerveStates
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected static CommandaimDrive(DoubleSupplier velocityX, DoubleSupplier velocityY, DoubleSupplier targetRadians) static CommandalignDrive(DoubleSupplier xGoalMeters, DoubleSupplier yGoalMeters, DoubleSupplier headingRadians) Align the robot to the given x, y, and heading goals.static Commandprotected static Commandprotected static CommandfpvAimDrive(DoubleSupplier velocityX, DoubleSupplier velocityY, DoubleSupplier targetRadians) protected static CommandfpvDrive()Drive the robot with its front bumper as the forward direction.static double[]protected static CommandheadingLock(DoubleSupplier velocityX, DoubleSupplier velocityY) protected static Commandprotected static CommandlockToClosest45deg(DoubleSupplier velocityX, DoubleSupplier velocityY) protected static Commandprotected static Commandprotected static Commandprotected static CommandDrive the robot with the front bumper trying to match the angle to the target.protected static CommandpilotAimDrive(DoubleSupplier targetDegrees) Drive the robot with the front bumper trying to match a target angle.protected static CommandDrive the robot using left stick and control orientation using the right stick.protected static Commandprotected static Commandprotected static Commandprotected static Commandprotected static Commandprotected static Commandprotected static Commandstatic Triggerstatic Triggerprotected static voidprotected static CommandsetTargetHeading(DoubleSupplier targetHeading) protected static voidprotected static CommandDrive the robot with the front bumper trying to match the robot's motion direction.protected static CommandDrive the robot with the robot's orientation snapping to the closest cardinal direction.protected static CommandtweakOut()Tweak the robot's orientation by a small angle back and forth.static CommandMeasures the robot's wheel radius by spinning in a circle.protected static CommandxBrake()Turn the swerve wheels to an X to prevent the robot from moving.
-
Constructor Details
-
SwerveStates
public SwerveStates()
-
-
Method Details
-
robotInNeutralZone
-
robotInEnemyZone
-
setupDefaultCommand
protected static void setupDefaultCommand() -
setStates
protected static void setStates() -
pilotDrive
Drive the robot using left stick and control orientation using the right stick.- Returns:
- A command that drives the robot with translation control from the left stick and rotation control from the right stick
-
pilotAimAtTargetRed
Drive the robot with the front bumper trying to match the angle to the target.- Returns:
- A command that drives the robot to match the angle to the target while allowing translation control with the left stick
-
pilotAimAtTargetBlue
-
autonAimAtTarget
-
fpvDrive
Drive the robot with its front bumper as the forward direction.- Returns:
- A command that drives the robot with the front bumper as the forward direction, using the left stick for translation and the right stick for rotation
-
snapSteerDrive
Drive the robot with the robot's orientation snapping to the closest cardinal direction.- Returns:
- A command that drives the robot with the robot's orientation snapping to the closest cardinal direction, using the left stick for translation
-
snakeDrive
Drive the robot with the front bumper trying to match the robot's motion direction.- Returns:
- A command that drives the robot with translation control from the left stick, while also trying to match the robot's motion direction with the robot angle
-
tweakOut
Tweak the robot's orientation by a small angle back and forth.- Returns:
- A command that repeatedly tweaks the robot's orientation.
-
xBrake
Turn the swerve wheels to an X to prevent the robot from moving. -
pilotAimDrive
Drive the robot with the front bumper trying to match a target angle.- Parameters:
targetDegrees- The target angle (expected to be in radians in current call sites)- Returns:
- A command that drives the robot to match the target angle while allowing translation control with the left stick
-
alignDrive
public static Command alignDrive(DoubleSupplier xGoalMeters, DoubleSupplier yGoalMeters, DoubleSupplier headingRadians) Align the robot to the given x, y, and heading goals.- Parameters:
xGoalMeters- The x goal in metersyGoalMeters- The y goal in metersheadingRadians- The heading goal in radians- Returns:
- A command that aligns the robot to the specified x, y, and heading goals
-
headingLockDrive
-
lockToClosest45Drive
-
resetXController
-
resetYController
-
resetTurnController
-
setTargetHeading
-
fpvAimDrive
protected static Command fpvAimDrive(DoubleSupplier velocityX, DoubleSupplier velocityY, DoubleSupplier targetRadians) -
aimDrive
protected static Command aimDrive(DoubleSupplier velocityX, DoubleSupplier velocityY, DoubleSupplier targetRadians) -
headingLock
-
lockToClosest45deg
-
getWheelRadiusCharacterizationPositions
public static double[] getWheelRadiusCharacterizationPositions() -
wheelRadiusCharacterization
Measures the robot's wheel radius by spinning in a circle. (Method from AdvantageKit).This command ramps up the robot's rotation rate to a specified maximum while recording the change in gyro angle and wheel positions. When the command is cancelled, it calculates and prints the effective wheel radius based on the recorded data.
-
reorientForward
-
reorientLeft
-
reorientBack
-
reorientRight
-
cardinalReorient
-
log
-