From 87e964ec10e6d4cdb8c90b905944e7c158158074 Mon Sep 17 00:00:00 2001 From: Julian Oes Date: Thu, 14 Jul 2016 09:53:41 +0200 Subject: [PATCH] commander: POSCTL with localpos for MC Fixedwings need a global position estimate for POSCTL. --- src/modules/commander/state_machine_helper.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/modules/commander/state_machine_helper.cpp b/src/modules/commander/state_machine_helper.cpp index a631a1a3e5..483f52cc08 100644 --- a/src/modules/commander/state_machine_helper.cpp +++ b/src/modules/commander/state_machine_helper.cpp @@ -674,8 +674,12 @@ bool set_nav_state(struct vehicle_status_s *status, struct commander_state_s *in } /* As long as there is RC, we can fallback to ALTCTL, or STAB. */ - /* A local position estimate is enough for POSCTL, this enables POSCTL using e.g. flow. */ - } else if (!status_flags->condition_local_position_valid && armed) { + /* A local position estimate is enough for POSCTL for multirotors, + * this enables POSCTL using e.g. flow. + * For fixedwing, a global position is needed. */ + } else if (((status->is_rotary_wing && !status_flags->condition_local_position_valid) || + (!status->is_rotary_wing && !status_flags->condition_global_position_valid)) + && armed) { status->failsafe = true; if (status_flags->condition_local_altitude_valid) {