Package com.marslib.swerve
Class TractionControlLimiter
java.lang.Object
com.marslib.swerve.TractionControlLimiter
Advanced 2D Slew Rate Limiter to prevent carpet slippage and Odometry drift.
Standard WPILib SlewRateLimiters operate independently on X and Y axes. If both max out, the robot accelerates diagonally at 1.41x the limit, instantly breaking carpet friction. This class ensures the total 2D acceleration vector never exceeds the maximum static friction coefficient of the FRC carpet (usually ~1.1g or 10.78 m/s^2).
-
Constructor Summary
ConstructorsConstructorDescriptionTractionControlLimiter(double maxAccelMetersPerSecSq) Initializes the 2D Traction Control limit. -
Method Summary
Modifier and TypeMethodDescriptionedu.wpi.first.math.geometry.Translation2dcalculate(edu.wpi.first.math.geometry.Translation2d targetVelocity) Calculates the max achievable velocity vector without slipping tires.
-
Constructor Details
-
TractionControlLimiter
public TractionControlLimiter(double maxAccelMetersPerSecSq) Initializes the 2D Traction Control limit.- Parameters:
maxAccelMetersPerSecSq- Maximum physical acceleration before tire slip occurs.
-
-
Method Details
-
calculate
public edu.wpi.first.math.geometry.Translation2d calculate(edu.wpi.first.math.geometry.Translation2d targetVelocity) Calculates the max achievable velocity vector without slipping tires.- Parameters:
targetVelocity- Target requested X/Y velocity vector.- Returns:
- Safe velocity vector to apply to the ChassisSpeeds.
-