ROS 中配置使用Eigen库

ROS Indigo中配置使用Eigen库需添加以下3项:

CMakeLists.txt

cmake_minimum_required(VERSION 2.8.3)
project(lyz_test)

find_package(catkin REQUIRED COMPONENTS
roscpp
cmake_modules # 添加 1
)
find_package(Eigen REQUIRED) # 添加 2
catkin_package(
INCLUDE_DIRS include
CATKIN_DEPENDS roscpp
)
include_directories(
include
${catkin_INCLUDE_DIRS}
)
include_directories(${Eigen_INCLUDE_DIRS}) # 添加3

add_executable(lyz_test_node src/lyz_test_node.cpp)

target_link_libraries(lyz_test_node
${catkin_LIBRARIES}
)

注1:头文件添加 #include “Eigen/Eigen”
注2:自己解压的Eigen库需在CMakeLists.txt中添加include_directories(…(path)/eigen/)

你可能感兴趣的:(ROS,Eigen)