Class PidFilter

    • Constructor Summary

      Constructors 
      Constructor Description
      PidFilter()
      Creates a PidFilter using default values.
      PidFilter​(double p, double i, double d)
      Creates a PidFilter.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected int applyLowHighLimits​(int value)
      Applies the configured PID low and high limits to a value.
      int applyPidFilter​(int input, int target)
      Apply the PID filter using the current Channel value as input and the target value.
      void reset()
      Reset the PID filter.
      void setLimits​(java.lang.Integer lowLimit, java.lang.Integer highLimit)
      Limit the output value.
      • Methods inherited from class java.lang.Object

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

      • PidFilter

        public PidFilter​(double p,
                         double i,
                         double d)
        Creates a PidFilter.
        Parameters:
        p - the proportional gain
        i - the integral gain
        d - the derivative gain
      • PidFilter

        public PidFilter()
        Creates a PidFilter using default values.
    • Method Detail

      • setLimits

        public void setLimits​(java.lang.Integer lowLimit,
                              java.lang.Integer highLimit)
        Limit the output value.
        Parameters:
        lowLimit - lowest allowed output value
        highLimit - highest allowed output value
      • applyPidFilter

        public int applyPidFilter​(int input,
                                  int target)
        Apply the PID filter using the current Channel value as input and the target value.
        Parameters:
        input - the input value, e.g. the measured Channel value
        target - the target value
        Returns:
        the filtered set-point value
      • reset

        public void reset()
        Reset the PID filter.

        This method should be called when the filter was not used for a while.

      • applyLowHighLimits

        protected int applyLowHighLimits​(int value)
        Applies the configured PID low and high limits to a value.
        Parameters:
        value - the input value
        Returns:
        the value within low and high limit