Package frc.lib.math
Class Conversions
java.lang.Object
frc.lib.math.Conversions
Static Conversion functions
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic doubleapplySwerveCurve(double input, double deadband) Apply a quadratic curve to swerve inputs.static doublemetersToRotations(double wheelMeters, double circumference) static doublempsToRPS(double wheelMPS, double circumference) static intrandom(int upper) Generate a random number between and upper value and 0static intrandom(int upper, int lower) Generate a random number between and upper and lower boundstatic doublerotationsToMeters(double wheelRotations, double circumference) static doublerpsToMPS(double wheelRPS, double circumference)
-
Constructor Details
-
Conversions
public Conversions()
-
-
Method Details
-
rpsToMPS
public static double rpsToMPS(double wheelRPS, double circumference) - Parameters:
wheelRPS- Wheel Velocity: (in Rotations per Second)circumference- Wheel Circumference: (in Meters)- Returns:
- Wheel Velocity: (in Meters per Second)
-
mpsToRPS
public static double mpsToRPS(double wheelMPS, double circumference) - Parameters:
wheelMPS- Wheel Velocity: (in Meters per Second)circumference- Wheel Circumference: (in Meters)- Returns:
- Wheel Velocity: (in Rotations per Second)
-
rotationsToMeters
public static double rotationsToMeters(double wheelRotations, double circumference) - Parameters:
wheelRotations- Wheel Position: (in Rotations)circumference- Wheel Circumference: (in Meters)- Returns:
- Wheel Distance: (in Meters)
-
metersToRotations
public static double metersToRotations(double wheelMeters, double circumference) - Parameters:
wheelMeters- Wheel Distance: (in Meters)circumference- Wheel Circumference: (in Meters)- Returns:
- Wheel Position: (in Rotations)
-
applySwerveCurve
public static double applySwerveCurve(double input, double deadband) Apply a quadratic curve to swerve inputs.- Parameters:
input- Controller inputdeadband- Controller deadband- Returns:
- New curved input.
-
random
public static int random(int upper, int lower) Generate a random number between and upper and lower bound- Parameters:
upper- The max valuelower- the min value- Returns:
- The random integer
-
random
public static int random(int upper) Generate a random number between and upper value and 0- Parameters:
upper- The max value- Returns:
- The random integer
-