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.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final doubleGain on each reading.private final edu.wpi.first.util.DoubleCircularBufferCircular buffer storing the current IMU readings -
Constructor Summary
ConstructorsConstructorDescriptionIMULinearMovingAverageFilter(int bufferLength) Construct a linear moving average fitler -
Method Summary
-
Field Details
-
m_inputs
private final edu.wpi.first.util.DoubleCircularBuffer m_inputsCircular buffer storing the current IMU readings -
m_inputGain
private final double m_inputGainGain on each reading.
-
-
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
-