Package yams.math
Class DerivativeTimeFilter
java.lang.Object
yams.math.DerivativeTimeFilter
Find the derivative of a value over time in microseconds.
-
Constructor Summary
ConstructorsConstructorDescriptionDerivativeTimeFilter(double initial, Time debouncerPeriod) Create a derivative filter with an initial valueDerivativeTimeFilter(Time debouncerPeriod) Create a derivative filter with no initial value -
Method Summary
Modifier and TypeMethodDescriptiondoublederivative(double current) Get the derivative of the current value over the time since the last call to this function.doublederivative(double current, Time dt) Get the derivative of the current value over the specified delta.
-
Constructor Details
-
DerivativeTimeFilter
Create a derivative filter with an initial value- Parameters:
initial- Initial valuedebouncerPeriod- Period to debounce the filter.- Implementation Note:
- This value is timestamped at the time of construction.
-
DerivativeTimeFilter
Create a derivative filter with no initial value- Parameters:
debouncerPeriod- Period to debounce the filter.
-
-
Method Details
-
derivative
Get the derivative of the current value over the specified delta.- Parameters:
current- Current valuedt- 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.
-