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

Package dependencies and include dirs

asked 2016-09-19 11:47:45 -0600

arennuit gravatar image

Hi all,

I have a package1 which generates services via a Type1.srv file. These generated services are located in <catkin_ws>/devel/include/package1/Type1.h. This all works fine.

Now when I want a package2 to also use the services generated in package1 I follow the steps described in here.

Now when building I get the following error:

... fatal error: package1/Type1.h: No such file or directory
 #include "package1/Type1.h"
                                ^
compilation terminated.

Now it turns out package1/Type1.h is well generated and does lie in devel/include/package1/Type1.h.

So I output the content of package1_FOUND, package1_INCLUDE_DIRS and catkin_INCLUDE_DIRS from package2's CMakeLists.txt and it reads:

package1_FOUND : 1
package1_INCLUDE_DIRS : /opt/ros/indigo/include/usr/include
catkin_INCLUDE_DIRS : /opt/ros/indigo/include/usr/include

I would expect to get ../devel/include for these values, no?

Anyone knows what I am missing here? How can I let my system know about the include path to devel/include? I guess I do not have to set these includes by hand, do I?

Kind regards,

Antoine.

edit retag flag offensive close merge delete

Comments

1

No, for headers generated from msgs the include paths should be added automatically. It would help if you could include the relevant CMakeLists.txt (please without all the comments).

gvdhoorn gravatar image gvdhoorn  ( 2016-09-19 12:16:16 -0600 )edit
1

Make sure you have the right dependencies listed in package.xml and CMakeLists.txt. If you don't have your package1 listed as a dependency, the include path will be wrong. As @gvdhoom points out, if you post them it would be easier for others to help you find what's wrong.

Mark Rose gravatar image Mark Rose  ( 2016-09-19 17:04:01 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2016-09-21 02:03:46 -0600

arennuit gravatar image

The root of my problem actually lied in my use of orocos. Orocos actually requires to replace catkin_package by orocos_generate_package() and use ${USE_OROCOS_INCLUDE_DIRS} in addition to ${catkin_INCLUDE_DIRS}.

I already found CMake dirty (because of its lack of clear structure), then catkin added a layer of confusion with its needed redundancy, now I must admit the addition of the orocos build system requirements on top of the former two is a real pain.

Thanks for your help guys, you really helped!

edit flag offensive delete link more

Comments

1

I think you might be able to make some of this more clear and reduce layering by creating separate pkgs for msgs, services and the rest (ie: nodes).

gvdhoorn gravatar image gvdhoorn  ( 2016-09-21 02:06:32 -0600 )edit

You mean I should split my packages so that a single package does not define services (for instance) and nodes (or orocos components) at the same time, is that right?

arennuit gravatar image arennuit  ( 2016-09-21 05:14:40 -0600 )edit
1

Yes.

That is a recommended practice anyway, as it allows users of your services or messages to depend just on your msg pkgs, instead of having to install everything. It would clearly separate your ROS API from your implementation.

gvdhoorn gravatar image gvdhoorn  ( 2016-09-21 05:31:11 -0600 )edit

This is very clear, thanks a lot!

arennuit gravatar image arennuit  ( 2016-09-21 06:02:02 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2016-09-19 11:47:45 -0600

Seen: 605 times

Last updated: Sep 21 '16