WPILibC++ 2024.1.1-beta-4
frc::MedianFilter< T > Class Template Reference

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

#include <frc/filter/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. More...
 

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.

◆ Reset()

template<class T >
void frc::MedianFilter< T >::Reset ( )
inline

Resets the filter, clearing the window of all elements.


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