From 828363948d4f055dc7241fd4d00379c18d0a0263 Mon Sep 17 00:00:00 2001 From: edouard Date: Thu, 26 Aug 2010 12:58:57 +0000 Subject: [PATCH] Fix for PFD gadget so that it does not freeze the GCS in case attitude values are "NaN", which can happen in some situations with the AHRS. git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1415 ebee16cc-31ac-478f-84a7-5cbb03baadba --- ground/src/plugins/pfd/pfdgadgetwidget.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/ground/src/plugins/pfd/pfdgadgetwidget.cpp b/ground/src/plugins/pfd/pfdgadgetwidget.cpp index cca159dc4..16e70440f 100644 --- a/ground/src/plugins/pfd/pfdgadgetwidget.cpp +++ b/ground/src/plugins/pfd/pfdgadgetwidget.cpp @@ -789,6 +789,13 @@ void PFDGadgetWidget::moveSky() { return; } + // In some instances, it can happen that the rollValue & target are + // invalid inside the UAVObjects, and become a "nan" value, which freezes + // the PFD and the whole GCS: for this reason, we check this here. + // The strange check below works, it is a workaround because "isnan(double)" + // is not supported on every compiler. + if (rollTarget != rollTarget || pitchTarget != pitchTarget) + return; ////// // Roll //////