commander: fix prearm flag to preflightCheck

This was inverted, i.e. set to false in most cases, whereas it should be
true.

As a consequence, both powerCheck and airspeed.confidence checks were not
executed.
This commit is contained in:
Beat Küng
2020-01-24 15:48:41 +01:00
committed by Lorenz Meier
parent 4fef3dd7d5
commit 9e7dcd4b06
3 changed files with 7 additions and 6 deletions
@@ -79,12 +79,12 @@ bool PreFlightCheck::airspeedCheck(orb_advert_t *mavlink_log_pub, vehicle_status
goto out;
}
/**
/*
* Check if airspeed is higher than 4m/s (accepted max) while the vehicle is landed / not flying
* Negative and positive offsets are considered. Do not check anymore while arming because pitot cover
* might have been removed.
*/
if (fabsf(airspeed.indicated_airspeed_m_s) > 4.0f && !prearm) {
if (fabsf(airspeed.indicated_airspeed_m_s) > 4.0f && prearm) {
if (report_fail) {
mavlink_log_critical(mavlink_log_pub, "Preflight Fail: check Airspeed Cal or Pitot");
}
+3 -3
View File
@@ -286,7 +286,7 @@ extern "C" __EXPORT int commander_main(int argc, char *argv[])
}
if (!strcmp(argv[1], "check")) {
bool preflight_check_res = PreFlightCheck::preflightCheck(nullptr, status, status_flags, true, true, false, 30_s);
bool preflight_check_res = PreFlightCheck::preflightCheck(nullptr, status, status_flags, true, true, true, 30_s);
PX4_INFO("Preflight check: %s", preflight_check_res ? "OK" : "FAILED");
bool prearm_check_res = PreFlightCheck::preArmCheck(nullptr, status_flags, safety_s{},
@@ -1280,7 +1280,7 @@ Commander::run()
arm_auth_init(&mavlink_log_pub, &status.system_id);
// run preflight immediately to find all relevant parameters, but don't report
PreFlightCheck::preflightCheck(&mavlink_log_pub, status, status_flags, _arm_requirements.global_position, false, false,
PreFlightCheck::preflightCheck(&mavlink_log_pub, status, status_flags, _arm_requirements.global_position, false, true,
hrt_elapsed_time(&_boot_timestamp));
while (!should_exit()) {
@@ -3355,7 +3355,7 @@ void *commander_low_prio_loop(void *arg)
tune_positive(true);
// time since boot not relevant here
if (PreFlightCheck::preflightCheck(&mavlink_log_pub, status, status_flags, false, false, false, 30_s)) {
if (PreFlightCheck::preflightCheck(&mavlink_log_pub, status, status_flags, false, false, true, 30_s)) {
status_flags.condition_system_sensors_initialized = true;
}
@@ -154,7 +154,8 @@ transition_result_t arming_state_transition(vehicle_status_s *status, const safe
if ((last_preflight_check == 0) || (hrt_elapsed_time(&last_preflight_check) > 1000 * 1000)) {
status_flags->condition_system_sensors_initialized = PreFlightCheck::preflightCheck(mavlink_log_pub, *status,
*status_flags, arm_requirements.global_position, false, false, time_since_boot);
*status_flags, arm_requirements.global_position, false, status->arming_state != vehicle_status_s::ARMING_STATE_ARMED,
time_since_boot);
last_preflight_check = hrt_absolute_time();
}