Public Member Functions | Protected Attributes | List of all members
alvar::FilterDoubleExponentialSmoothing Class Reference

FilterDoubleExponentialSmoothing provides an weighted running average filter More...

#include <Filter.h>

Inheritance diagram for alvar::FilterDoubleExponentialSmoothing:
Inheritance graph
[legend]

Public Member Functions

 FilterDoubleExponentialSmoothing (double _alpha=0.5, double _gamma=1.0)
 
double getGamma ()
 
virtual double next (double y)
 Update the value. All inherited classes need to update value in next(). More...
 
double operator= (double _value)
 
void setGamma (double _gamma)
 
- Public Member Functions inherited from alvar::FilterRunningAverage
 FilterRunningAverage (double _alpha=0.5)
 
double getAlpha ()
 
double operator= (double _value)
 
virtual void reset ()
 Reset the filter state. More...
 
void setAlpha (double _alpha)
 
- Public Member Functions inherited from alvar::Filter
 Filter ()
 Constructor. More...
 
double get () const
 Get the latest value. More...
 
 operator double ()
 Get the latest value. More...
 

Protected Attributes

double gamma
 
double slope
 
- Protected Attributes inherited from alvar::FilterRunningAverage
double alpha
 
bool breset
 
- Protected Attributes inherited from alvar::Filter
double value
 

Detailed Description

FilterDoubleExponentialSmoothing provides an weighted running average filter

The FilterDoubleExponentialSmoothing calculates a simple running average for both the average and slope using the weight values alpha and gamma.

value = ((1.0-alpha) * (value + slope)) + (alpha * (double)y);
slope = ((1.0-gamma) * (slope)) + (gamma * (value - value_prev));

If the weight values (alpha , gamma) are larger (near 1.0) the formulas react faster for changes and if they are near 0.0 then the reaction is slower. The weight values alpha and gamma may be set in the constructor or with setAlpha() and setGamma() .

Examples:
SampleFilter.cpp.

Definition at line 187 of file Filter.h.

Constructor & Destructor Documentation

alvar::FilterDoubleExponentialSmoothing::FilterDoubleExponentialSmoothing ( double  _alpha = 0.5,
double  _gamma = 1.0 
)
inline

Definition at line 192 of file Filter.h.

Member Function Documentation

double alvar::FilterDoubleExponentialSmoothing::getGamma ( )
inline

Definition at line 196 of file Filter.h.

double alvar::FilterDoubleExponentialSmoothing::next ( double  y)
virtual

Update the value. All inherited classes need to update value in next().

Reimplemented from alvar::FilterRunningAverage.

Examples:
SampleFilter.cpp.

Definition at line 99 of file Filter.cpp.

double alvar::FilterDoubleExponentialSmoothing::operator= ( double  _value)
inline

Definition at line 197 of file Filter.h.

void alvar::FilterDoubleExponentialSmoothing::setGamma ( double  _gamma)
inline

Definition at line 195 of file Filter.h.

Member Data Documentation

double alvar::FilterDoubleExponentialSmoothing::gamma
protected

Definition at line 189 of file Filter.h.

double alvar::FilterDoubleExponentialSmoothing::slope
protected

Definition at line 190 of file Filter.h.


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


ar_track_alvar
Author(s): Scott Niekum
autogenerated on Thu Jun 6 2019 19:27:24