Package swervelib.math
Class IMULinearMovingAverageFilter
java.lang.Object
swervelib.math.IMULinearMovingAverageFilter
A linear filter that does not calculate() each time a value is added to the DoubleCircularBuffer.
-
Constructor Summary
ConstructorDescriptionIMULinearMovingAverageFilter
(int bufferLength) Construct a linear moving average fitler -
Method Summary
-
Constructor Details
-
IMULinearMovingAverageFilter
public IMULinearMovingAverageFilter(int bufferLength) Construct a linear moving average fitler- Parameters:
bufferLength
- The number of values to average across
-
-
Method Details
-
addValue
public void addValue(double input) Add a value to the DoubleCircularBuffer- Parameters:
input
- Value to add
-
calculate
public double calculate()Calculate the average of the samples in the buffer- Returns:
- The average of the values in the buffer
-