Package yams.math

Class DerivativeTimeFilter

java.lang.Object
yams.math.DerivativeTimeFilter

public class DerivativeTimeFilter extends Object
Find the derivative of a value over time in microseconds.
  • Constructor Details

    • DerivativeTimeFilter

      public DerivativeTimeFilter(double initial, Time debouncerPeriod)
      Create a derivative filter with an initial value
      Parameters:
      initial - Initial value
      debouncerPeriod - Period to debounce the filter.
      Implementation Note:
      This value is timestamped at the time of construction.
    • DerivativeTimeFilter

      public DerivativeTimeFilter(Time debouncerPeriod)
      Create a derivative filter with no initial value
      Parameters:
      debouncerPeriod - Period to debounce the filter.
  • Method Details

    • derivative

      public double derivative(double current, Time dt)
      Get the derivative of the current value over the specified delta.
      Parameters:
      current - Current value
      dt - Delta time
      Returns:
      Derivative of the current value from the previous value over the delta time in microseconds.
      Implementation Note:
      If this function is not called periodically at the dt specified, the derivative will be incorrect
    • derivative

      public double derivative(double current)
      Get the derivative of the current value over the time since the last call to this function.
      Parameters:
      current - Current value
      Returns:
      Derivative of the current value from the previous value over the time since the last call to this in microseconds.