Class JoystickUtil
java.lang.Object
io.github.tigerbotics7125.tigerlib.util.JoystickUtil
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic double
clamp
(double x, double min, double max) Applies a clamp such that: [min, max].static double
deadband
(double x, double d) Applies a deadband such that: [-infinity, -deadband] {0} [deadband, infinity].Deadzone inputs.mapToCircle
(double x, double y) Convert joystick values to magnitude and angle values.static double
ramp
(double x, double s) Multiplies a x by an exponent, preserving sign.
-
Constructor Details
-
JoystickUtil
public JoystickUtil()
-
-
Method Details
-
ramp
public static double ramp(double x, double s) Multiplies a x by an exponent, preserving sign.- Parameters:
x
- inputs
- sensitivity- Returns:
- preserve sign power.
-
deadband
public static double deadband(double x, double d) Applies a deadband such that: [-infinity, -deadband] {0} [deadband, infinity].- Parameters:
x
- inputd
- deadband- Returns:
- a deadbanded value
-
deadzone
public static edu.wpi.first.math.Pair<Double,Double> deadzone(edu.wpi.first.math.Pair<Double, Double> input, double deadzone) Deadzone inputs.Visualization ...
- Parameters:
input
- Pair of inputs, to deadzone.deadzone
- how much to deadzone.- Returns:
- A deadzoned pair.
-
clamp
public static double clamp(double x, double min, double max) Applies a clamp such that: [min, max].- Parameters:
x
- inputmin
- lower bounderymax
- upper boundery- Returns:
- x within mix and max
-
mapToCircle
Convert joystick values to magnitude and angle values.- Parameters:
x
- inputy
- input- Returns:
- A pair of outputs, (x, y).
-