ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | Q&A
Ask Your Question

how do I install/build costmap (Beginners Question)

asked 2013-05-28 12:43:25 -0600

GeorgH gravatar image

updated 2013-11-14 12:28:55 -0600

tfoote gravatar image

I know its probably a really easy question - so sorry for asking, but I really dont get it to run.

I have a running fuerte installation on ubuntu. For my own rrt implementation, I would like to use the costmap of the navigation stack.

But when I try to compile anything with

#include <costmap_2d/costmap_2d_ros.h>

it get only the message that its not possible to find this header.

But the stack is located under /opt/ros/fuerte/stacks/navigation/costmap_2d and can be find by ros (verifed using roscd costmap_2d)

What else do I have to do to make this compiling? Im really out of ideas at the moment. Do I have to compile the navigation stack somehow? rosmake costmap_2d does nothing, as far as I can tell


As suggested, I tried to add the missing header file to my cmake list by using the following code:

set(YOUR_DIRECTORY /opt/ros/fuerte/stacks/navigation/costmap_2d/include)
include_directories( ${YOUR_DIRECTORY})
set(SOURCES ${YOUR_DIRECTORY}/costmap_2d/costmap_2d_ros.h )

rosbuild_add_executable(myrrtwrapper src/MyRRTWrapper.cpp src/graph/MyVertex.cpp src/graph/MyEdge.cpp src/graph/MyGraph.cpp src/MyRRTSolver.cpp src/MapHelper.cpp ${SOURCES})

now i get:

In file included from /opt/ros/fuerte/stacks/navigation/costmap_2d/include/costmap_2d/costmap_2d.h:42:0,
                 from /opt/ros/fuerte/stacks/navigation/costmap_2d/include/costmap_2d/costmap_2d_ros.h:43,
                 from xx fatal error: pcl/point_types.h: No such file or directory
compilation terminated.

I guess I have to add them too. will try this now

But actually I thought I was using ROS tools for building? I mean I created my base code with roscreate-pkg and this comes with cmake. For all basic stuff like creating nodes, sending messages etc this seems to be really good, but this is the first time I try to build things with the navigation package. What would be the ROS-Way to use it?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2013-05-28 13:03:12 -0600

Bill Smart gravatar image

updated 2013-05-28 14:38:57 -0600

You need to tell your compiler where the include files are, since they are not in a "standard" location. How you actually do this will depend on how you're managing your build (with cmake, make, or just running g++).

Edit: You're setting the include directory to be


and in the code you're (presumably) doing

#include <costmap_2d/costmap_2d_ros.h>

which means that the compiler will be looking for the file


when what you want is


The correct include directory is probably


Of course, the include file you're using will include it's own files, and you'll have to have the directories for these listed in the CMakelists.txt file, too. ROS manages all of this behind the scenes when you build a package. If you're doing it on your own, you'll have to do it by hand (which might be a tedious process).

Have you considered building your code with the ROS build tools, even though it's not ROS code? Might be easier if there are a lot of recursive dependencies.

Edit 2:

If you're using rosmake (or catkin) to build things, then you should also be updating your manifest.xml (or catkin equivalent) in parallel. This will resolve all of the locations for you automatically. I assumed (perhaps wrongly) in the initial answer that you were just invoking cmake and make yourself.

edit flag offensive delete link more


I am using cmake, could you give me a hint how that should look like?

GeorgH gravatar image GeorgH  ( 2013-05-28 13:06:58 -0600 )edit

I know its probably a bit annoying, but I don't really find useful information at the moment. adding include_directories(/opt/ros/fuerte/stacks/navigation/costmap_2d) to my cmake file doesn't change much

GeorgH gravatar image GeorgH  ( 2013-05-28 13:26:14 -0600 )edit

"doesn't change much" isn't a lot of information. It's hard to suggest what to do if you don't tell us what (specific) changes you made to your CMakeLists.txt file, if you re-ran cmake, and all of the details.

Bill Smart gravatar image Bill Smart  ( 2013-05-28 13:31:57 -0600 )edit

I edited my first post. I am really new to cmake, is there a way to get more details? and actually i first tried adding rosbuild_find_ros_stack(costmap_2d) but this seems not to work too

GeorgH gravatar image GeorgH  ( 2013-05-28 13:40:50 -0600 )edit

Thank you a lot, I think I got a bit of a grab why it wasn't working the way I tried it. Updated my upper post again

GeorgH gravatar image GeorgH  ( 2013-05-28 14:07:22 -0600 )edit

It took me more then 1 hour but the solution is only to <depend package="costmap_2d" /> to my manifest? I am not sure if I should cry or not, but still thank you a lot for your help!

GeorgH gravatar image GeorgH  ( 2013-05-28 14:45:09 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools


Asked: 2013-05-28 12:43:25 -0600

Seen: 2,043 times

Last updated: May 28 '13