Package frc.spectrumLib.util
Class Util
java.lang.Object
frc.spectrumLib.util.Util
From 254 lib imported from 1678-2024 Contains basic functions that are used often.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final TriggerTrigger that is true when the robot is enabled in autonomous mode.static final TriggerTrigger that is true when the robot is disabled.static final TriggerTrigger that is true when the DriverStation is attached.static final doublestatic final TriggerTrigger that is true when the robot is enabled in teleop mode.static final TriggerTrigger that is true when the robot is enabled in test mode. -
Method Summary
Modifier and TypeMethodDescriptionstatic booleanallCloseTo(List<Double> list, double value, double epsilon) static booleanepsilonEquals(double a, double b) static booleanepsilonEquals(double a, double b, double epsilon) static booleanepsilonEquals(int a, int b, int epsilon) static booleaninRange(double v, double maxMagnitude) static booleaninRange(double v, double min, double max) Checks if the given input is within the range (min, max), both exclusive.static booleaninRange(DoubleSupplier v, DoubleSupplier min, DoubleSupplier max) static doubleinterpolate(double a, double b, double x) static StringjoinStrings(String delim, List<?> strings) static doublelimit(double v, double maxMagnitude) Limits the given input to the given magnitude.static doublelimit(double v, double min, double max)
-
Field Details
-
EPSILON
public static final double EPSILON- See Also:
-
teleop
Trigger that is true when the robot is enabled in teleop mode. -
autoMode
Trigger that is true when the robot is enabled in autonomous mode. -
testMode
Trigger that is true when the robot is enabled in test mode. -
disabled
Trigger that is true when the robot is disabled. -
dsAttached
Trigger that is true when the DriverStation is attached.
-
-
Method Details
-
limit
public static double limit(double v, double maxMagnitude) Limits the given input to the given magnitude. -
limit
public static double limit(double v, double min, double max) -
inRange
public static boolean inRange(double v, double maxMagnitude) -
inRange
public static boolean inRange(double v, double min, double max) Checks if the given input is within the range (min, max), both exclusive. -
inRange
-
interpolate
public static double interpolate(double a, double b, double x) -
joinStrings
-
epsilonEquals
public static boolean epsilonEquals(double a, double b, double epsilon) -
epsilonEquals
public static boolean epsilonEquals(double a, double b) -
epsilonEquals
public static boolean epsilonEquals(int a, int b, int epsilon) -
allCloseTo
-