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

ros integration into another project fails with rosbuild_init

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

fotte gravatar image

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

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:

ADD_SUBDIRECTORY(myStack/myNode)

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
  "/home/f/project/myStack/myNode".
  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:

SET(ROSBUILD_DONT_REDEFINE_PROJECT 1)
SET(PROJECT_NAME "myNode")

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

Comments

What is your $ROS_PACKAGE_PATH? Does `roscd myStack` work?
joq gravatar image joq  ( 2012-02-02 01:44:44 -0600 )edit
yep works fine. i end up in /path_to/myStack/
fotte gravatar image fotte  ( 2012-02-02 01:59:13 -0600 )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 -0600 )edit

2 Answers

Sort by ยป oldest newest most voted
1

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

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
0

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

tmain gravatar image

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

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

edit flag offensive delete link more

Question Tools

Stats

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

Seen: 851 times

Last updated: Jun 15 '12