From 12f4d6f7033390b5bf5f828a01f6f333e635f3fb Mon Sep 17 00:00:00 2001 From: Julian Oes Date: Thu, 28 Apr 2016 16:09:12 +0200 Subject: [PATCH 1/2] ekf: another stab at fixing isfinite for all The previous solution did not work for Snapdragon, so I needed to copy what is used in px4_defines.h. --- EKF/ekf.cpp | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/EKF/ekf.cpp b/EKF/ekf.cpp index d2fcd3b940..f9d90e9465 100644 --- a/EKF/ekf.cpp +++ b/EKF/ekf.cpp @@ -42,6 +42,21 @@ #include "ekf.h" #include "mathlib.h" +#ifndef __PX4_QURT +#if defined(__cplusplus) +#include +#define ISFINITE(x) std::isfinite(x) +#else +#define ISFINITE(x) isfinite(x) +#endif +#endif + +#if defined(__PX4_QURT) +// Missing math.h defines +#define ISFINITE(x) __builtin_isfinite(x) +#endif + + Ekf::Ekf(): _filter_initialised(false), _earth_rate_initialised(false), @@ -343,7 +358,7 @@ bool Ekf::update() calculateOutputStates(); // check for NaN or inf on attitude states - if (!std::isfinite(_state.quat_nominal(0)) || !std::isfinite(_output_new.quat_nominal(0))) { + if (!ISFINITE(_state.quat_nominal(0)) || !ISFINITE(_output_new.quat_nominal(0))) { return false; } From f8a48f9cc5600f2833a0c7d16fcf6ba38997a69e Mon Sep 17 00:00:00 2001 From: Julian Oes Date: Thu, 28 Apr 2016 16:30:49 +0200 Subject: [PATCH 2/2] ekf: now it should even compile for NuttX --- EKF/ekf.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/EKF/ekf.cpp b/EKF/ekf.cpp index f9d90e9465..9826627baa 100644 --- a/EKF/ekf.cpp +++ b/EKF/ekf.cpp @@ -43,7 +43,7 @@ #include "mathlib.h" #ifndef __PX4_QURT -#if defined(__cplusplus) +#if defined(__cplusplus) && !defined(__PX4_NUTTX) #include #define ISFINITE(x) std::isfinite(x) #else