diff options
author | Anton Babushkin <anton.babushkin@me.com> | 2014-04-23 19:01:05 +0200 |
---|---|---|
committer | Anton Babushkin <anton.babushkin@me.com> | 2014-04-23 19:01:05 +0200 |
commit | 56592ec77d3863f135c10619b15a0591f957fdbf (patch) | |
tree | 95ee3077159ad353cf8bdfbf4c6a6c2643ffedec | |
parent | e4a4430f9f0be24c661e507f6e959a571937934c (diff) | |
download | px4-firmware-56592ec77d3863f135c10619b15a0591f957fdbf.tar.gz px4-firmware-56592ec77d3863f135c10619b15a0591f957fdbf.tar.bz2 px4-firmware-56592ec77d3863f135c10619b15a0591f957fdbf.zip |
commander: don't start RTL on failsafe if landed
-rw-r--r-- | src/modules/commander/commander.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/modules/commander/commander.cpp b/src/modules/commander/commander.cpp index 271209412..ac433b1c7 100644 --- a/src/modules/commander/commander.cpp +++ b/src/modules/commander/commander.cpp @@ -1015,7 +1015,7 @@ int commander_thread_main(int argc, char *argv[]) status_changed = true; } - /* update subsystem */ + /* update position setpoint triplet */ orb_check(pos_sp_triplet_sub, &updated); if (updated) { @@ -1273,10 +1273,15 @@ int commander_thread_main(int argc, char *argv[]) } else { /* failsafe for manual modes */ - transition_result_t res = failsafe_state_transition(&status, FAILSAFE_STATE_RTL); + transition_result_t res = TRANSITION_DENIED; + + if (!status.condition_landed) { + /* vehicle is not landed, try to perform RTL */ + res = failsafe_state_transition(&status, FAILSAFE_STATE_RTL); + } if (res == TRANSITION_DENIED) { - /* RTL not allowed (no global position estimate), try LAND */ + /* RTL not allowed (no global position estimate) or not wanted, try LAND */ res = failsafe_state_transition(&status, FAILSAFE_STATE_LAND); if (res == TRANSITION_DENIED) { |