Package frc.lib.math

Class Conversions

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

public class Conversions extends Object
Mathematical conversions for swerve calculations
  • Constructor Details

    • Conversions

      public Conversions()
  • Method Details

    • falconToDegrees

      public static double falconToDegrees(double counts, double gearRatio)
      Parameters:
      counts - Falcon Counts
      gearRatio - 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 Mechanism
      gearRatio - Gear Ratio between Falcon and Mechanism
      Returns:
      Falcon Counts degreesToFalcon
    • falconToRPM

      public static double falconToRPM(double velocityCounts, double gearRatio)
      Parameters:
      velocityCounts - Falcon Velocity Counts
      gearRatio - 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 mechanism
      gearRatio - 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 Counts
      gearRatio - Gear Ratio between Falcon and Mechanism
      circumference - 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 Counts
      circumference - Circumference of Wheel
      gearRatio - 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 MPS
      circumference - Circumference of Wheel
      gearRatio - 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