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

octomap server rviz mapping

asked 2011-12-12 17:40:12 -0600

acp gravatar image

updated 2011-12-12 23:18:05 -0600

AHornung gravatar image

Hi Everybody

The launch file in octomap_server just listens to a incoming PointCloud2 data and incrementally builds an octomap.

Well, I want to test it, for that I have made a node that transform laser scans to pointcloud2 and then it publishes the topic cl. hokuyo_listener_cu.cpp and a tf broadcaster tf_broadcaster.cpp, respectively.

I launch rviz and I add PointCloud2 with topic cl and it can visualize the map of the laser scan.

well; I now want to use octomap in ros to visualize the voxels from the laser coordinates. I got the source code over a SVN. I have use rosdep and rosmake to install octomap_mapping and octomap_visualization.

Then, I remap the line in the launch file remap from="cloud_in" to="cl" />

Then, I launch, roslaunch octomap_server octomap_mapping.launch

Then I open Rviz and I add a MarkerArray with topic /occupied_cells_vis_array. But I can not see anything in Rviz.

I run rxgraph and I can see that the octomap_server node can listen to the /cl topic and can broadcast /occupied_cells_vis array.

Why rviz can not visualize anything when I use octomap server?

In advance thank you

edit retag flag offensive close merge delete


Hello, Is this issue sorted? I am not being able to take a look at your .cpp files. Can you please repost them?

mazikeen gravatar image mazikeen  ( 2018-12-17 03:15:52 -0600 )edit

2 Answers

Sort by ยป oldest newest most voted

answered 2011-12-12 23:17:26 -0600

AHornung gravatar image

The visualization topic needs to be "occupied_cells_vis" without the "_array" at the end. This is a problem with rviz, it automatically adds _array to MarkerArray topics. If that is the problem, the topic should turn red as error in RViz.

Another problem could be the frame_id. octomap_server needs a fixed (map) frame id and a tf transform of the input PointCloud2 into this frame. It uses a tf message filter to wait for this transform. Check the parameter "frame_id" in the octomap_mapping launch file and make sure that RViz is also set to this fixed frame.

Finally, to debug further, start rxconsole and set the log levels of octomap_server to "Debug". It should tell you what it's doing there.

edit flag offensive delete link more


Hi Ahornung, In advance thank you for your help, I really appreciate it. I tried the tool "rostopic echo /cl" and I can see there is data publish on the topic "/cl", however when I try "echo /occupied_cells_vis_array", I can not see any data publish on that topic. In the other hand, "rosmsg show visualization_msgs/MarkerArray" shows the details of the message. The launch file shows "param name="frame_id" type="string" value="/base_footprint" />", whereas in rviz I have "Fixed frame = /laser" and "Target frame= /bl". There are no more frames to choose. How can I be sure that rviz is set to the same frame? The visualization topic in "rviz is /occupied_cells_vis_array" and does not turning red. I think that the problem is that the \octomap_server node is not publishing any data to rviz even though the topic /occupied_cells_vis_array exists with message visualization_msgs/MarkerArray. Does all of this tell you ...(more)
acp gravatar image acp  ( 2011-12-13 21:10:07 -0600 )edit
octomap_server is not publishing because it does not integrate scans. It is waiting for a transform to the fixed frame which you set to "base_footprint". See the last 2 paragraphs of my reply. You could set that param to "laser" if you have no tf publishing running.
AHornung gravatar image AHornung  ( 2011-12-13 21:20:32 -0600 )edit
But note that it's a little pointless to integrate scans in the local laser frame. You need some sort of scan registration (SLAM, scan matching) running or at least odometry.
AHornung gravatar image AHornung  ( 2011-12-13 21:21:23 -0600 )edit
Well, I just broadcast a tf transform from the /laser frame to the /base_footprint and rviz can visualize the laser voxels. But, the questions here are: 1.-Where the /base_footprint frame is situated with respect to the /laser frame? 2.-How can dynamically build a 2D map of the environment using octomap-ros
acp gravatar image acp  ( 2011-12-13 21:37:48 -0600 )edit
For building a 2D map octomap is not the right tool, you should look at gmapping instead:
AHornung gravatar image AHornung  ( 2011-12-16 06:52:23 -0600 )edit
Hi AHornung, well I want to fuse 2D laser scans with 3D depth vision under octomap-ros and visualize the process dynamically either rviz or octavis, cheers :)
acp gravatar image acp  ( 2011-12-18 19:07:36 -0600 )edit

answered 2011-12-12 19:57:59 -0600

updated 2011-12-13 07:32:20 -0600

[Edit: I retract my previous statement based on the new information in your post].

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2011-12-12 17:40:12 -0600

Seen: 7,779 times

Last updated: Dec 13 '11