diff options
author | Lorenz Meier <lm@inf.ethz.ch> | 2014-04-05 17:02:37 +0200 |
---|---|---|
committer | Lorenz Meier <lm@inf.ethz.ch> | 2014-04-05 17:02:37 +0200 |
commit | fc39af08a1d6673aa727a84b17afd6c4485dff19 (patch) | |
tree | 20b00e74e6885f781fbdf1e9ff1a6ce7ca6bc8cc /src/lib/mathlib/math/filter/LowPassFilter2p.hpp | |
parent | 3da219c3db638e0a57d18e892575df13d8c11f47 (diff) | |
download | px4-firmware-fc39af08a1d6673aa727a84b17afd6c4485dff19.tar.gz px4-firmware-fc39af08a1d6673aa727a84b17afd6c4485dff19.tar.bz2 px4-firmware-fc39af08a1d6673aa727a84b17afd6c4485dff19.zip |
airspeed: Prevent the filter from overshooting into the negative airspeed range
Diffstat (limited to 'src/lib/mathlib/math/filter/LowPassFilter2p.hpp')
-rw-r--r-- | src/lib/mathlib/math/filter/LowPassFilter2p.hpp | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/src/lib/mathlib/math/filter/LowPassFilter2p.hpp b/src/lib/mathlib/math/filter/LowPassFilter2p.hpp index 208ec98d4..74cd5d78c 100644 --- a/src/lib/mathlib/math/filter/LowPassFilter2p.hpp +++ b/src/lib/mathlib/math/filter/LowPassFilter2p.hpp @@ -52,18 +52,30 @@ public: _delay_element_1 = _delay_element_2 = 0; } - // change parameters + /** + * Change filter parameters + */ void set_cutoff_frequency(float sample_freq, float cutoff_freq); - // apply - Add a new raw value to the filter - // and retrieve the filtered result + /** + * Add a new raw value to the filter + * + * @return retrieve the filtered result + */ float apply(float sample); - // return the cutoff frequency + /** + * Return the cutoff frequency + */ float get_cutoff_freq(void) const { return _cutoff_freq; } + /** + * Reset the filter state to this value + */ + float reset(float sample); + private: float _cutoff_freq; float _a1; |