Class DriveCalculator
java.lang.Object
frc.alotobots.library.subsystems.swervedrive.util.DriveCalculator
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic ChassisSpeedsgetChassisSpeeds(SwerveDriveSubsystem swerveDriveSubsystem) Gets the chassis speeds from driver input, applying field-relative conversions and speed scaling.static ChassisSpeedsgetChassisSpeeds(SwerveDriveSubsystem swerveDriveSubsystem, Optional<Double> xOverride, Optional<Double> yOverride, Optional<Double> rotationOverride) Gets the chassis speeds from driver input, with optional overrides for any axis.static ChassisSpeedsgetChassisSpeedsWithRotationOverride(SwerveDriveSubsystem swerveDriveSubsystem, double rotationOverride) Convenience method for overriding a single axis while using default values for othersstatic ChassisSpeedsgetChassisSpeedsWithXOverride(SwerveDriveSubsystem swerveDriveSubsystem, double xOverride) Convenience method for overriding a single axis while using default values for othersstatic ChassisSpeedsgetChassisSpeedsWithYOverride(SwerveDriveSubsystem swerveDriveSubsystem, double yOverride) Convenience method for overriding a single axis while using default values for othersstatic Translation2dgetDriverLinearVelocity(SwerveDriveSubsystem swerveDriveSubsystem) Gets the desired linear velocity vector from the driver's left joystick input.static doubleGets the desired rotational velocity from the driver's right joystick input.
-
Constructor Details
-
DriveCalculator
public DriveCalculator()
-
-
Method Details
-
getDriverLinearVelocity
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
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 subsystemxOverride- Optional override for the X (forward/backward) velocityyOverride- Optional override for the Y (left/right) velocityrotationOverride- 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 subsystemxOverride- 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 subsystemyOverride- 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 subsystemrotationOverride- Optional override for the rotational velocity- Returns:
- ChassisSpeeds with the rotation override applied
-