[wpilib] Tachometer: Add function to return RPS (#3833)

This commit is contained in:
Oblarg
2021-12-26 18:52:18 -05:00
committed by GitHub
parent 84b15f0883
commit baacbc8e24
5 changed files with 77 additions and 8 deletions

View File

@@ -77,6 +77,46 @@ public final class Units {
return Math.toDegrees(radians);
}
/**
* Converts given radians to rotations.
*
* @param radians The radians to convert.
* @return rotations Converted from radians.
*/
public static double radiansToRotations(double radians) {
return radians / (Math.PI * 2);
}
/**
* Converts given degrees to rotations.
*
* @param degrees The degrees to convert.
* @return rotations Converted from radians.
*/
public static double degreesToRotations(double degrees) {
return degrees / 360;
}
/**
* Converts given rotations to degrees.
*
* @param rotations The rotations to convert.
* @return degrees Converted from rotations.
*/
public static double rotationsToDegrees(double rotations) {
return rotations * 360;
}
/**
* Converts given rotations to radians.
*
* @param rotations The rotations to convert.
* @return radians Converted from rotations.
*/
public static double rotationsToRadians(double rotations) {
return rotations * 2 * Math.PI;
}
/**
* Converts rotations per minute to radians per second.
*