public class Utils
Modifier and Type | Method and Description |
---|---|
int |
degreesToTalonAngle(int gyroTicksPerRotation,
double degrees) |
double |
encoderTicksPer100MsToInchesPerSecond(int encoderTicksPerRotation,
double circumference,
int encoderTicksPer100ms,
double reduction) |
double |
encoderTicksToInches(int encoderTicksPerRotation,
double circumference,
int ticks,
double reduction) |
double |
inchesPerSecondToEncoderTicksPer100Ms(int encoderTicksPerRotation,
double circumference,
double inchesPerSecond,
double reduction) |
int |
inchesToEncoderTicks(int encoderTicksPerRotation,
double circumference,
double inches,
double reduction) |
double |
interpolate(double a,
double b,
double x)
method to interpolate between 2 doubles
|
double |
limit(double value,
double limit)
method that limits input to a certain range.
|
double |
limit(double value,
double min,
double max)
method that limits input to a certain range.
|
double |
talonAngleToDegrees(int gyroTicksPerRotation,
int ticks) |
public static Utils INSTANCE
public double limit(double value, double limit)
method that limits input to a certain range.
value
- value to be limitedlimit
- upper and lower bound of the valuepublic double limit(double value, double min, double max)
method that limits input to a certain range.
value
- value to be limitedmin
- lower bound of the valuemax
- upper bound of the valuepublic double interpolate(double a, double b, double x)
method to interpolate between 2 doubles
a
- first valueb
- second valuex
- value between the 2 valuespublic double inchesPerSecondToEncoderTicksPer100Ms(int encoderTicksPerRotation, double circumference, double inchesPerSecond, double reduction)
encoderTicksPerRotation
- encoder ticks per 360 degrees of rotation of the encoder shaftcircumference
- circumference of the object being rotatedinchesPerSecond
- velocity to be convertedreduction
- reduction from the encoder shaft to the output shaftpublic double encoderTicksPer100MsToInchesPerSecond(int encoderTicksPerRotation, double circumference, int encoderTicksPer100ms, double reduction)
encoderTicksPerRotation
- encoder ticks per 360 degrees of rotation of the encoder shaftcircumference
- circumference of the object being rotatedencoderTicksPer100ms
- velocity to be convertedreduction
- reduction from the encoder shaft to the output shaftpublic int inchesToEncoderTicks(int encoderTicksPerRotation, double circumference, double inches, double reduction)
encoderTicksPerRotation
- encoder ticks per 360 degrees of rotation of the encoder shaftcircumference
- circumference of the object being rotatedinches
- inches of travel to be converted to ticks of travelreduction
- reduction from the encoder shaft to the output shaftpublic double encoderTicksToInches(int encoderTicksPerRotation, double circumference, int ticks, double reduction)
encoderTicksPerRotation
- encoder ticks per 360 degrees of rotation of the encoder shaftcircumference
- circumference of the object being rotatedticks
- ticks of travel to be converted to inches of travelreduction
- reduction from the encoder shaft to the output shaftpublic double talonAngleToDegrees(int gyroTicksPerRotation, int ticks)
public int degreesToTalonAngle(int gyroTicksPerRotation, double degrees)