Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using Eigen Library in ROS Indigo

Tags:

cmake

ros

eigen

I am working on a project in ROS Indigo that requires using the Eigen libraries. According to indigo/Migration page on the ROS Wiki, the FindEigen.cmake module is now in the cmake_modules package.

After following steps to add the cmake_modules package to the project's CMake.txt (via find_package) and adding a build dependency to the package.xml (< build_depend >cmake_modules< /build_depend >), I'm still having issues compiling the project. I've looked at various sources citing the above steps should fix the issue in ROS Indigo, but can't seem to get it working. Here is the CMake file, and here is the package.xml . Additionally, I added the FindEigen.cmake file in the project folder. Any help would be greatly appreciated! The error reads:

CMake Error at /opt/ros/indigo/share/catkin/cmake/catkinConfig.cmake:75 (find_package):
Could not find a package configuration file provided by "Eigen" with any of the 
following names:
  EigenConfig.cmake
  eigen-config.cmake

Add the installation prefix of "Eigen" to CMAKE_PREFIX_PATH or set
"Eigen_DIR" to a directory containing one of the above files.  If "Eigen"
provides a separate development package or SDK, be sure it has been
installed.
Call Stack (most recent call first):
lidar_point_cloud/CMakeLists.txt:9 (find_package)
like image 589
smannan Avatar asked May 03 '15 19:05

smannan


1 Answers

Just for post completeness, and following this answer in Answers ROS:

If you have Eigen already installed (check with sudo apt-get install libeigen3-dev), then you have to add the corresponding cmake_modules and Eigen lines to the CMakeLists.txt and package.xml files:

package.xml

<build_depend>cmake_modules</build_depend>
<run_depend>cmake_modules</run_depend> 

CMakeLists.txt

find_package(catkin REQUIRED cmake_modules)
find_package(Eigen REQUIRED)

catkin_package(
  INCLUDE_DIRS ...
  LIBRARIES ...
  CATKIN_DEPENDS ....
  DEPENDS Eigen
)

include_directories(
   ...
   ${Eigen_INCLUDE_DIRS}
 )

UPDATE: Note that the following is not required because the FindEigen.cmake module does not define Eigen_LIBRARIES becuse it is a header only library:

 target_link_libraries(my_target
   ....
   ${Eigen_LIBRARIES}
 )

More information: http://wiki.ros.org/indigo/Migration#cmake_modules

UPDATE: In fact <run_depend>cmake_modules</run_depend> is not needed as cmake_modules are not a runtime dependency.


In addition, you could use the ROS ecl wrappers: http://wiki.ros.org/ecl

like image 82
Javi Avatar answered Nov 15 '22 14:11

Javi