forked from Archive/PX4-Autopilot
state_machine_helper: added missed transition to FAILSAFE_STATE_LAND, transition conditions fixed
This commit is contained in:
parent
7d2efe9367
commit
b7c69262a7
|
@ -377,17 +377,28 @@ transition_result_t failsafe_state_transition(struct vehicle_status_s *status, f
|
||||||
} else {
|
} else {
|
||||||
switch (new_failsafe_state) {
|
switch (new_failsafe_state) {
|
||||||
case FAILSAFE_STATE_NORMAL:
|
case FAILSAFE_STATE_NORMAL:
|
||||||
|
/* always allowed (except from TERMINATION state) */
|
||||||
ret = TRANSITION_CHANGED;
|
ret = TRANSITION_CHANGED;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case FAILSAFE_STATE_RTL:
|
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;
|
ret = TRANSITION_CHANGED;
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case FAILSAFE_STATE_TERMINATION:
|
case FAILSAFE_STATE_TERMINATION:
|
||||||
|
/* always allowed */
|
||||||
ret = TRANSITION_CHANGED;
|
ret = TRANSITION_CHANGED;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue