Class Units

java.lang.Object
edu.wpi.first.math.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.
    • radiansToRotations

      public static double radiansToRotations​(double radians)
      Converts given radians to rotations.
      Parameters:
      radians - The radians to convert.
      Returns:
      rotations Converted from radians.
    • degreesToRotations

      public static double degreesToRotations​(double degrees)
      Converts given degrees to rotations.
      Parameters:
      degrees - The degrees to convert.
      Returns:
      rotations Converted from degrees.
    • rotationsToDegrees

      public static double rotationsToDegrees​(double rotations)
      Converts given rotations to degrees.
      Parameters:
      rotations - The rotations to convert.
      Returns:
      degrees Converted from rotations.
    • rotationsToRadians

      public static double rotationsToRadians​(double rotations)
      Converts given rotations to radians.
      Parameters:
      rotations - The rotations to convert.
      Returns:
      radians Converted from rotations.
    • 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.
    • millisecondsToSeconds

      public static double millisecondsToSeconds​(double milliseconds)
      Converts given milliseconds to seconds.
      Parameters:
      milliseconds - The milliseconds to convert to seconds.
      Returns:
      Seconds converted from milliseconds.
    • secondsToMilliseconds

      public static double secondsToMilliseconds​(double seconds)
      Converts given seconds to milliseconds.
      Parameters:
      seconds - The seconds to convert to milliseconds.
      Returns:
      Milliseconds converted from seconds.
    • kilogramsToLbs

      public static double kilogramsToLbs​(double kilograms)
      Converts kilograms into lbs (pound-mass).
      Parameters:
      kilograms - The kilograms to convert to lbs (pound-mass).
      Returns:
      Lbs (pound-mass) converted from kilograms.
    • lbsToKilograms

      public static double lbsToKilograms​(double lbs)
      Converts lbs (pound-mass) into kilograms.
      Parameters:
      lbs - The lbs (pound-mass) to convert to kilograms.
      Returns:
      Kilograms converted from lbs (pound-mass).