Skip to content

Commit

Permalink
failsafe: disarm if battery failure is detected during spoolup
Browse files Browse the repository at this point in the history
  • Loading branch information
bresch authored and dagar committed Nov 7, 2023
1 parent 55fd0bd commit 3acc294
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/modules/commander/failsafe/failsafe.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,15 @@ void Failsafe::checkStateAndMode(const hrt_abstime &time_us, const State &state,
// Battery
CHECK_FAILSAFE(status_flags, battery_low_remaining_time,
ActionOptions(Action::RTL).causedBy(Cause::BatteryLow).clearOn(ClearCondition::OnModeChangeOrDisarm));
CHECK_FAILSAFE(status_flags, battery_unhealthy, Action::Warn);

if ((_armed_time != 0)
&& (time_us < _armed_time + static_cast<hrt_abstime>(_param_com_spoolup_time.get() * 1_s))
) {
CHECK_FAILSAFE(status_flags, battery_unhealthy, ActionOptions(Action::Disarm).cannotBeDeferred());

} else {
CHECK_FAILSAFE(status_flags, battery_unhealthy, Action::Warn);
}

switch (status_flags.battery_warning) {
case battery_status_s::BATTERY_WARNING_LOW:
Expand Down

0 comments on commit 3acc294

Please sign in to comment.