Package frc.lib.math

Class Conversions

java.lang.Object
frc.lib.math.Conversions

public class Conversions extends Object
Static Conversion functions
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static double
    applySwerveCurve(double input, double deadband)
    Apply a quadratic curve to swerve inputs.
    static double
    metersToRotations(double wheelMeters, double circumference)
     
    static double
    mpsToRPS(double wheelMPS, double circumference)
     
    static int
    random(int upper)
    Generate a random number between and upper value and 0
    static int
    random(int upper, int lower)
    Generate a random number between and upper and lower bound
    static double
    rotationsToMeters(double wheelRotations, double circumference)
     
    static double
    rpsToMPS(double wheelRPS, double circumference)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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 input
      deadband - 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 value
      lower - 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