From d39a8b5a486b3e580157181a94bea8b17f683c9c Mon Sep 17 00:00:00 2001 From: Matthias Grob <maetugr@gmail.com> Date: Thu, 22 Feb 2018 10:22:37 +0100 Subject: [PATCH] Battery: Switch thrust based load compensation back to linear To account for the parameter definition. My tests if quadratic is actually better in practise were anyways not conclusive. --- src/modules/systemlib/battery.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/modules/systemlib/battery.cpp b/src/modules/systemlib/battery.cpp index 7a8a8e940d..5b45c90441 100644 --- a/src/modules/systemlib/battery.cpp +++ b/src/modules/systemlib/battery.cpp @@ -167,8 +167,6 @@ Battery::sumDischarged(hrt_abstime timestamp, float current_a) void Battery::estimateRemaining(float voltage_v, float current_a, float throttle_normalized, bool armed) { - - // remaining battery capacity based on voltage float cell_voltage = voltage_v / _n_cells.get(); @@ -177,9 +175,8 @@ Battery::estimateRemaining(float voltage_v, float current_a, float throttle_norm cell_voltage += _r_internal.get() * current_a; } else { - // assume quadratic relation between throttle and current - // good assumption if throttle represents RPM - cell_voltage += throttle_normalized * throttle_normalized * _v_load_drop.get(); + // assume linear relation between throttle and voltage drop + cell_voltage += throttle_normalized * _v_load_drop.get(); } _remaining_voltage = math::gradual(cell_voltage, _v_empty.get(), _v_charged.get(), 0.f, 1.f); -- GitLab