Battery estimation: Widen thresholds and filter more

This commit is contained in:
Lorenz Meier
2016-05-03 12:35:35 +02:00
parent 4c61f52269
commit 6de02c460a
2 changed files with 5 additions and 5 deletions
+2 -2
View File
@@ -102,7 +102,7 @@ Battery::updateBatteryStatus(hrt_abstime timestamp, float voltage_v, float curre
void
Battery::filterVoltage(float voltage_v)
{
if (_voltage_filtered_v < 0) {
if (_voltage_filtered_v < 0.0f) {
_voltage_filtered_v = voltage_v;
}
@@ -146,7 +146,7 @@ Battery::estimateRemaining(float voltage_v, float throttle_normalized)
// remaining battery capacity based on voltage
const float rvoltage = (voltage_v - (_param_n_cells.get() * bat_v_empty_dynamic))
/ (_param_n_cells.get() * voltage_range);
const float rvoltage_filt = rvoltage * 0.99f + _remaining_voltage * 0.01f;
const float rvoltage_filt = rvoltage * 0.997f + _remaining_voltage * 0.003f;
if (PX4_ISFINITE(rvoltage_filt)) {
_remaining_voltage = rvoltage_filt;