Rosanswers logo

Hello! I am looking at some amazing rtabmap mappings such as



and my mapping does not look good at all, I dont know why exactly, distance for mapping is too big or odometry is not enough good, there is a lot of shifts and inexactitudes.

here it is: https://yadi.sk/i/89HN-ixWRIJvvw (if there is no play button, try to reload page)

I am using only two cameras, d435 and t265 firmly attached to each other, and walking indoor with laptop in one hand and those cameras in other hand.

Can anyone take a glance on my rtabmap parameters and tell me what is definitely incorrect there?

  <arg name="use_zed"         default="false"  doc="Set to false when using Intel Realsense D435"/>
  <arg name="localization"    default="false" doc="Localization mode for navigation"/>
  <arg name="database_path"   default="rtabmap.db"/>
  <arg name="rviz"            default="false"/>
  <arg name="rate"            default="1.0"/>
  <arg name="camera_frame"    default="d400"/>
  <arg     if="$(arg localization)" name="rtabmap_args"  default=""/>
  <arg unless="$(arg localization)" name="rtabmap_args"  default="--delete_db_on_start"/>
  <arg     if="$(arg localization)" name="rviz_config"   default="$(find turtlebot3_slam_3d)/config/navigation.rviz"/>
  <arg unless="$(arg localization)" name="rviz_config"   default="$(find turtlebot3_slam_3d)/config/mapping.rviz"/>
  <arg name="input_scan"       default="/scan"/>
  <arg name="input_odom"       default="/t265/odom/sample"/>
  <arg     if="$(arg use_zed)" name="input_image"        default="/stereo_camera/left/image_rect_color"/>
  <arg unless="$(arg use_zed)" name="input_image"        default="/d400/color/image_raw"/>
  <arg     if="$(arg use_zed)" name="input_depth"        default="/stereo_camera/depth/depth_registered"/>
  <arg unless="$(arg use_zed)" name="input_depth"        default="/d400/aligned_depth_to_color/image_raw"/>
  <arg     if="$(arg use_zed)" name="input_camera_info"  default="/stereo_camera/left/camera_info"/>
  <arg unless="$(arg use_zed)" name="input_camera_info"  default="/d400/color/camera_info"/>
 <!-- RTAB=Map node -->
  <group ns="rtabmap">
    <node pkg="nodelet" type="nodelet" name="rgbd_sync" args="standalone rtabmap_ros/rgbd_sync" output="screen">
      <remap from="rgb/image"       to="/d400/color/image_raw"/>
      <remap from="depth/image"     to="/d400/aligned_depth_to_color/image_raw"/>
      <remap from="rgb/camera_info" to="/d400/color/camera_info"/>
      <remap from="rgbd_image"      to="rgbd_image"/> <!-- output -->
      <!-- Should be true for not synchronized camera topics
          (e.g., false for kinectv2, zed, realsense, true for xtion, kinect360)-->
      <param name="approx_sync"       value="false"/>
    <node name="rtabmap" pkg="rtabmap_ros" type="rtabmap" output="screen" args="$(arg rtabmap_args)">
      <param name="database_path"       type="string" value="$(arg database_path)"/>
      <param name="frame_id"            type="string" value="t265_pose_frame"/>
      <param name="subscribe_depth"     type="bool"   value="false"/>
      <param name="subscribe_rgbd"      type="bool"   value="true"/>
      <param name="subscribe_scan"      type="bool"   value="false"/>
      <!-- Input topics -->
      <remap from="scan"                to="$(arg input_scan)"/>
      <remap from="odom"                to="$(arg input_odom)"/>
      <remap from="rgb/image"           to="$(arg input_image)"/>
      <remap from="depth/image"         to="$(arg input_depth)"/>
      <remap from="rgb/camera_info"     to="$(arg input_camera_info)"/>
      <remap from="rgbd_image"          to="rgbd_image"/>
      <!-- Output topics -->
      <remap from="grid_map" to="/map"/>
      <param name="queue_size" type="int" value="100"/>
      <!-- RTAB-Map's parameters -->
      <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="0"/> <!-- 1=ICP -->
      <param name="Vis/MinInliers"            type="string" value="20"/>
      <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="0"/>
      <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="2" />
      <param name="Grid/NoiseFilteringRadius" type="string" value="0.0"/>
      <param name="Grid/NoiseFilteringMinNeighbors" type="string" value="5.0"/>
      <param name="Grid/FromDepth"            type="bool" value="true" />
      <!--param name="Grid/DepthDecimation"      type="string" value="10"/-->
      <param name="Grid/3D"                   type="bool" value="true" />
      <param name="Grid/RayTracing"           type="bool" value="true" />
      <param name="Grid/NormalsSegmentation"  type="string" value="true" />
      <param name="Grid/MaxGroundHeight"      type="string" value="0.03" />
      <param name="Grid/RangeMax"             type="string" value="5.0" />
      <param name="Grid/FlatObstacleDetected" type="bool" value="true"/>
      <param name="Icp/VoxelSize"             type="string" value="0.05"/>
      <param name="Icp/MaxCorrespondenceDistance"            type="string" value="0.1"/>
      <!-- Localization mode -->
      <param     if="$(arg localization)" name="Mem/IncrementalMemory" type="string" value="false"/>
      <param unless="$(arg localization)" name="Mem/IncrementalMemory" type="string" value="true"/>
      <param name="Mem/InitWMWithAllNodes" type="string" value="$(arg localization)"/>
    <!-- RVIZ node -->
    <node if="$(arg rviz)" pkg="rviz" type="rviz" name="rviz" args="-d $(arg rviz_config)" />
    <node pkg="tf" type="static_transform_publisher" name="t265odom_to_map" args="0 0 0 0 0 0 /t265_odom_frame /map 100"/>



I have changed frame_id from t265_pose_frame to t265_link, and t265_odom_link stopped shifting.

I have made new test with long run of big room: https://yadi.sk/i/w9Ci5sri45WPFA

There is big problem with loop closure. I dont know what is wrong. t265 camera or rtabmap parameters. What do you think, why is this happening?

Originally posted by june2473 on ROS Answers with karma: 83 on 2020-01-14

Post score: 0

Original comments

Comment by matlabbe on 2020-01-14:
The D400 depth is not very accurate farther than 3-4 meters, I would set a maximum depth in MapCloud plugin in RVIZ. Why t265odom_to_map is used? Can you show the TF tree (rosrun tf view_frames)?

Comment by june2473 on 2020-01-14:
I have set maximum depth in RVIZ to 2 meters. How can I configure rtabmap to not build the map far than 2 meters?

Comment by june2473 on 2020-01-14:
t265 was because I forgot to set frame_id at first. Now I have removed that line and frames pdf is here.

Nothing actually changed, mapping in rviz does look well.

Comment by june2473 on 2020-01-15:
I changed frame_id from t265_pose_frame to t265_link.

And I have made new test with long run of big room: https://yadi.sk/i/w9Ci5sri45WPFA

What do you think, what is wrong in my configuration? and what can I do to improve mapping?

Comment by matlabbe on 2020-01-15:
Can you share that database, it would be useful to debug where the drift is coming from (T265? or loop closures). What is the fixed transform between T265 and D435? To limit the range of the occupancy grid, set Grid/RangeMax to 2.

Comment by june2473 on 2020-01-16:
you mean rtabmap.db file? I have it. I dont have bag file of that video because I haven't recorded it. I can make new passage and record bag file.

Comment by june2473 on 2020-01-16:
fixed transform between t265 and d435 is:

<node pkg="tf" type="static_transform_publisher" name="t265_to_d400" args="0 0 0 0 0 0 /$(arg tf_prefix_camera1)_link /$(arg tf_prefix_camera2)_link 100"/>

it's from rs_d400_and_t265.launch file

Comment by june2473 on 2020-01-17:
I have made new test! it looks far more better than previous.


what do you think?

Comment by june2473 on 2020-01-17:
I think the problem is in the t265 odometry


1 Answer 1


Rosanswers logo

From the database you shared in the comments, try this:

Kp/MaxDepth=0                   # Should be 0 in general
Vis/MaxDepth=0                  # Should be 0 in general
RGBD/NeighborLinkRefining=false # Don't refine T265 odometry, it should be already accurate
Optimizer/GravitySigma=0.1      #  Force graph optimization with gravity constraints
Mem/UseOdomGravity=true         # Get gravity constraints from odometry (assuming VIO from T265)

Example reprocessing the database with those parameters:

$ rtabmap-reprocess --Kp/MaxDepth 0 --Vis/MaxDepth 0 --RGBD/NeighborLinkRefining false --Optimizer/GravitySigma 0.1 --Mem/UseOdomGravity true rtabmap.db output.db

Also, it is better to disable relocalisation feature of T265 if possible when using rtabmap. This issue is explained here.

You should also adjust the transform between the cameras based on your setup (for better loop closure optimizations):

<node pkg="tf" type="static_transform_publisher" name="t265_to_d400" args="0 0 0 0 0 0 /$(arg tf_prefix_camera1)_link /$(arg tf_prefix_camera2)_link 100"/>


Originally posted by matlabbe with karma: 6409 on 2020-01-17

This answer was ACCEPTED on the original site

Post score: 1

Original comments

Comment by june2473 on 2020-01-20:
Thank you!

Here is what I got: https://yadi.sk/d/H9N_5g8f5TMYFg

Comment by matlabbe on 2020-01-20:
Most of the drift seems caused by visual odometry. rtabmap seems correcting large loops, but if the camera drifted locally over some meters, that won't be fixed. Here is a video showing some results that I would expect from a T265+D435 setup: https://www.youtube.com/watch?v=iHQOpPuVcys

Comment by june2473 on 2020-01-21:
you mean, I ought to move t265 better, trying not to drift t265 odometry?

Can you suggest recommended movements of t265, which won't cause such drifts?

Comment by matlabbe on 2020-01-31:
In general, avoid pure rotation, always translate a little at the same time. Also avoid looking at moving objects taking most of the field of view of the camera. Avoid looking straight toward a textureless surface or move far from them to track features around it.


Your Answer

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