Browse Source

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.
sbg
Beat Küng 5 years ago committed by Lorenz Meier
parent
commit
9e7dcd4b06
  1. 4
      src/modules/commander/Arming/PreFlightCheck/checks/airspeedCheck.cpp
  2. 6
      src/modules/commander/Commander.cpp
  3. 3
      src/modules/commander/state_machine_helper.cpp

4
src/modules/commander/Arming/PreFlightCheck/checks/airspeedCheck.cpp

@ -79,12 +79,12 @@ bool PreFlightCheck::airspeedCheck(orb_advert_t *mavlink_log_pub, vehicle_status @@ -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");
}

6
src/modules/commander/Commander.cpp

@ -286,7 +286,7 @@ extern "C" __EXPORT int commander_main(int argc, char *argv[]) @@ -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() @@ -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) @@ -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;
}

3
src/modules/commander/state_machine_helper.cpp

@ -154,7 +154,8 @@ transition_result_t arming_state_transition(vehicle_status_s *status, const safe @@ -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();
}

Loading…
Cancel
Save