Package frc.lib.math
Class Conversions
java.lang.Object
frc.lib.math.Conversions
Mathematical conversions for swerve calculations
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic double
degreesToFalcon
(double degrees, double gearRatio) static double
falconToDegrees
(double counts, double gearRatio) static double
falconToMeters
(double counts, double gearRatio, double circumference) static double
falconToMPS
(double velocitycounts, double circumference, double gearRatio) static double
falconToRPM
(double velocityCounts, double gearRatio) static double
mpsToFalcon
(double velocity, double circumference, double gearRatio) static double
reduceTo0_360
(double goal) Normalize angle to between 0 to 360static double
rpmToFalcon
(double rpm, double gearRatio)
-
Constructor Details
-
Conversions
public Conversions()
-
-
Method Details
-
falconToDegrees
public static double falconToDegrees(double counts, double gearRatio) - Parameters:
counts
- Falcon CountsgearRatio
- Gear Ratio between Falcon and Mechanism- Returns:
- Degrees of Rotation of Mechanism falconToDegrees
-
degreesToFalcon
public static double degreesToFalcon(double degrees, double gearRatio) - Parameters:
degrees
- Degrees of rotation of MechanismgearRatio
- Gear Ratio between Falcon and Mechanism- Returns:
- Falcon Counts degreesToFalcon
-
falconToRPM
public static double falconToRPM(double velocityCounts, double gearRatio) - Parameters:
velocityCounts
- Falcon Velocity CountsgearRatio
- Gear Ratio between Falcon and Mechanism (set to 1 for Falcon RPM)- Returns:
- RPM of Mechanism
-
rpmToFalcon
public static double rpmToFalcon(double rpm, double gearRatio) - Parameters:
rpm
- RPM of mechanismgearRatio
- Gear Ratio between Falcon and Mechanism (set to 1 for Falcon RPM)- Returns:
- RPM of Mechanism
-
falconToMeters
public static double falconToMeters(double counts, double gearRatio, double circumference) - Parameters:
counts
- Falcon CountsgearRatio
- Gear Ratio between Falcon and Mechanismcircumference
- Circumference of Wheel- Returns:
- Degrees of Rotation of Mechanism falconToDegrees
-
falconToMPS
public static double falconToMPS(double velocitycounts, double circumference, double gearRatio) - Parameters:
velocitycounts
- Falcon Velocity Countscircumference
- Circumference of WheelgearRatio
- Gear Ratio between Falcon and Mechanism (set to 1 for Falcon RPM)- Returns:
- Falcon Velocity Counts
-
mpsToFalcon
public static double mpsToFalcon(double velocity, double circumference, double gearRatio) - Parameters:
velocity
- Velocity MPScircumference
- Circumference of WheelgearRatio
- Gear Ratio between Falcon and Mechanism (set to 1 for Falcon RPM)- Returns:
- Falcon Velocity Counts
-
reduceTo0_360
public static double reduceTo0_360(double goal) Normalize angle to between 0 to 360- Parameters:
goal
- initial angle- Returns:
- normalized angle
-