Rosanswers logo


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?

Originally posted by june2473 on ROS Answers with karma: 83 on 2019-11-01

Post score: 0

Original comments

Comment by matlabbe on 2019-11-03:
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.

Comment by june2473 on 2019-11-04:
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.


2 Answers 2


Rosanswers logo

Found this thread: http://official-rtab-map-forum.206.s1.nabble.com/Proj-map-min-obstacles-height-td2866.html

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

Originally posted by FailFTW with karma: 21 on 2019-11-01

This answer was NOT ACCEPTED on the original site

Post score: 1

Original comments

Comment by june2473 on 2019-11-04:
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?

Comment by matlabbe on 2019-11-04:
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.

Comment by june2473 on 2019-11-05:
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?

Comment by matlabbe on 2019-11-05:
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.

Comment by june2473 on 2019-11-06:
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?

Comment by matlabbe on 2019-11-06:
Do you have a database to share? Do you use Grid/NormalsSegmentation=false like in this answer?

Comment by june2473 on 2019-11-06:
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: https://pastebin.com/FL4rbgPV

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: https://yadi.sk/i/8TIEWqrn94ghWw and launch file: https://pastebin.com/JmHwjJYU

I dont have database of my real room yet.

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

Comment by matlabbe on 2019-11-07:
In the launch file, remove Grid/NoiseFilteringRadius parameter or set it to zero (disabled). You will get a lot more obstacles.

Comment by june2473 on 2019-11-12:
thanks! thats good to know!

I changed it and 2d map totally has changed.

do you also have something like detailed handbook with no need to ask you containing all such kind of information about these parameters?

Comment by matlabbe on 2019-11-16:
There is no handbook, the only documentation about parameters is when doing $ rtabmap --params or looking at the Preferences menu in rtabmap standalone (you can mouse over parameters to see a label telling what is the parameter name on ROS). Other documentation can be found on rtabmap_ros and its tutorials.


Rosanswers logo

setting Grid/NoiseFilteringRadius = 0 helped

Originally posted by june2473 with karma: 83 on 2019-11-17

This answer was ACCEPTED on the original site

Post score: 0


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.