Algorithmus

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

LowpassFilter Class Reference

LowpassFilter Class Reference

This class implements a time-discrete 2nd order lowpass filter for a series of data values. More...

#include <LowpassFilter.h>

Public Member Functions

 LowpassFilter ()
 Creates a LowpassFilter object with a default cutoff frequency of 1000 [rad/s].
virtual ~LowpassFilter ()
 Deletes the LowpassFilter object.
void reset ()
 Resets the filtered value to zero.
void reset (float value)
 Resets the filtered value to a given value.
void setPeriod (float period)
 Sets the sampling period of the filter.
void setFrequency (float frequency)
 Sets the cutoff frequency of this filter.
float getFrequency ()
 Gets the current cutoff frequency of this filter.
float filter (float value)
 Filters a value.

Detailed Description

This class implements a time-discrete 2nd order lowpass filter for a series of data values.

This filter can typically be used within a periodic task that takes measurements that need to be filtered, like speed or position values.

Definition at line 17 of file LowpassFilter.h.


Constructor & Destructor Documentation

Creates a LowpassFilter object with a default cutoff frequency of 1000 [rad/s].

Definition at line 15 of file LowpassFilter.cpp.

~LowpassFilter (  ) [virtual]

Deletes the LowpassFilter object.

Definition at line 34 of file LowpassFilter.cpp.


Member Function Documentation

float filter ( float  value )

Filters a value.

Parameters:
valuethe original unfiltered value.
Returns:
the filtered value.

Definition at line 102 of file LowpassFilter.cpp.

float getFrequency (  )

Gets the current cutoff frequency of this filter.

Returns:
the current cutoff frequency in [rad/s].

Definition at line 92 of file LowpassFilter.cpp.

void reset ( float  value )

Resets the filtered value to a given value.

Parameters:
valuethe value to reset the filter to.

Definition at line 49 of file LowpassFilter.cpp.

void reset (  )

Resets the filtered value to zero.

Definition at line 39 of file LowpassFilter.cpp.

void setFrequency ( float  frequency )

Sets the cutoff frequency of this filter.

Parameters:
frequencythe cutoff frequency of the filter in [rad/s].

Definition at line 76 of file LowpassFilter.cpp.

void setPeriod ( float  period )

Sets the sampling period of the filter.

This is typically the sampling period of the periodic task of a controller that uses this filter.

Parameters:
thesampling period, given in [s].

Definition at line 60 of file LowpassFilter.cpp.