Package org.chsrobotics.lib.math.filters
Class ThresholdFilter
- java.lang.Object
-
- org.chsrobotics.lib.math.filters.ThresholdFilter
-
-
Constructor Summary
Constructors Constructor Description ThresholdFilter(double threshold, boolean invert)Constructs a ThresholdFilter.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description doublecalculate(double value)Adds the value to the window and calculates the current output of the filterdoublegetCurrentOutput()Returns the current output of the filter without updating with a new value.voidreset()Resets the history of the filter.
-
-
-
Constructor Detail
-
ThresholdFilter
public ThresholdFilter(double threshold, boolean invert)Constructs a ThresholdFilter. By default, filters out values above the threshold, but can be interved to filter out values below the threshold.- Parameters:
threshold- The filter will attentuate values above this threshold.invert- Whether to attentuate values *below* this threshold instead.
-
-
Method Detail
-
calculate
public double calculate(double value)
Description copied from interface:FilterAdds the value to the window and calculates the current output of the filter
-
reset
public void reset()
Description copied from interface:FilterResets the history of the filter.
-
getCurrentOutput
public double getCurrentOutput()
Description copied from interface:FilterReturns the current output of the filter without updating with a new value.- Specified by:
getCurrentOutputin interfaceFilter- Returns:
- The current output of the filter (0 if no values have been given to
calculate()).
-
-