From 1930732403e7d8c809197141cbef504d85c4b248 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Wed, 28 Nov 2012 22:54:43 +0100 Subject: [PATCH] Fixed yaw representation when translating from XPlane --- src/comm/QGCXPlaneLink.cc | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/comm/QGCXPlaneLink.cc b/src/comm/QGCXPlaneLink.cc index 767d3622b..64c3f1a7c 100644 --- a/src/comm/QGCXPlaneLink.cc +++ b/src/comm/QGCXPlaneLink.cc @@ -450,6 +450,13 @@ void QGCXPlaneLink::readBytes() pitch = p.f[0] / 180.0f * M_PI; roll = p.f[1] / 180.0f * M_PI; yaw = p.f[2] / 180.0f * M_PI; + // X-Plane expresses yaw as 0..2 PI + if (yaw > M_PI) { + yaw -= 2.0 * M_PI; + } + if (yaw < -M_PI) { + yaw += 2.0 * M_PI; + } emitUpdate = true; } else if ((xPlaneVersion == 9 && p.index == 17)) -- 2.22.0