Apollo  6.0
Open source self driving car software
Public Member Functions | List of all members
apollo::common::MeanFilter Class Reference

The MeanFilter class is used to smoothen a series of noisy numbers, such as sensor data or the output of a function that we wish to be smoother. More...

#include <mean_filter.h>

Collaboration diagram for apollo::common::MeanFilter:
Collaboration graph

Public Member Functions

 MeanFilter (const std::uint_fast8_t window_size)
 Initializes a MeanFilter with a given window size. More...
 
 MeanFilter ()=default
 Default constructor; defers initialization. More...
 
 ~MeanFilter ()=default
 Default destructor. More...
 
double Update (const double measurement)
 Processes a new measurement in amortized constant time. More...
 

Detailed Description

The MeanFilter class is used to smoothen a series of noisy numbers, such as sensor data or the output of a function that we wish to be smoother.

This is achieved by keeping track of the last k measurements (where k is the window size), and returning the average of all but the minimum and maximum measurements, which are likely to be outliers.

Constructor & Destructor Documentation

◆ MeanFilter() [1/2]

apollo::common::MeanFilter::MeanFilter ( const std::uint_fast8_t  window_size)
explicit

Initializes a MeanFilter with a given window size.

Parameters
window_sizeThe window size of the MeanFilter. Older measurements are discarded.

◆ MeanFilter() [2/2]

apollo::common::MeanFilter::MeanFilter ( )
default

Default constructor; defers initialization.

◆ ~MeanFilter()

apollo::common::MeanFilter::~MeanFilter ( )
default

Default destructor.

Member Function Documentation

◆ Update()

double apollo::common::MeanFilter::Update ( const double  measurement)

Processes a new measurement in amortized constant time.

Parameters
measurementThe measurement to be processed by the filter.

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