commander: properly use new param

The param COM_ARM_WO_GPS is set to 1 by default to allow arming without
GPS. This then sets a bool arm_without_gps which translates to
!GNSS_check in preflightCheck.
This commit is contained in:
Julian Oes
2016-06-07 16:00:23 +02:00
committed by Lorenz Meier
parent f67e74935e
commit c7ec07be70
4 changed files with 35 additions and 20 deletions
+23 -12
View File
@@ -190,6 +190,8 @@ static uint64_t rc_signal_lost_timestamp; // Time at which the RC reception was
static float avionics_power_rail_voltage; // voltage of the avionics power rail
static bool can_arm_without_gps = false;
/**
* The daemon app only briefly exists to start
@@ -365,9 +367,9 @@ int commander_main(int argc, char *argv[])
if (!strcmp(argv[1], "check")) {
int checkres = 0;
checkres = preflight_check(&status, &mavlink_log_pub, false, true, &status_flags, &battery);
checkres = preflight_check(&status, &mavlink_log_pub, false, true, &status_flags, &battery, false);
warnx("Preflight check: %s", (checkres == 0) ? "OK" : "FAILED");
checkres = preflight_check(&status, &mavlink_log_pub, true, true, &status_flags, &battery);
checkres = preflight_check(&status, &mavlink_log_pub, true, true, &status_flags, &battery, true);
warnx("Prearm check: %s", (checkres == 0) ? "OK" : "FAILED");
return 0;
}
@@ -625,7 +627,8 @@ transition_result_t arm_disarm(bool arm, orb_advert_t *mavlink_log_pub_local, co
true /* fRunPreArmChecks */,
mavlink_log_pub_local,
&status_flags,
avionics_power_rail_voltage);
avionics_power_rail_voltage,
can_arm_without_gps);
if (arming_res == TRANSITION_CHANGED) {
mavlink_log_info(mavlink_log_pub_local, "[cmd] %s by %s", arm ? "ARMED" : "DISARMED", armedBy);
@@ -1507,6 +1510,7 @@ int commander_thread_main(int argc, char *argv[])
param_get(_param_autostart_id, &autostart_id);
param_get(_param_rc_in_off, &rc_in_off);
param_get(_param_arm_without_gps, &arm_without_gps);
can_arm_without_gps = (arm_without_gps == 1);
status.rc_input_mode = rc_in_off;
if (is_hil_setup(autostart_id)) {
// HIL configuration selected: real sensors will be disabled
@@ -1516,7 +1520,7 @@ int commander_thread_main(int argc, char *argv[])
// sensor diagnostics done continuously, not just at boot so don't warn about any issues just yet
status_flags.condition_system_sensors_initialized = Commander::preflightCheck(&mavlink_log_pub, true, true, true, true,
checkAirspeed, (status.rc_input_mode == vehicle_status_s::RC_IN_MODE_DEFAULT),
(arm_without_gps == 0), false);
!can_arm_without_gps, false);
set_tune_override(TONE_STARTUP_TUNE); //normal boot tune
}
@@ -1635,6 +1639,7 @@ int commander_thread_main(int argc, char *argv[])
param_get(_param_offboard_loss_act, &offboard_loss_act);
param_get(_param_offboard_loss_rc_act, &offboard_loss_rc_act);
param_get(_param_arm_without_gps, &arm_without_gps);
can_arm_without_gps = (arm_without_gps == 1);
/* Autostart id */
param_get(_param_autostart_id, &autostart_id);
@@ -1747,7 +1752,7 @@ int commander_thread_main(int argc, char *argv[])
} else {
/* check sensors also */
(void)Commander::preflightCheck(&mavlink_log_pub, true, true, true, true, chAirspeed,
(status.rc_input_mode == vehicle_status_s::RC_IN_MODE_DEFAULT), (arm_without_gps == 0), hotplug_timeout);
(status.rc_input_mode == vehicle_status_s::RC_IN_MODE_DEFAULT), !can_arm_without_gps, hotplug_timeout);
}
}
@@ -1852,7 +1857,8 @@ int commander_thread_main(int argc, char *argv[])
true /* fRunPreArmChecks */,
&mavlink_log_pub,
&status_flags,
avionics_power_rail_voltage)) {
avionics_power_rail_voltage,
can_arm_without_gps)) {
mavlink_log_info(&mavlink_log_pub, "DISARMED by safety switch");
arming_state_changed = true;
}
@@ -2128,7 +2134,8 @@ int commander_thread_main(int argc, char *argv[])
true /* fRunPreArmChecks */,
&mavlink_log_pub,
&status_flags,
avionics_power_rail_voltage);
avionics_power_rail_voltage,
can_arm_without_gps);
if (arming_ret == TRANSITION_CHANGED) {
arming_state_changed = true;
@@ -2382,7 +2389,8 @@ int commander_thread_main(int argc, char *argv[])
true /* fRunPreArmChecks */,
&mavlink_log_pub,
&status_flags,
avionics_power_rail_voltage);
avionics_power_rail_voltage,
can_arm_without_gps);
if (arming_ret == TRANSITION_CHANGED) {
arming_state_changed = true;
@@ -2429,7 +2437,8 @@ int commander_thread_main(int argc, char *argv[])
true /* fRunPreArmChecks */,
&mavlink_log_pub,
&status_flags,
avionics_power_rail_voltage);
avionics_power_rail_voltage,
can_arm_without_gps);
if (arming_ret == TRANSITION_CHANGED) {
arming_state_changed = true;
@@ -3703,7 +3712,8 @@ void *commander_low_prio_loop(void *arg)
false /* fRunPreArmChecks */,
&mavlink_log_pub,
&status_flags,
avionics_power_rail_voltage)) {
avionics_power_rail_voltage,
can_arm_without_gps)) {
answer_command(cmd, vehicle_command_s::VEHICLE_CMD_RESULT_DENIED, command_ack_pub, command_ack);
break;
} else {
@@ -3787,7 +3797,7 @@ void *commander_low_prio_loop(void *arg)
}
status_flags.condition_system_sensors_initialized = Commander::preflightCheck(&mavlink_log_pub, true, true, true, true, checkAirspeed,
!(status.rc_input_mode >= vehicle_status_s::RC_IN_MODE_OFF), false, hotplug_timeout);
!(status.rc_input_mode >= vehicle_status_s::RC_IN_MODE_OFF), !can_arm_without_gps, hotplug_timeout);
arming_state_transition(&status,
&battery,
@@ -3797,7 +3807,8 @@ void *commander_low_prio_loop(void *arg)
false /* fRunPreArmChecks */,
&mavlink_log_pub,
&status_flags,
avionics_power_rail_voltage);
avionics_power_rail_voltage,
can_arm_without_gps);
} else {
tune_negative(true);