state_machine_helper: added missed transition to FAILSAFE_STATE_LAND, transition conditions fixed

This commit is contained in:
Anton Babushkin 2014-01-26 11:58:50 +01:00
parent 7d2efe9367
commit b7c69262a7
1 changed files with 12 additions and 1 deletions

View File

@ -377,17 +377,28 @@ transition_result_t failsafe_state_transition(struct vehicle_status_s *status, f
} else {
switch (new_failsafe_state) {
case FAILSAFE_STATE_NORMAL:
/* always allowed (except from TERMINATION state) */
ret = TRANSITION_CHANGED;
break;
case FAILSAFE_STATE_RTL:
if (status->condition_global_position_valid) {
/* global position and home position required for RTL */
if (status->condition_global_position_valid && status->condition_home_position_valid) {
ret = TRANSITION_CHANGED;
}
break;
case FAILSAFE_STATE_LAND:
/* at least relative altitude estimate required for landing */
if (status->condition_local_altitude_valid || status->condition_global_position_valid) {
ret = TRANSITION_CHANGED;
}
break;
case FAILSAFE_STATE_TERMINATION:
/* always allowed */
ret = TRANSITION_CHANGED;
break;