Updated Eigen math library commit

319 views
Skip to first unread message

Daniel Frenzel

unread,
Dec 2, 2015, 9:42:54 AM12/2/15
to drones-discuss
I just updated the Eigen commit. After some discussion, I followed the advice and moved the extensions out of my custom classes.
Fortunately, it is possible to include functions via extension files at compile time into the Eigen core classes.
There are still some compatibility classes with the new prefix Compat_* to convert ArduPilot types into Eigen types, but they are completely optional.
I added as used some demos.. 

Best, Daniel

Daniel Frenzel

unread,
Dec 2, 2015, 10:02:35 AM12/2/15
to drones-discuss
Can we use hard float build environment on PX4 platform?

Lucas De Marchi

unread,
Dec 2, 2015, 10:32:54 AM12/2/15
to drones-discuss
Hi Daniel,
Thanks, very appreciated.

And with the upcoming unit test we will even be able to check we are
not changing the behavior while doing the switch.


Lucas De Marchi

Daniel Frenzel

unread,
Dec 3, 2015, 7:15:45 AM12/3/15
to drones-discuss
Hi Lucas,
do you know how to disable the warnings related with -Wlogical-op?
I tried to set a -Wno-logical-op but it doesn't work. 

Best, Daniel

Daniel Frenzel

unread,
Dec 3, 2015, 7:59:20 AM12/3/15
to drones-discuss
 * Tried to optimize my algebra functions for vectorization 

Tom Pittenger

unread,
Dec 3, 2015, 12:02:06 PM12/3/15
to drones-discuss
I can't find what -Wlogical-op does, which warnings are you trying to address with it? It's certainly better to fix warnings rather than mute them because they're usually there for a reason.

On Thu, Dec 3, 2015 at 4:59 AM, Daniel Frenzel <dgda...@googlemail.com> wrote:
 * Tried to optimize my algebra functions for vectorization 

--
You received this message because you are subscribed to the Google Groups "drones-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to drones-discus...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Daniel Frenzel

unread,
Dec 3, 2015, 1:18:03 PM12/3/15
to drones-discuss
Actually, I only see these warning if I compile Eigen together with AP.
From deep inside of the core lib of Eigen :D

Tom Pittenger

unread,
Dec 3, 2015, 4:03:36 PM12/3/15
to drones-discuss
even on a clean build?

On Thu, Dec 3, 2015 at 10:18 AM, Daniel Frenzel <dgda...@googlemail.com> wrote:
Actually, I only see these warning if I compile Eigen together with AP.
From deep inside of the core lib of Eigen :D

--

Daniel Frenzel

unread,
Dec 4, 2015, 9:13:20 AM12/4/15
to drones-discuss
It's ARM compiler related. Means it will not happen on most platforms.
Additionally, it is not my code, but the Eigen library which causes these warnings in most cases. 
Wrote a minimal example for this. 

 :D

Pierre Kancir

unread,
Dec 4, 2015, 11:11:09 AM12/4/15
to drones-discuss
 I got the same shitting error that travis ... 
CXX:     /home/khancyr/Workspace/ardupilot/libraries/Filter/LowPassFilter.cpp
In file included from /usr/arm-none-eabi/include/c++/4.9.3/random:51:0,
                 
from /usr/arm-none-eabi/include/c++/4.9.3/bits/stl_algo.h:66,
                 
from /usr/arm-none-eabi/include/c++/4.9.3/algorithm:62,
                 
from /home/khancyr/Workspace/ardupilot/libraries/AP_Eigen/eigen/Eigen/Core:160,
                 
from /home/khancyr/Workspace/ardupilot/libraries/AP_Eigen/AP_Eigen.h:22,
                 
from /home/khancyr/Workspace/ardupilot/libraries/Filter/LowPassFilter.cpp:96:
/usr/arm-none-eabi/include/c++/4.9.3/bits/random.tcc: In member function 'void std::poisson_distribution<_IntType>::param_type::_M_initialize()':
/usr/arm-none-eabi/include/c++/4.9.3/bits/random.tcc:1402:13: error: 'lgamma' is not a member of 'std'
    _M_lfm
= std::lgamma(__m + 1);
             
^
compilation terminated due to
-Wfatal-errors.

I also try with up-to-date Eigen lib : https://github.com/RLovelett/eigen. and #define _GLIBCXX_USE_C99_MATH_TR1 1 (as read on google on some thread on google)
And adding ARCHCPUFLAGS = -mcpu=cortex-m4 -mthumb -march=armv7e-m -mfpu=fpv4-sp-d16 -mfloat-abi=hard to build with optimisation . By the way, why aren't the build use this by default ? (same for linux build.....)

No more luck with gcc-arm-none-eabi from https://launchpad.net/~terry.guo/+archive/ubuntu/gcc-arm-embedded (as expected, it is the same build but easier to install on ubuntu)

Daniel Frenzel

unread,
Dec 5, 2015, 9:56:32 AM12/5/15
to drones-discuss
I am sorry for the problems on PX4. I discussed this at the commits page.
On PX4 we use the non-eabi ARM toolchain, which was working till gcc 4.8.*. 
Unfortunately, _every_ c99 and up standard function is not allowed with GCC 4.9. 
See a list of forbidden functions: https://de.wikipedia.org/wiki/Math.h#C99-Funktionen 
I am not very happy with this. 

Best, Daniel

Andy Little

unread,
Dec 5, 2015, 1:16:32 PM12/5/15
to drones-discuss
Could try making a header

namespace std{

 using ::lgamma;

  // etc
}

Worked for me anyway!

regards
Andy

Daniel Frenzel

unread,
Dec 7, 2015, 8:53:01 AM12/7/15
to drones-discuss
This is not all what's necessary, but I created a PX4 compatibility header. 
I hope most stuff compiles now @PX4 :D

Daniel Frenzel

unread,
Dec 7, 2015, 9:25:12 AM12/7/15
to drones-discuss
Travis is compiling the commit as it looks.
Nevertheless, the ARM none-eabi is a pain. 
The higher level c++ standard library cannot even compile with std-cxx11 enabled :D 

Andy Little

unread,
Dec 7, 2015, 1:10:12 PM12/7/15
to drones-discuss
Unless you enable exceptions it is not advisable to use much of the standard library for embedded. Does Eigen make use of it?

Google "Freestanding v Hosted C++" and similar for more discussion.


regards
Andy

Daniel Frenzel

unread,
Dec 7, 2015, 1:30:59 PM12/7/15
to drones-discuss
I don't think they use exceptions. Anyway, I kept changes small.
I disabled cxx11 compilation for Eigen @PX4 and added three functions needed. 
Would be good if someone could test it with a PX4. 

Best, Daniel


Chevy Hu

unread,
Apr 17, 2016, 8:52:29 AM4/17/16
to drones-discuss
I have trouble on integrate the eigen 3 into nuttx, the arm-none-eabi tools not compatible with eigen, and I also tried the uClib++, no better......  any ideas for me? 

Daniel Frenzel

unread,
Apr 17, 2016, 3:48:55 PM4/17/16
to drones-discuss
The commit is outdated, because it was rejected :D
Reply all
Reply to author
Forward
0 new messages