mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-07-17 19:40:34 +08:00
Commander: Streamline preflight and arming checks
The checks did previously only report the first failure (to not overload the radio link). As we are moving to buffered messages and higher bandwidth links this design choice is not any more in the best interest of the drone operator. We are now reporting all detected failures. To ensure architectural consistency more checks have been moved from the commander mainloop into the respective classes.
This commit is contained in:
@@ -3833,13 +3833,10 @@ void Commander::battery_status_check()
|
||||
// All connected batteries are regularly being published
|
||||
(hrt_elapsed_time(&oldest_update) < 5_s)
|
||||
// There is at least one connected battery (in any slot)
|
||||
&& num_connected_batteries > 0
|
||||
&& (num_connected_batteries > 0)
|
||||
// No currently-connected batteries have any warning
|
||||
&& (_battery_warning == battery_status_s::BATTERY_WARNING_NONE);
|
||||
|
||||
set_health_flags(subsystem_info_s::SUBSYSTEM_TYPE_SENSORBATTERY, true, true,
|
||||
(_battery_warning == battery_status_s::BATTERY_WARNING_NONE), status);
|
||||
|
||||
// execute battery failsafe if the state has gotten worse while we are armed
|
||||
if (battery_warning_level_increased_while_armed) {
|
||||
battery_failsafe(&mavlink_log_pub, status, status_flags, &_internal_state, _battery_warning,
|
||||
@@ -3975,13 +3972,6 @@ void Commander::estimator_check()
|
||||
}
|
||||
}
|
||||
|
||||
if ((_last_condition_global_position_valid != status_flags.condition_global_position_valid)
|
||||
&& status_flags.condition_global_position_valid) {
|
||||
// If global position state changed and is now valid, set respective health flags to true. For now also assume GPS is OK if global pos is OK, but not vice versa.
|
||||
set_health_flags_healthy(subsystem_info_s::SUBSYSTEM_TYPE_AHRS, true, status);
|
||||
set_health_flags_present_healthy(subsystem_info_s::SUBSYSTEM_TYPE_GPS, true, true, status);
|
||||
}
|
||||
|
||||
check_valid(lpos.timestamp, _param_com_pos_fs_delay.get() * 1_s, lpos.z_valid,
|
||||
&(status_flags.condition_local_altitude_valid), &_status_changed);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user