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

simple question about rtabmap

asked 2019-11-01 09:36:19 -0500

june2473 gravatar image

updated 2019-11-04 03:44:06 -0500


I am just simple guy, I have robot and want my robot avoiding obstacles.

I dont have much furniture in my room, but certainly I want that my robot could avoid tables with thin legs.

I want to use some camera because lidar does not help in this case.

I have jetson tx2, turtlebot3 waffle, lidar, and d435 camera.

I am trying to use rtabmap to project such tables on 2d occupancy grid.

And rtabmap does not project obstacles at all. There is nothing from camera on 2d occupancy grid.

image description

As I understand rtabmap should project obstacles onto 2d map, right? Maybe, I dont understand something about using rtabmap.

MaxObstacleHeight is set to 1.7 meters. I tried to set Grid/MapFrameProjection to true, still does not help.

<param name="RGBD/NeighborLinkRefining" type="string" value="true"/>
<param name="RGBD/ProximityBySpace" type="string" value="true"/>
<param name="RGBD/OptimizeFromGraphEnd" type="string" value="false"/>
<param name="RGBD/AngularUpdate" type="string" value="0.05"/>
<param name="RGBD/LinearUpdate" type="string" value="0.05"/>
<param name="Optimizer/Slam2D" type="string" value="true"/>
<param name="Reg/Force3DoF" type="string" value="true"/>
<param name="Reg/Strategy" type="string" value="1"/> <!— 1=ICP —>
<param name="Vis/MinInliers" type="string" value="5"/>
<param name="Vis/InlierDistance" type="string" value="0.1"/>
<param name="Kp/MaxDepth" type="string" value="1.75"/>
<param name="Vis/MaxDepth" type="string" value="1.75"/>
<param name="Rtabmap/TimeThr" type="string" value="700"/>
<param name="Rtabmap/DetectionRate" type="string" value="$(arg rate)" />
<param name="Mem/RehearsalSimilarity" type="string" value="0.45"/>
<param name="Grid/MaxObstacleHeight" type="string" value="1.7" />
<param name="Grid/NoiseFilteringRadius" type="string" value="0.05"/>
<param name="Grid/NoiseFilteringMinNeighbors" type="string" value="5"/>

what can I do to make my robot avoiding obstacles? why there is no obstacles on 2d map? Are they supposed to be projected?

edit retag flag offensive close merge delete


If the turtlebot has a lidar, the map may be created from laser scans. In your case, you want the map to be created from the camera. Set explictiy Grid/FromDepth to true. See @FailFTW answer for more info and optimized segmentation approach if we are moving in 2D.

matlabbe gravatar image matlabbe  ( 2019-11-03 15:48:23 -0500 )edit

Thanks for your support!

I left comment down to @FailFTW answer.

Grid/FromDepth parameter has really changed my 2d map as I want, but 2d map is very teared into pieces.

which parameters can I change to make 2d map more continuous?

You can answer down to @FailFTW answer.

june2473 gravatar image june2473  ( 2019-11-04 07:36:21 -0500 )edit

2 Answers

Sort by » oldest newest most voted

answered 2019-11-17 22:10:50 -0500

june2473 gravatar image

updated 2019-11-17 22:11:37 -0500

setting Grid/NoiseFilteringRadius = 0 helped

edit flag offensive delete link more

answered 2019-11-01 16:28:51 -0500

FailFTW gravatar image

updated 2021-08-09 10:48:05 -0500

matlabbe gravatar image

Found this thread: http://official-rtab-map-forum.206.s1...

Try these settings I tested them in my sim. RTABMap should be publishing to "/rtabmap/proj_map":

<param name="Grid/FromDepth"             type="bool" value="true"/>
<param name="Grid/MaxGroundHeight"       type="string" value="0.2"/>
<param name="Grid/MaxObstacleHeight"     type="string" value="2"/>
<param name="Grid/NormalsSegmentation"   type="string" value="false"/>

Here's a the relevant part of my launch file for reference:

<rosparam command="load" file="$(find frc_robot)/config/slam.yaml"/>

<group ns="rtabmap">
<node pkg="nodelet" type="nodelet" name="rgbd_sync" args="standalone rtabmap_ros/rgbd_sync" output="screen">
  <remap from="rgb/image"       to="/$(arg camera_frame)/rgb/image_raw"/>
  <remap from="depth/image"     to="/$(arg camera_frame)/depth/image_raw"/>
  <remap from="rgb/camera_info" to="/$(arg camera_frame)/rgb/camera_info"/>
  <remap from="rgbd_image"      to="rgbd_image"/> <!-- Output -->

<!-- SLAM -->
<node name="rtabmap" pkg="rtabmap_ros" type="rtabmap" output="screen" args="--delete_db_on_start">
  <remap from="scan" to="/scan"/>

Ignore these params below. I'm using Hector_Slam for localization.
  <param name="odom_frame_id"            type="string" value="map"/>
  <param name="odom_tf_linear_variance"  type="double" value="0.0005"/>
  <param name="odom_tf_angular_variance"    type="double" value="0.0005"/>


And my YAML file:

    frame_id: base_link
    map_frame_id: map
    odom_frame_id: odom

    subscribe_depth: false
    subscribe_rgb: false
    subscribe_rgbd: true
    subscribe_scan: true

    publish_tf: false

    Reg/Strategy: 2
    Reg/Force3DoF: true
    RGBD/ProximityBySpace: false

    RGBD/ProximityPathMaxNeighbors: 10
    Grid/Scan2dUnknownSpaceFilled: true

    Grid/FromDepth: true
    Grid/MaxGroundHeight: 0.2
    Grid/MaxObstacleHeight: 2.0
    Grid/NormalsSegmentation: false
edit flag offensive delete link more


Thanks for your reply! I really appreciate your help!

I set Grid/FromDepth parameter to true and it fully changed 2d map.

table become projected onto the floor but 2d map is very teared into pieces.

here is screenshot:

so, I suppose path planning is impossible with this map.

which parameters can I change to make 2d map more continuous?

And also, what is the difference between subscribe_depth and subscribe_rgbd? What does rgbd_sync exactly do? I have d435, should I use rgbd_sync?

june2473 gravatar image june2473  ( 2019-11-04 07:31:36 -0500 )edit

You can combine Grid/FromDepth=true, Grid/3D=false, Grid/RayTracing=true to fill empty space. subscribe_depth is the legacy approach kept for backward compatibility, as subscribe_rgbd is now the new recommended approach with rgbd_sync when we subscribe to a lidar at the same time. So if you are subscribing only the camera, subscribe_depth is fine. If you input also the lidar, use rgbd_sync. Examples on this page have been all updated with rgbd_sync.

matlabbe gravatar image matlabbe  ( 2019-11-04 07:59:00 -0500 )edit

I have tried both,

  1. with Grid/FromDepth=true, Grid/3D=false, Grid/RayTracing=true.
  2. and also with using rgbd_sync

in first case, 2d map is quite smooth, but obstacles is not enough projected, chair's legs is projected, chair's seat is not projected, table is somehow projected, but not good enough.

in second case, nothing is projected, its like map is build only with lidar.

I tried to set subscribe_scan to false, and Grid/RayTracing to true here, and its better, but table is not good enough again.

What can you recommend to project table as black rectangle on 2d map?

What do you think about using pointcloud_to_laserscan? Will it help?

june2473 gravatar image june2473  ( 2019-11-05 04:27:05 -0500 )edit

Setting Grid/3D=false is a simple way to get ray tracing at low cost, but it may clear obstacle if the camera goes under the table for example. To keep everything while tracing empty space, set Grid/3D=true for higher computation cost. See Figures 14-16 and Table 10 of this paper for a comparison of these parameters.

matlabbe gravatar image matlabbe  ( 2019-11-05 22:21:21 -0500 )edit

I have noticed that Grid/3D=false is better for projecting table.

I set Grid/MaxObstacleHeight=2.0, and why table is still not well projected?

june2473 gravatar image june2473  ( 2019-11-06 06:42:05 -0500 )edit

Do you have a database to share? Do you use Grid/NormalsSegmentation=false like in this answer?

matlabbe gravatar image matlabbe  ( 2019-11-06 09:08:15 -0500 )edit

I was running demo_bag.launch from this package, Full version (1.2GB) bag file.

There, I was changing parameters in rtabmap.launch file.

As I remember, in previous comments I was testing with Grid/NormalsSegmentation=false, then I changed it to true and table with approximately 1 meter height was still not well projected.

here is this launch file:

Then I applied this launch file to my real robot where d435 camera is located on the mast at 1 meter from the ground.

And I think I've got almost good projection. Here is some video: and launch file:

I dont have database of my real room yet.

I think I am gonna try placing camera upper and looking towards the floor.

june2473 gravatar image june2473  ( 2019-11-06 22:53:02 -0500 )edit

In the launch file, remove Grid/NoiseFilteringRadius parameter or set it to zero (disabled). You will get a lot more obstacles.

matlabbe gravatar image matlabbe  ( 2019-11-07 13:19:12 -0500 )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-11-01 09:36:19 -0500

Seen: 896 times

Last updated: Aug 09 '21