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

How to start playing with octomap

asked 2016-01-18 06:07:26 -0500

l4ncelot gravatar image

updated 2016-01-18 10:27:09 -0500

lucasw gravatar image


I recently discovered octomap and was able to run mapping with octomap_server. But my question is how to start implementing this in my own project. I mean... is there some way to improve or extend this project since I don't have access to source code (or do I, I haven't really understood ROS's build system yet)?

For example, when running octomap_mapping.launch, map is generated based on point cloud that I send to given topic. Is there way to modify this to accept multiple sensors from multiple robots and then fuse whole map? What I've read in their article, octomap should be prepared to do this.

Is there for example way to override ROS octomap with and use that and modify it in some way? Because I plan to try this also outside ROS so trying to disconnect it could be very useful in long run.

Sorry, but I basically have no idea how to start using this amazing tool properly.

Thanks a lot for any advice.

edit retag flag offensive close merge delete


Can you publish all the pointclouds onto whatever topic octomap is listening to? The headers ought to distinguish them so octomap doesn't get confused.

lucasw gravatar image lucasw  ( 2016-01-18 10:17:16 -0500 )edit

It would be neat if remap could be used as many times as desired to have a node listen to multiple topics in one subscribe... or can it already?

lucasw gravatar image lucasw  ( 2016-01-18 10:24:14 -0500 )edit

Well it kind of does. When I publish pointclouds from different sensors to that topic, it merges them, but it takes a while. I think there is an issue with that idea of multiple publishers, because subscriber just get some message and don't care where it came from.

l4ncelot gravatar image l4ncelot  ( 2016-01-18 10:47:54 -0500 )edit

When you launched octomap_mapping does it display some output ? Since, i just see it's running fine but nothing as output.

Eyshika gravatar image Eyshika  ( 2017-09-16 14:22:11 -0500 )edit

@Eyshika, in the launch file, you must modify the value of the "frame_id" (possibly to "odom") and the remap for "cloud_in" (usually to="/camera/depth/points") based on your active topics.

trunc8 gravatar image trunc8  ( 2020-10-28 23:19:40 -0500 )edit

2 Answers

Sort by ยป oldest newest most voted

answered 2016-01-18 10:28:35 -0500

lucasw gravatar image

The code is on , you ought to be able to put it and build it in your catkin work space and it will override octomap packages installed as binaries elsewhere.

edit flag offensive delete link more


Ah, I didn't know that buy building project in workspace does override other binaries. Thank you.

l4ncelot gravatar image l4ncelot  ( 2016-01-18 10:42:00 -0500 )edit

I haven't tried it the other way but it may only work like that if you source your personal catkin workspace after sourcing /opt/ros/.../setup.bash. Trying out roscd octomap_server will show which one has precedence.

lucasw gravatar image lucasw  ( 2016-01-18 10:58:57 -0500 )edit

But what happens when you source /otp/ros/../setup.bash and also your personal workspace? How does ROS determine which one to use?

l4ncelot gravatar image l4ncelot  ( 2016-01-18 11:05:19 -0500 )edit

The order determines it: source /opt/ros/jade/setup.bash; source ~/catkin_ws/devel/setup.bash - ought to have the devel space (the latter one) take precedence over the official jade versions (which went first).

lucasw gravatar image lucasw  ( 2016-01-18 11:35:32 -0500 )edit

So having multiple sources in .bashrc is redundant then?

l4ncelot gravatar image l4ncelot  ( 2016-01-18 11:46:41 -0500 )edit

No, the jade setup.bash gives me everything installed with apt-get, and my own workspace is for all of my projects or non-apt-gettable stuff I need from github. In the case where a same named package exists in both, the last one sourced is used... (I should test that though)

lucasw gravatar image lucasw  ( 2016-01-18 11:54:00 -0500 )edit

Now I can understand that. Thank you very much.

l4ncelot gravatar image l4ncelot  ( 2016-01-18 12:13:39 -0500 )edit

This is incorrect. Only the latest source counts. All sources before are irrelevant and completely replaced. The sourcing order at build time is the one that decides what overlays what. So, the first source is redundant. You could have the catkin_ws build with indigo and it would be on indigo.

dornhege gravatar image dornhege  ( 2016-01-19 06:32:51 -0500 )edit

answered 2016-01-18 10:31:34 -0500

dornhege gravatar image

You do get the source code. Just google for octomap, you should find the page + github repository. ROS currently uses octomap as a separate cmake package with only ROS wrapper packages, so it should be easy to extract this for your project.

For the multiple robots part, your idea is correct. Just give octomap correctly aligned point clouds and they should all be merged. For the topic remapping you'll probably need some kind of relay node. I don't think multiple remaps is possible.

edit flag offensive delete link more


About that relay node. Is there some kind of sync for publishers? e.g. when I want to publish data from 2 sensors into 1 topic and want them to publish messages one by one and not just everything at a time?

l4ncelot gravatar image l4ncelot  ( 2016-01-18 10:53:10 -0500 )edit

I don't understand what you mean, but any synchronization should happen from the time stamps in the message headers.

dornhege gravatar image dornhege  ( 2016-01-19 06:30:07 -0500 )edit

Question Tools

1 follower


Asked: 2016-01-18 06:07:26 -0500

Seen: 3,788 times

Last updated: Jan 18 '16