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

Trouble localising with RTAB-Map

asked 2019-03-05 04:27:44 -0500

Drkstr gravatar image

I have recorded a map using an Intel Realsense camera(D435i) and RTAB-maps. This is the command I am using to record the map

roslaunch rtabmap_ros rtabmap.launch

It seems to have worked fine, I can load up the saved database file into the rtabmap GUI tool and see the 3d map.

Now I would like to localize and navigate using the recorded db. For this, I modified the launch file I used above to the following:

Here are what I think are the relevant bits:

<arg name="stereo"          default="false"/>

<!-- Choose visualization -->
<arg name="rtabmapviz"              default="false" />
<arg name="rviz"                    default="true" />

<!-- Localization-only mode -->
<arg name="localization"            default="true"/>
<!-- RGB-D related topics -->
<arg name="rgb_topic"               default="/camera/color/image_raw" />
<arg name="depth_topic"             default="/camera/aligned_depth_to_color/image_raw" />
<arg name="camera_info_topic"       default="/camera/color/camera_info" />
<arg name="depth_camera_info_topic" default="$(arg camera_info_topic)" />

  <!-- Visualisation RTAB-Map -->
<node if="$(arg rtabmapviz)" pkg="rtabmap_ros" type="rtabmapviz" name="rtabmapviz" args="-d $(arg gui_cfg)" output="$(arg output)" launch-prefix="$(arg launch_prefix)">
  <param     if="$(arg stereo)" name="subscribe_depth"  type="bool" value="false"/>
  <param unless="$(arg stereo)" name="subscribe_depth"  type="bool" value="true"/>
  <param name="subscribe_rgbd"       type="bool"   value="$(arg subscribe_rgbd)"/>
  <param name="subscribe_stereo"     type="bool"   value="$(arg stereo)"/>
  <param name="subscribe_scan"       type="bool"   value="$(arg subscribe_scan)"/>
  <param name="subscribe_scan_cloud" type="bool"   value="$(arg subscribe_scan_cloud)"/>
  <param if="$(arg visual_odometry)" name="subscribe_odom_info" type="bool" value="true"/>
  <param if="$(arg icp_odometry)"    name="subscribe_odom_info" type="bool" value="true"/>
  <param name="frame_id"             type="string" value="$(arg frame_id)"/>
  <param name="odom_frame_id"        type="string" value="$(arg odom_frame_id)"/>
  <param name="wait_for_transform_duration" type="double"   value="$(arg wait_for_transform)"/>
  <param name="queue_size"           type="int"    value="$(arg queue_size)"/>
  <param name="approx_sync"          type="bool"   value="$(arg approx_sync)"/>

  <remap from="rgb/image"       to="$(arg rgb_topic_relay)"/>
  <remap from="depth/image"     to="$(arg depth_topic_relay)"/>
  <remap from="rgb/camera_info" to="$(arg camera_info_topic)"/>

  <remap     if="$(arg rgbd_sync)" from="rgbd_image" to="$(arg rgbd_topic)"/>
  <remap unless="$(arg rgbd_sync)" from="rgbd_image" to="$(arg rgbd_topic)_relay"/>

  <remap from="left/image_rect"        to="$(arg left_image_topic_relay)"/>
  <remap from="right/image_rect"       to="$(arg right_image_topic_relay)"/>
  <remap from="left/camera_info"       to="$(arg left_camera_info_topic)"/>
  <remap from="right/camera_info"      to="$(arg right_camera_info_topic)"/>

  <remap from="scan"                   to="$(arg scan_topic)"/>
  <remap from="scan_cloud"             to="$(arg scan_cloud_topic)"/>
  <remap from="odom"                   to="$(arg odom_topic)"/>

  <remap from="grid_map"               to="/map"/>

I know RTAB-maps in localization mode only publishes the map after it has localized, so I drove the rover around a bit... and then a little more .... and then the entire route that was mapped. It still hasn't localized or published anything onto the /map topic.

How would I go about debugging this?

Please note that I am new to ROS, so it is entirely possible that I have missed a step somewhere.

Let me know if you need any more info about my setup.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2019-03-05 11:07:00 -0500

matlabbe gravatar image

updated 2019-03-05 11:07:32 -0500

Did you try relaunching with:

$ roslaunch rtabmap_ros rtabmap.launch \
      localization:=true \
      depth_topic:=/camera/aligned_depth_to_color/image_raw \
      rgb_topic:=/camera/color/image_raw \

In rtabmapviz, you can do "Edit->Download clouds (update cache)" to get the map. You should not have to edit rtabmap.launch in most cases, just launch it with different parameters.

edit flag offensive delete link more


That worked perfectly, thanks :)

Drkstr gravatar image Drkstr  ( 2019-03-06 03:02:51 -0500 )edit

Now I just need to send it a goal and get it to move to the goal. Any suggestions?

Drkstr gravatar image Drkstr  ( 2019-03-06 03:03:32 -0500 )edit

see move_base with this overview, and this tutorial for an example with rtabmap integration.

matlabbe gravatar image matlabbe  ( 2019-03-06 08:21:56 -0500 )edit

Hey man, ive got a follow-up question for you:

Drkstr gravatar image Drkstr  ( 2019-03-11 06:43:21 -0500 )edit

Question Tools

1 follower


Asked: 2019-03-05 04:27:44 -0500

Seen: 332 times

Last updated: Mar 05 '19