Skip to content

Commit

Permalink
Battery: get rid of the unconfigurable filtering which is not time ab…
Browse files Browse the repository at this point in the history
…stracted

it needs to be replaced by better filtering shortly after
  • Loading branch information
MaEtUgR committed Oct 19, 2017
1 parent d39e96a commit e5da882
Showing 1 changed file with 2 additions and 13 deletions.
15 changes: 2 additions & 13 deletions src/modules/systemlib/battery.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -179,21 +179,10 @@ Battery::estimateRemaining(float voltage_v, float current_a, float throttle_norm

// remaining battery capacity based on voltage
const float cell_voltage = voltage_v / _param_n_cells.get();
const float rvoltage = math::gradual(cell_voltage, _param_v_empty.get(), _param_v_full.get(), 0.f, 1.f);

const float rvoltage_filt = _remaining_voltage * 0.99f + rvoltage * 0.01f;

if (PX4_ISFINITE(rvoltage_filt)) {
_remaining_voltage = rvoltage_filt;
}
_remaining_voltage = math::gradual(cell_voltage, _param_v_empty.get(), _param_v_full.get(), 0.f, 1.f);

// remaining battery capacity based on used current integrated time
const float rcap = 1.0f - _discharged_mah / _param_capacity.get();
const float rcap_filt = _remaining_capacity * 0.99f + rcap * 0.01f;

if (PX4_ISFINITE(rcap_filt)) {
_remaining_capacity = rcap_filt;
}
_remaining_capacity = 1.0f - _discharged_mah / _param_capacity.get();

// limit to sane values
_remaining_voltage = (_remaining_voltage < 0.0f) ? 0.0f : _remaining_voltage;
Expand Down

0 comments on commit e5da882

Please sign in to comment.