added auto takeoff support, updated configuration for solo and generalized landing mission items

This commit is contained in:
Andreas Antener
2015-12-17 00:11:50 +01:00
committed by Lorenz Meier
parent 3847c826ec
commit fbf42c8949
13 changed files with 287 additions and 30 deletions
+20
View File
@@ -1083,6 +1083,7 @@ int commander_thread_main(int argc, char *argv[])
status.rc_input_blocked = false;
status.rc_input_mode = vehicle_status_s::RC_IN_MODE_DEFAULT;
status.main_state =vehicle_status_s::MAIN_STATE_MANUAL;
status.main_state_prev = vehicle_status_s::MAIN_STATE_MAX;
status.nav_state = vehicle_status_s::NAVIGATION_STATE_MANUAL;
status.arming_state = vehicle_status_s::ARMING_STATE_INIT;
@@ -2348,6 +2349,25 @@ int commander_thread_main(int argc, char *argv[])
}
}
/* handle main state after takeoff and land */
if (status.main_state == vehicle_status_s::MAIN_STATE_AUTO_TAKEOFF
&& mission_result.finished) {
// transition back to state we had before takeoff
if (status.main_state_prev < vehicle_status_s::MAIN_STATE_MAX
&& status.main_state_prev != vehicle_status_s::MAIN_STATE_AUTO_LAND) {
main_state_transition(&status, status.main_state_prev);
}
} else if (status.main_state == vehicle_status_s::MAIN_STATE_AUTO_LAND
&& status.condition_landed) {
// transition back to state we had before takeoff
if (status.main_state_prev < vehicle_status_s::MAIN_STATE_MAX
&& status.main_state_prev != vehicle_status_s::MAIN_STATE_AUTO_TAKEOFF) {
main_state_transition(&status, status.main_state_prev);
}
}
/* handle commands last, as the system needs to be updated to handle them */
orb_check(cmd_sub, &updated);