Skip to content

LowPassFilter

Class for a low pass filter. More...

#include <lowpass_filter.hpp>

Inherits from DigitalFilter< float >

Public Functions

Name
LowPassFilter(float idt, float omega_c, float ioutput =0)
Constructor to set sample time and the tau constant.
virtual float update(float newValue)
Update function to push new value into the low pass filter.
virtual float getOutput()
Gets the output.
void configOutput(float newOutput)
Force the output to a desired value.
const float * outputPointer()

Detailed Description

class LowPassFilter;

Class for a low pass filter.

Authors: Jimmy van den Berg (vandenberg.jimmy@gmail.com) Maintained by: Jimmy van den Berg (vandenberg.jimmy@gmail.com) Last Update: 08/02/2018 Github: https://github.com/jimmyberg/DigitalFilters License: GNU Brief: Multiple classes for low pass filters of different orders, inherited from the DigitalFilter class of moving filters. A low-pass filter is a filter that passes signals with a frequency lower than a selected cutoff frequency and attenuates signals with frequencies higher than the cutoff frequency.

        Design to be a first order Butterworth low pass filter.
        Transformation done using the matched-Z-transform method

Public Functions Documentation

function LowPassFilter

inline LowPassFilter(
    float idt,
    float omega_c,
    float ioutput =0
)

Constructor to set sample time and the tau constant.

Parameters:

  • idt Sample time for the low pass filter
  • omega_c Cutoff angular frequency \( \omega_c = 2 pi f_c\) where \( f_c \) is the cutoff frequency

function update

inline virtual float update(
    float newValue
)

Update function to push new value into the low pass filter.

Parameters:

  • newValue The new value after dt time

Return: The new output value

Reimplements: DigitalFilter::update

function getOutput

inline virtual float getOutput()

Gets the output.

Return: The output.

Reimplements: DigitalFilter::getOutput

function configOutput

inline void configOutput(
    float newOutput
)

Force the output to a desired value.

Parameters:

  • newOutput The new output
        This can be useful when the output needs to be forced in case
        of extreme inputs or such

function outputPointer

inline const float * outputPointer()

Updated on 2023-05-26 at 16:18:58 +0000


Last update: May 26, 2023
Back to top