ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
2

Writing a simple CMakeLists.txt file for ROS

asked 2015-05-25 08:37:39 -0500

Karnivaurus gravatar image

updated 2015-05-25 08:37:56 -0500

I am new to ROS (Indigo), and I want to write a C++ program to use the MoveIt! package.

However, I am confused as to what I need to have in my CMakeLists.txt file, such that the header and library files can be found.

For example, here is the file so far:

cmake_minimum_required(VERSION 2.8.1)

project(MicoMoveIt)

set(CMAKE_CXX_FLAGS "-std=c++11")

file(GLOB srcs *.cpp)

include_directories(/opt/ros/indigo/include)

link_directories(/opt/ros/indigo/lib)

add_executable(${PROJECT_NAME} ${srcs})

And my main.cpp file is:

#include <ros/ros.h>
#include <moveit/move_group_interface/move_group.h>

int main()
{
    moveit::planning_interface::MoveGroup group("right_arm");
    return 0;
}

But compiling this gives me the error:

/opt/ros/indigo/include/moveit/robot_model/joint_model.h:47: error: Eigen/Geometry: No such file or directory
 #include <Eigen/Geometry>
                          ^

So, I need to specify where to find these Eigen header files. But given that Eigen is a dependency of MoveIt!, then I shouldn't have to manually include all these header file directories.

How should I be writing the CMakeLists.txt file so that all header and library directories of dependencies are included?

edit retag flag offensive close merge delete

Comments

Did you review the extensive documentation on CMakeLists.txt and catkin and the catkin docs?

gvdhoorn gravatar image gvdhoorn  ( 2016-01-14 13:36:20 -0500 )edit

2 Answers

Sort by ยป oldest newest most voted
0

answered 2015-05-26 11:27:20 -0500

Fleurmond gravatar image

For what it's worth,

Could you try to install these packages:

ros-indigo-eigen-utils, ros-indigo-eigen-conversions

I'm using currently groovy and I don't have any experiences with indigo, but did you follow this tutorial ?

http://wiki.ros.org/ROS/Tutorials/Cre...

I would suggest you to follow all the tutorials for the beginner before writing any code.

http://wiki.ros.org/ROS/Tutorials

edit flag offensive delete link more
1

answered 2016-01-14 11:06:04 -0500

crunchex gravatar image

The question is not really related to the problem, but here's my answer to your actual problem with Eigen specifically. It's an issue with Ubuntu 14.04's installation of Eigen3 which I guess must have changed since the Moveit code was written. You can fix this by creating a symlink from /usr/include/eigen3/Eigen to /usr/local/include/Eigen and CMake should be able to find the libraries. Of course, double-check that those libraries really do exist in that path.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2015-05-25 08:37:39 -0500

Seen: 5,007 times

Last updated: Jan 14 '16