mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-11-03 04:31:36 +08:00
Making lowpass filter init bullet proof
This commit is contained in:
@@ -46,10 +46,18 @@ class __EXPORT LowPassFilter2p
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
// constructor
|
// constructor
|
||||||
LowPassFilter2p(float sample_freq, float cutoff_freq) {
|
LowPassFilter2p(float sample_freq, float cutoff_freq) :
|
||||||
|
_cutoff_freq(cutoff_freq),
|
||||||
|
_a1(0.0f),
|
||||||
|
_a2(0.0f),
|
||||||
|
_b0(0.0f),
|
||||||
|
_b1(0.0f),
|
||||||
|
_b2(0.0f),
|
||||||
|
_delay_element_1(0.0f),
|
||||||
|
_delay_element_2(0.0f)
|
||||||
|
{
|
||||||
// set initial parameters
|
// set initial parameters
|
||||||
set_cutoff_frequency(sample_freq, cutoff_freq);
|
set_cutoff_frequency(sample_freq, cutoff_freq);
|
||||||
_delay_element_1 = _delay_element_2 = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user