Public Member Functions | Protected Attributes
alvar::Filter Class Reference

Filter is pure virtual class describing the basic virtual interface for all filters More...

#include <Filter.h>

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

List of all members.

Public Member Functions

 Filter ()
 Constructor.
double get () const
 Get the latest value.
virtual double next (double y)=0
 Update the value. All inherited classes need to update value in next().
 operator double ()
 Get the latest value.
virtual void reset ()=0
 Reset the filter state.

Protected Attributes

double value

Detailed Description

Filter is pure virtual class describing the basic virtual interface for all filters

Basic usage:

     FilterAverage a(3);
     cout<<a.next(3)<<endl;
     cout<<a.next(3.2)<<endl;
     cout<<a.next(1.3)<<endl;
     cout<<a.next(2.9)<<endl;

The Filter library provides also the assignment operators (operator=) to simplify the process where you want to replace existing double's in code with filtered values. For example if you want to filter the d over time in the following code...

     double d;
     cout<<(d = 3)<<endl;
     cout<<(d = 3.2)<<endl;
     cout<<(d = 1.3)<<endl;
     cout<<(d = 2.9)<<endl;

...you can add filter just by replacing the double with the selected filter:

     FilterDoubleExponentialSmoothing d(0.2,0.5);
     cout<<(d = 3)<<endl;
     cout<<(d = 3.2)<<endl;
     cout<<(d = 1.3)<<endl;
     cout<<(d = 2.9)<<endl;

However, using the assignment operator for setting time series data is a little counter-intuitive, so please use next() instead when possible.

Note:
All inherited classes need to update value in next()

Definition at line 79 of file Filter.h.


Constructor & Destructor Documentation

Constructor.

Definition at line 37 of file Filter.cpp.


Member Function Documentation

double alvar::Filter::get ( ) const [inline]

Get the latest value.

Definition at line 86 of file Filter.h.

virtual double alvar::Filter::next ( double  y) [pure virtual]

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

Implemented in alvar::FilterDoubleExponentialSmoothing, alvar::FilterRunningAverage, alvar::FilterMedian, and alvar::FilterAverage.

alvar::Filter::operator double ( ) [inline]

Get the latest value.

Definition at line 88 of file Filter.h.

virtual void alvar::Filter::reset ( ) [pure virtual]

Reset the filter state.

Implemented in alvar::FilterRunningAverage, and alvar::FilterAverage.


Member Data Documentation

double alvar::Filter::value [protected]

Definition at line 81 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 21:12:55