Class CubicDeadband


  • public class CubicDeadband
    extends java.lang.Object
    This Scaling method was inspired by this blog post: http://www.mimirgames.com/articles/games/joystick-input-and-using-deadbands/ Formula: y = ((w * (x ^ 3) + (1.0 - w) * x) - (abs(x) / x) * (w * (d ^ 3) + (1.0 - w) * d)) / (1.0 - (w * (d ^ 3) + (1.0 - w) * d)) This can be visualized on desmos: https://www.desmos.com/calculator/awcputalxe
    • Constructor Summary

      Constructors 
      Constructor Description
      CubicDeadband​(double deadband, double percision)
      Cubic scaling deadband
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      double feed​(double input)
      Pass an input through a cubic scaling function
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • CubicDeadband

        public CubicDeadband​(double deadband,
                             double percision)
        Cubic scaling deadband
        Parameters:
        deadband - Deadband size
        percision - This number should be set to user preference. The higher it is, the more precice small movements will be and the less precice big movements will be
    • Method Detail

      • feed

        public double feed​(double input)
        Pass an input through a cubic scaling function
        Parameters:
        input - Raw input
        Returns:
        Scaled output