Ask Your Question

Using Armadillo C++ library with ROS [closed]

asked 2012-11-27 12:06:23 -0500

Nishant gravatar image

updated 2014-04-20 14:09:45 -0500

ngrennan gravatar image

Hello all!

So I am trying to use the armadillo library for my project with ROS. I installed armadillo on my computer (Ubuntu 12.04) using the commands

sudo apt-get install libarmadillo2

sudo apt-get install libarmadillo-dev

More about the armadillo library and related downloads can be found here:

I then downloaded the armadillo package, and navigated to the "examples" folder. There, I typed "make" in the commandline to build the executables from the example files. I then ran an example which required LAPACK and BLAS (which I have installed a long time ago) to complete. This example ran perfectly. (Actually, the example calculated the inverse and determinant of a sample matrix A, which require LAPACK and BLAS to be installed). So far, so good.

Now I have a ROS package, which requires armadillo. I copied the file called "armadillo" and the folder called "armadillo bits" into the "include" folder of my ROS package. I then went into /include/armadillo_bits/config.hpp and configured LAPACK and BLAS by doing



I then went back into the main package folder, and did "rosmake". Everything compiled fine. I then did

rosrun mypackage mypackage

and I get the following error:

error: svd(): use of LAPACK needs to be enabled

terminate called after throwing an instance of 'std::logic_error'
Aborted (core dumped)

Apparently, the svd() function (which also needs LAPACK and BLAS like the inverse and determinant functions) cannot detect LAPACK. This is weird, because it worked with the example file in the armadillo "examples" folder.

I have a feeling that I am not linking to the right libraries, and there is something fishy going on. How do I get Armadillo to work inside a ROS package, the same way I got it to work inside the "examples" folder in the armadillo folder?

All help is greatly appreciated.



edit retag flag offensive reopen merge delete

Closed for the following reason question is not relevant or outdated by tfoote
close date 2014-10-28 00:12:37.616604

1 Answer

Sort by ยป oldest newest most voted

answered 2012-11-27 12:28:41 -0500

Nishant gravatar image

Oh, I got it. There are 2(very similar) ways to do this:

1) In your header file which includes all the libraries, instead of

#include <armadillo>


#include </usr/include/armadillo>

2) You can also use the library that you copied into the "include" folder of your package, by doing

#include <../include/armadillo>

Both seem to work. Can anyone else suggest any other method? It would be nice to know these things.



edit flag offensive delete link more

Question Tools


Asked: 2012-11-27 12:06:23 -0500

Seen: 3,748 times

Last updated: Nov 27 '12