diff options
author | Anton Babushkin <anton.babushkin@me.com> | 2014-10-11 13:39:58 +0200 |
---|---|---|
committer | Anton Babushkin <anton.babushkin@me.com> | 2014-10-11 13:39:58 +0200 |
commit | 20b408e0f358c7f1f0d11519f3911fb0b7fbd673 (patch) | |
tree | cf0a6b831a5576f4dfd7b58ca9e3aa481dcf67f1 | |
parent | a65532273632b51888dea467f6467d0692fbab8b (diff) | |
download | px4-firmware-20b408e0f358c7f1f0d11519f3911fb0b7fbd673.tar.gz px4-firmware-20b408e0f358c7f1f0d11519f3911fb0b7fbd673.tar.bz2 px4-firmware-20b408e0f358c7f1f0d11519f3911fb0b7fbd673.zip |
LowPassFilter: bugs fixed
-rw-r--r-- | src/lib/mathlib/math/filter/LowPassFilter.hpp | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/lib/mathlib/math/filter/LowPassFilter.hpp b/src/lib/mathlib/math/filter/LowPassFilter.hpp index 3e2e68494..78fabc436 100644 --- a/src/lib/mathlib/math/filter/LowPassFilter.hpp +++ b/src/lib/mathlib/math/filter/LowPassFilter.hpp @@ -48,12 +48,11 @@ public: * * @return retrieve the filtered result */ - const &T apply(uint64_t t, const T &next_value) - { + const T &apply(uint64_t t, const T &next_value) { if (_rc > 0.0f) { float dt = (t - _time_last) * 1.0e-6f; float a = dt / (_rc + dt); - _value * = 1.0f - a; + _value *= (1.0f - a); _value += next_value * a; } |