WPILibC++  2020.3.2-60-g3011ebe
frc::MedianFilter< T > Class Template Reference

A class that implements a moving-window median filter. More...

#include <MedianFilter.h>

Public Member Functions

 MedianFilter (size_t size)
 Creates a new MedianFilter. More...
 
Calculate (T next)
 Calculates the moving-window median for the next value of the input stream. More...
 
void Reset ()
 Resets the filter, clearing the window of all elements.
 

Detailed Description

template<class T>
class frc::MedianFilter< T >

A class that implements a moving-window median filter.

Useful for reducing measurement noise, especially with processes that generate occasional, extreme outliers (such as values from vision processing, LIDAR, or ultrasonic sensors).

Constructor & Destructor Documentation

◆ MedianFilter()

template<class T >
frc::MedianFilter< T >::MedianFilter ( size_t  size)
inlineexplicit

Creates a new MedianFilter.

Parameters
sizeThe number of samples in the moving window.

Member Function Documentation

◆ Calculate()

template<class T >
T frc::MedianFilter< T >::Calculate ( next)
inline

Calculates the moving-window median for the next value of the input stream.

Parameters
nextThe next input value.
Returns
The median of the moving window, updated to include the next value.

The documentation for this class was generated from the following file: