aboutsummaryrefslogtreecommitdiff
path: root/src/modules/commander/state_machine_helper.cpp
diff options
context:
space:
mode:
authorThomas Gubler <thomasgubler@gmail.com>2014-08-14 22:38:48 +0200
committerThomas Gubler <thomasgubler@gmail.com>2014-08-14 22:38:48 +0200
commit0f2b66fa8b3782c965966e9c0b0b6f16b80d7f38 (patch)
tree39198a4d63386694cc95449d4326e0801f5875a7 /src/modules/commander/state_machine_helper.cpp
parent9ee6ab366d2a7c6f24e2f08021da9cd861663bdc (diff)
downloadpx4-firmware-0f2b66fa8b3782c965966e9c0b0b6f16b80d7f38.tar.gz
px4-firmware-0f2b66fa8b3782c965966e9c0b0b6f16b80d7f38.tar.bz2
px4-firmware-0f2b66fa8b3782c965966e9c0b0b6f16b80d7f38.zip
failsafe: enable support for commands
Diffstat (limited to 'src/modules/commander/state_machine_helper.cpp')
-rw-r--r--src/modules/commander/state_machine_helper.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/modules/commander/state_machine_helper.cpp b/src/modules/commander/state_machine_helper.cpp
index ecfe62e03..157e35ef8 100644
--- a/src/modules/commander/state_machine_helper.cpp
+++ b/src/modules/commander/state_machine_helper.cpp
@@ -491,10 +491,19 @@ bool set_nav_state(struct vehicle_status_s *status, const bool data_link_loss_en
case MAIN_STATE_AUTO_MISSION:
/* go into failsafe
+ * - if commanded to do so
* - if we have an engine failure
* - if either the datalink is enabled and lost as well as RC is lost
* - if there is no datalink and the mission is finished */
- if (status->engine_failure) {
+ if (status->engine_failure_cmd) {
+ status->nav_state = NAVIGATION_STATE_AUTO_LANDENGFAIL;
+ } else if (status->data_link_lost_cmd) {
+ status->nav_state = NAVIGATION_STATE_AUTO_RTGS;
+ //} else if (status->gps_failure_cmd) {
+ //status->nav_state = NAVIGATION_STATE_AUTO_***;
+ } else if (status->rc_signal_lost_cmd) {
+ status->nav_state = NAVIGATION_STATE_AUTO_RTGS; //XXX
+ } else if (status->engine_failure) {
status->nav_state = NAVIGATION_STATE_AUTO_LANDENGFAIL;
} else if (((status->data_link_lost && data_link_loss_enabled) && status->rc_signal_lost) ||
(!data_link_loss_enabled && status->rc_signal_lost && mission_finished)) {