From a676af3d42f82e118c099524e2863e1b9c76167f Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Thu, 28 Apr 2016 13:05:44 +0200 Subject: [PATCH] Battery: Deal with symmetric throttle --- src/modules/systemlib/battery.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/systemlib/battery.cpp b/src/modules/systemlib/battery.cpp index f5f45d78ad..4cb352158b 100644 --- a/src/modules/systemlib/battery.cpp +++ b/src/modules/systemlib/battery.cpp @@ -132,7 +132,7 @@ void Battery::estimateRemaining(float voltage_v, float throttle_normalized) { // XXX this time constant needs to become tunable but really, the right fix are smart batteries. - const float filtered_next = _throttle_filtered * 0.97f + throttle_normalized * 0.03f; + const float filtered_next = _throttle_filtered * 0.97f + fabsf(throttle_normalized) * 0.03f; if (PX4_ISFINITE(filtered_next)) { _throttle_filtered = filtered_next;