kings / Mbed 2 deprecated MainMix_20170517

Dependencies:   mbed

Fork of DrehungMitStopp by kings

Embed: (wiki syntax)

« Back to documentation index

LowpassFilter Class Reference

LowpassFilter Class Reference

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

#include <LowpassFilter.h>

Public Member Functions

 LowpassFilter ()
 Creates a LowpassFilter object with a default corner 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 corner frequency of this filter.
float getFrequency ()
 Gets the current corner frequency of this filter.
float filter (float value)
 Filters a value.

Detailed Description

This class implements a time-discrete 2nd order low-pass 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 15 of file LowpassFilter.h.


Constructor & Destructor Documentation

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

Definition at line 11 of file LowpassFilter.cpp.

~LowpassFilter (  ) [virtual]

Deletes the LowpassFilter object.

Definition at line 30 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 98 of file LowpassFilter.cpp.

float getFrequency (  )

Gets the current corner frequency of this filter.

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

Definition at line 88 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 45 of file LowpassFilter.cpp.

void reset (  )

Resets the filtered value to zero.

Definition at line 35 of file LowpassFilter.cpp.

void setFrequency ( float  frequency )

Sets the corner frequency of this filter.

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

Definition at line 72 of file LowpassFilter.cpp.

void setPeriod ( float  period )

Sets the sampling period of the filter.

This is typically the sampling period of the realtime thread of a controller that uses this filter.

Parameters:
thesampling period, given in [s].

Definition at line 56 of file LowpassFilter.cpp.