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

ros integration into another project fails with rosbuild_init

asked 2012-02-02 01:24:53 -0500

fotte gravatar image

updated 2012-02-02 01:49:11 -0500

Hi there.

I am trying to integrate a few Rosnodes (packages) into another project that is not part of ros / does not contain further ros-nodes. In the project CMakeLists.txt (folder: /home/f/project/CMakeLists.txt) I simply included my ros CMakeLists files for the stacks.

The folder structure would be

/home/f/project/                # here is the main CMakeLists.txt
/home/f/project/myStack         # here is the stack.xml
/home/f/project/myStack/myNode  # here is the manifest.xml

The include looks like this:


When i now try to run

cmake /home/f/project/CMakeLists.txt

I get the following error:

CMake Error at /opt/ros/electric/ros/core/rosbuild/private.cmake:109 (message):
  [rosbuild] rospack found package "project" at "", but
  the current directory is
  You should double-check your ROS_PACKAGE_PATH to ensure that packages are
  found in the correct precedence order.

in the mentioned private.cmake at line 106 (or so..) rosbuild tries to verify that the projectsource folder and the current source folder are the same -- this fails obviously. And i managed to find out, that the project name is set to 'project' and not 'myStack' which it should be, since rosbuild_init() is only called from the myStack/CMakeLists.txt

Does anyone know a solution to this problem? I tried to find an answer in this wiki already but that did not help me at all. Neither did the rosbuild documentation help me :/

EDIT: when set the following variables:


Then the first thing just works find: e.g. finding the correct project and the rosbuild_init() routine passes the first few checks but breaks a few lines later when it tries to verify the manifest.xml - it seems to try to read the file '/manifest.xml' -- the complete path is missing... any ideas? has someone ever done this?! (im quite sure there must have been people who sucessfully integrated ros into other projects)

edit retag flag offensive close merge delete


What is your $ROS_PACKAGE_PATH? Does `roscd myStack` work?
joq gravatar image joq  ( 2012-02-02 01:44:44 -0500 )edit
yep works fine. i end up in /path_to/myStack/
fotte gravatar image fotte  ( 2012-02-02 01:59:13 -0500 )edit
The working directory for the python script, which tries to verify the manifest.xml is set to /home/f/project/... this looks like the reasen for the whole problem but i do not understand why it was set to that folder... because the main CMakeFile is located there?!
fotte gravatar image fotte  ( 2012-02-02 02:03:14 -0500 )edit

2 Answers

Sort by ยป oldest newest most voted

answered 2012-06-15 20:34:27 -0500

Lorenz gravatar image

The ROS CMake macros were never intended to be used like this. I don't think there is a clean way that doesn't require hacking the CMake macros for solving your case.

Instead of adding your stack using add_subdirectory, you could execute make in that directory using something like add_custom_command. If your ROS packages create messages or libraries, you'll then have to add the include paths and libraries by hand in your CMakeFile.txt. Note that you'll still be required to have ROS installed and your project or at least your stacks inside it need to be in the ROS_PACKAGE_PATH.

edit flag offensive delete link more

answered 2012-06-15 08:27:56 -0500

tmain gravatar image

updated 2012-06-15 08:29:03 -0500

comment/delete the "rosbuild_init()" of the stack/package "CMakeLists.txt" files in the subdirectories

edit flag offensive delete link more

Question Tools


Asked: 2012-02-02 01:24:53 -0500

Seen: 802 times

Last updated: Jun 15 '12