From 5d3401897c35cb8300fb9b920cdd1356f2587ecb Mon Sep 17 00:00:00 2001
From: Valenza Florian <fvalenza@laas.fr>
Date: Mon, 19 Sep 2016 13:02:47 +0200
Subject: [PATCH] [C++][eigen] Remove call to eigen method hasNaN to ensure
 compatibility with eigen 3.0.5. Provide our own implementation

---
 CMakeLists.txt             |  1 +
 src/math/matrix.hpp        | 34 ++++++++++++++++++++++++++++++++++
 src/parsers/urdf/model.cpp |  5 +++--
 3 files changed, 38 insertions(+), 2 deletions(-)
 create mode 100644 src/math/matrix.hpp

diff --git a/CMakeLists.txt b/CMakeLists.txt
index ed2b4e253..26bb27ab5 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -118,6 +118,7 @@ SET(${PROJECT_NAME}_MATH_HEADERS
   math/fwd.hpp
   math/sincos.hpp
   math/quaternion.hpp
+  math/matrix.hpp
   )
 
 SET(${PROJECT_NAME}_TOOLS_HEADERS
diff --git a/src/math/matrix.hpp b/src/math/matrix.hpp
new file mode 100644
index 000000000..08e09bb41
--- /dev/null
+++ b/src/math/matrix.hpp
@@ -0,0 +1,34 @@
+//
+// Copyright (c) 2016 CNRS
+//
+// This file is part of Pinocchio
+// Pinocchio is free software: you can redistribute it
+// and/or modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation, either version
+// 3 of the License, or (at your option) any later version.
+//
+// Pinocchio is distributed in the hope that it will be
+// useful, but WITHOUT ANY WARRANTY; without even the implied warranty
+// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Lesser Public License for more details. You should have
+// received a copy of the GNU Lesser General Public License along with
+// Pinocchio If not, see
+// <http://www.gnu.org/licenses/>.
+
+#ifndef __math_matrix_hpp__
+#define __math_matrix_hpp__
+
+#include <Eigen/Dense>
+
+namespace se3
+{
+
+  template<typename Derived>
+  inline bool hasNaN(const Eigen::DenseBase<Derived> & m) 
+  {
+    return !((m.derived().array()==m.derived().array()).all());
+  }
+
+
+}
+#endif //#ifndef __math_matrix_hpp__
diff --git a/src/parsers/urdf/model.cpp b/src/parsers/urdf/model.cpp
index c7cb4e267..d7799c7c3 100644
--- a/src/parsers/urdf/model.cpp
+++ b/src/parsers/urdf/model.cpp
@@ -16,6 +16,7 @@
 // Pinocchio If not, see
 // <http://www.gnu.org/licenses/>.
 
+#include "pinocchio/math/matrix.hpp"
 #include "pinocchio/parsers/urdf.hpp"
 #include "pinocchio/parsers/urdf/utils.hpp"
 #include "pinocchio/multibody/model.hpp"
@@ -75,8 +76,8 @@ namespace se3
         // Reference to model.frames[fid] can has changed because the vector
         // may have been reallocated.
         if (model.frames[fid].parent > 0) {
-          assert (!model.inertias[model.frames[fid].parent].lever().hasNaN()
-              &&  !model.inertias[model.frames[fid].parent].inertia().data().hasNaN());
+          assert (!hasNaN(model.inertias[model.frames[fid].parent].lever())
+              &&  !hasNaN(model.inertias[model.frames[fid].parent].inertia().data()));
         }
       }
 
-- 
GitLab