Class Units

java.lang.Object
edu.wpi.first.wpilibj.util.Units

public final class Units
extends Object
Utility class that converts between commonly used units in FRC.
  • Method Details

    • metersToFeet

      public static double metersToFeet​(double meters)
      Converts given meters to feet.
      Parameters:
      meters - The meters to convert to feet.
      Returns:
      Feet converted from meters.
    • feetToMeters

      public static double feetToMeters​(double feet)
      Converts given feet to meters.
      Parameters:
      feet - The feet to convert to meters.
      Returns:
      Meters converted from feet.
    • metersToInches

      public static double metersToInches​(double meters)
      Converts given meters to inches.
      Parameters:
      meters - The meters to convert to inches.
      Returns:
      Inches converted from meters.
    • inchesToMeters

      public static double inchesToMeters​(double inches)
      Converts given inches to meters.
      Parameters:
      inches - The inches to convert to meters.
      Returns:
      Meters converted from inches.
    • degreesToRadians

      public static double degreesToRadians​(double degrees)
      Converts given degrees to radians.
      Parameters:
      degrees - The degrees to convert to radians.
      Returns:
      Radians converted from degrees.
    • radiansToDegrees

      public static double radiansToDegrees​(double radians)
      Converts given radians to degrees.
      Parameters:
      radians - The radians to convert to degrees.
      Returns:
      Degrees converted from radians.
    • rotationsPerMinuteToRadiansPerSecond

      public static double rotationsPerMinuteToRadiansPerSecond​(double rpm)
      Converts rotations per minute to radians per second.
      Parameters:
      rpm - The rotations per minute to convert to radians per second.
      Returns:
      Radians per second converted from rotations per minute.
    • radiansPerSecondToRotationsPerMinute

      public static double radiansPerSecondToRotationsPerMinute​(double radiansPerSecond)
      Converts radians per second to rotations per minute.
      Parameters:
      radiansPerSecond - The radians per second to convert to from rotations per minute.
      Returns:
      Rotations per minute converted from radians per second.