Class SwerveStates

java.lang.Object
frc.robot.swerve.SwerveStates

public class SwerveStates extends Object
  • Constructor Details

    • SwerveStates

      public SwerveStates()
  • Method Details

    • robotInNeutralZone

      public static Trigger robotInNeutralZone()
    • robotInEnemyZone

      public static Trigger robotInEnemyZone()
    • setupDefaultCommand

      protected static void setupDefaultCommand()
    • setStates

      protected static void setStates()
    • pilotDrive

      protected static Command 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

      protected static Command 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

      protected static Command pilotAimAtTargetBlue()
    • autonAimAtTarget

      public static Command autonAimAtTarget()
    • fpvDrive

      protected static Command 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

      protected static Command 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

      protected static Command 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

      protected static Command tweakOut()
      Tweak the robot's orientation by a small angle back and forth.
      Returns:
      A command that repeatedly tweaks the robot's orientation.
    • xBrake

      protected static Command xBrake()
      Turn the swerve wheels to an X to prevent the robot from moving.
    • pilotAimDrive

      protected static Command pilotAimDrive(DoubleSupplier targetDegrees)
      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 meters
      yGoalMeters - The y goal in meters
      headingRadians - The heading goal in radians
      Returns:
      A command that aligns the robot to the specified x, y, and heading goals
    • headingLockDrive

      protected static Command headingLockDrive()
    • lockToClosest45Drive

      protected static Command lockToClosest45Drive()
    • resetXController

      protected static Command resetXController()
    • resetYController

      protected static Command resetYController()
    • resetTurnController

      protected static Command resetTurnController()
    • setTargetHeading

      protected static Command setTargetHeading(DoubleSupplier targetHeading)
    • fpvAimDrive

      protected static Command fpvAimDrive(DoubleSupplier velocityX, DoubleSupplier velocityY, DoubleSupplier targetRadians)
    • aimDrive

      protected static Command aimDrive(DoubleSupplier velocityX, DoubleSupplier velocityY, DoubleSupplier targetRadians)
    • headingLock

      protected static Command headingLock(DoubleSupplier velocityX, DoubleSupplier velocityY)
    • lockToClosest45deg

      protected static Command lockToClosest45deg(DoubleSupplier velocityX, DoubleSupplier velocityY)
    • getWheelRadiusCharacterizationPositions

      public static double[] getWheelRadiusCharacterizationPositions()
    • wheelRadiusCharacterization

      public static Command 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

      protected static Command reorientForward()
    • reorientLeft

      protected static Command reorientLeft()
    • reorientBack

      protected static Command reorientBack()
    • reorientRight

      protected static Command reorientRight()
    • cardinalReorient

      protected static Command cardinalReorient()
    • log

      protected static Command log(Command cmd)