Class JoystickUtil

java.lang.Object
io.github.tigerbotics7125.tigerlib.util.JoystickUtil

public class JoystickUtil extends Object
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static 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].
    static edu.wpi.first.math.Pair<Double,Double>
    deadzone(edu.wpi.first.math.Pair<Double,Double> input, double deadzone)
    Deadzone inputs.
    static edu.wpi.first.math.Pair<Double,Double>
    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.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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 - input
      s - 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 - input
      d - 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 - input
      min - lower boundery
      max - upper boundery
      Returns:
      x within mix and max
    • mapToCircle

      public static edu.wpi.first.math.Pair<Double,Double> mapToCircle(double x, double y)
      Convert joystick values to magnitude and angle values.
      Parameters:
      x - input
      y - input
      Returns:
      A pair of outputs, (x, y).