Ask Your Question

How does rtabmap handle free space in an octomap?

asked 2019-10-01 13:42:19 -0600

cad gravatar image


I am using the octomaps generated from rtabmap. Ideally in our application we would like all of the unknown space to be marked as free. It seems like the octomaps generated by rtabmap only include the obstacles and ground. Is it possible to mark unknown space to be free? I see the parameter "grid_unknown_space" but that sounds like it is only for the grid_maps. It also sounds like there is some ability for ray tracing but is that only possible when using a laser scanner or 2D map? Ideally, we need a octomap_msgs/Octomap that's 3D (or 2D) with free space marked as unknown generated by a depth camera (such as the realsense D435i).

Thank you!

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2019-10-01 14:34:29 -0600

matlabbe gravatar image

updated 2019-10-01 14:34:52 -0600

When Grid/RayTracing is enabled, the free space will be tracked in the OctoMap.

Example with robot mapping demo:

$ roslaunch rtabmap_ros demo_robot_mapping.launch rviz:=true

In rtabmapviz, open Preferences->Local Occupancy Grid, then check "From Depth" (Grid/FromDepth) and "Ray Tracing" (Grid/RayTracing). Start the demo bag:

rosbag play --clock demo_mapping.bag

Obstacles: image description

Empty space: image description


edit flag offensive delete link more


Thank you for your response! I tried replicating what you expressed running the demo_robot_mapping launch file, changing the parameters, and then running the bag. I can see in the 2D map that ray tracing is working, but when I try to view the free voxels in rviz nothing shows up. I can however view the occupied voxels and when I select "All Voxels" it is the same as "Occupied Voxels". Any idea what I might be missing?

cad gravatar image cad  ( 2019-10-01 17:51:56 -0600 )edit

Which ROS and rtabmap version are you using?

matlabbe gravatar image matlabbe  ( 2019-10-01 18:33:25 -0600 )edit

ROS Kinetic and Rtabmap 0.19.4. It turns out that even though I cannot visualize the free voxels in RVIZ they are there and the ray tracing is working! Thank you for your help! I exported the octomap and visualized it in octovis and can see the free voxels there. Any ideas why I wouldn't be able to see that in RVIZ? I also have a problem with RVIZ where there are vertical stripes through the 2D map. They are evenly spaced in sets of 8-9 in clusters across the map with the majority of the map being fine.

cad gravatar image cad  ( 2019-10-01 18:52:01 -0600 )edit

Build the octomap_rviz_plugins package from source, you will be able to see the free space in rviz. Not sure why we cannot show the colors anymore though, I'll take a look. For the stripes, it is because sometimes the center of the voxels in OctoMap don't match the center of the cells in the 2D grid when we assemble the local occupancy grids into the global one, like more on the edge of the cells, so depending on the floating precision, the points may fall on one or the other side of the edge, creating empty lines.

matlabbe gravatar image matlabbe  ( 2019-10-01 20:31:48 -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

1 follower


Asked: 2019-10-01 13:42:19 -0600

Seen: 603 times

Last updated: Oct 01 '19