Class DriveCalculator

java.lang.Object
frc.alotobots.library.subsystems.swervedrive.util.DriveCalculator

public class DriveCalculator extends Object
  • Constructor Details

    • DriveCalculator

      public DriveCalculator()
  • Method Details

    • getDriverLinearVelocity

      public static Translation2d getDriverLinearVelocity(SwerveDriveSubsystem swerveDriveSubsystem)
      Gets the desired linear velocity vector from the driver's left joystick input.
    • getDriverRotation

      public static double getDriverRotation()
      Gets the desired rotational velocity from the driver's right joystick input.
    • getChassisSpeeds

      public static ChassisSpeeds getChassisSpeeds(SwerveDriveSubsystem swerveDriveSubsystem)
      Gets the chassis speeds from driver input, applying field-relative conversions and speed scaling.
    • getChassisSpeeds

      public static ChassisSpeeds getChassisSpeeds(SwerveDriveSubsystem swerveDriveSubsystem, Optional<Double> xOverride, Optional<Double> yOverride, Optional<Double> rotationOverride)
      Gets the chassis speeds from driver input, with optional overrides for any axis. Any provided value will override the joystick input for that axis.
      Parameters:
      swerveDriveSubsystem - The swerve drive subsystem
      xOverride - Optional override for the X (forward/backward) velocity
      yOverride - Optional override for the Y (left/right) velocity
      rotationOverride - Optional override for the rotational velocity
      Returns:
      ChassisSpeeds representing the desired robot motion
    • getChassisSpeedsWithXOverride

      public static ChassisSpeeds getChassisSpeedsWithXOverride(SwerveDriveSubsystem swerveDriveSubsystem, double xOverride)
      Convenience method for overriding a single axis while using default values for others
      Parameters:
      swerveDriveSubsystem - The swerve drive subsystem
      xOverride - Optional override for the X (forward/backward) velocity
      Returns:
      ChassisSpeeds with the X override applied
    • getChassisSpeedsWithYOverride

      public static ChassisSpeeds getChassisSpeedsWithYOverride(SwerveDriveSubsystem swerveDriveSubsystem, double yOverride)
      Convenience method for overriding a single axis while using default values for others
      Parameters:
      swerveDriveSubsystem - The swerve drive subsystem
      yOverride - Optional override for the Y (left/right) velocity
      Returns:
      ChassisSpeeds with the Y override applied
    • getChassisSpeedsWithRotationOverride

      public static ChassisSpeeds getChassisSpeedsWithRotationOverride(SwerveDriveSubsystem swerveDriveSubsystem, double rotationOverride)
      Convenience method for overriding a single axis while using default values for others
      Parameters:
      swerveDriveSubsystem - The swerve drive subsystem
      rotationOverride - Optional override for the rotational velocity
      Returns:
      ChassisSpeeds with the rotation override applied