Skip to content

LowPassFilter2

Class for a 2nd order low pass filter. More...

#include <lowpass_filter.hpp>

Inherits from DigitalFilter< float >

Public Functions

Name
LowPassFilter2(float dt, float tau_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 filter.
virtual float getOutput()
Gets the output.
void configOutput(float newOutput)
Force the output to a desired value.

Detailed Description

class LowPassFilter2;

Class for a 2nd order low pass filter.

        Design to be a 2nd order Butterworth low pass filter.
        Transformation done using the bilinear transform method

Public Functions Documentation

function LowPassFilter2

inline LowPassFilter2(
    float dt,
    float tau_c,
    float ioutput =0
)

Constructor to set sample time and the tau constant.

Parameters:

  • dt Sample time for the low pass filter
  • tau_c The time constant for the filter \( \tau_c = \frac{1}{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 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

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


Last update: May 26, 2023
Back to top