From 351304ebcbf78f726a67d4d9a21984f3281bd2b6 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sun, 30 Apr 2017 22:00:21 +1000 Subject: [PATCH] Plane: don't set fly-forward when transitioning when quad motors are providing assistance don't see the fly-forward flag in the AHRS. This will lower the chance of EKF yaw confusion --- ArduPlane/ArduPlane.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/ArduPlane/ArduPlane.cpp b/ArduPlane/ArduPlane.cpp index 5255b42f16..53fe969c67 100644 --- a/ArduPlane/ArduPlane.cpp +++ b/ArduPlane/ArduPlane.cpp @@ -595,8 +595,11 @@ void Plane::update_flight_mode(void) steer_state.hold_course_cd = -1; } - // ensure we are fly-forward - if (quadplane.in_vtol_mode()) { + // ensure we are fly-forward when we are flying as a pure fixed + // wing aircraft. This helps the EKF produce better state + // estimates as it can make stronger assumptions + if (quadplane.in_vtol_mode() || + quadplane.in_assisted_flight()) { ahrs.set_fly_forward(false); } else { ahrs.set_fly_forward(true);