• Diff for "rtabmap_ros/Tutorials/HandHeldMapping"
Differences between revisions 25 and 26
Revision 25 as of 2015-08-25 21:29:35
Size: 5822
Editor: MathieuLabbe
Comment:
Revision 26 as of 2015-08-25 21:30:10
Size: 5825
Editor: MathieuLabbe
Comment:
Deletions are marked like this. Additions are marked like this.
Line 65: Line 65:
The launch prefix "--delete_db_on_start" is used to start mapping from a clean database. You can also reset the memory from rtabmapviz using the action "Edit->Delete memory", or by using this service : The rtabmap argument "--delete_db_on_start" is used to start mapping from a clean database. You can also reset the memory from rtabmapviz using the action "Edit->Delete memory", or by using this service :

(!) Please ask about problems and questions regarding this tutorial on answers.ros.org. Don't forget to include in your question the link to this page, the versions of your OS & ROS, and also add appropriate tags.

RGB-D Handheld Mapping

Description: This tutorial shows how to use rtabmap_ros out-of-the-box with a Kinect-like sensor in mapping mode or localization mode.

Tutorial Level: BEGINNER

Next Tutorial: Stereo Handheld Mapping

RGB and depth sensors

The RGB-D sensors which are OpenNI and OpenNI2 compliant would work out-of-the-box using openni_launch, openni2_launch, freenect_launch or iai_kinect2 packages. Sensors tested:

  • Kinect for Xbox 360

    • $ roslaunch openni_launch openni.launch depth_registration:=true
      or
      $ roslaunch freenect_launch freenect.launch depth_registration:=true
  • XtionPRO Live

    • $ roslaunch openni2_launch openni2.launch depth_registration:=true
  • Kinect v2 (Xbox One)

    • $ roslaunch kinect2_bridge kinect2_bridge.launch publish_tf:=true
    • Note: use rgbd_mapping_kinect2.launch instead of "rgbd_mapping.launch" below.

Mapping mode

There are two choices for online visualization: rtabmapviz or rviz. With the RVIZ plugin rtabmap/MapCloud, the clouds can be incrementally added to RVIZ. However using rtabmapviz, the interface should look like the tutorials of the standalone version.

  • Launch (rtabmapviz): rgbd_mapping.launch

     $ roslaunch rtabmap_ros rgbd_mapping.launch rtabmap_args:="--delete_db_on_start"
  • Launch (rviz):
     $ roslaunch rtabmap_ros rgbd_mapping.launch rtabmap_args:="--delete_db_on_start" rviz:=true rtabmapviz:=false
  • Launch (with kinect2_bridge):
     $ rosrun tf static_transform_publisher 0 0 0 -1.5707963267948966 0 -1.5707963267948966 camera_link kinect2_link 100
     $ roslaunch rtabmap_ros rgbd_mapping.launch rtabmap_args:="--delete_db_on_start" rgb_topic:=/kinect2/qhd/image_color_rect depth_registered_topic:=/kinect2/qhd/image_depth_rect camera_info_topic:=/kinect2/qhd/camera_info
    or
     $ roslaunch rtabmap_ros rgbd_mapping_kinect2.launch

The rtabmap argument "--delete_db_on_start" is used to start mapping from a clean database. You can also reset the memory from rtabmapviz using the action "Edit->Delete memory", or by using this service :

  •  $ rosservice call /rtabmap/reset

You should see something like this:

RGB-D Mapping

  • If the background of the map turns RED, it is because the odometry is lost. Visit this page under Lost Odometry (RED screens!) section to know why this happens! To track again the odometry, replace the camera to the last position before the RED appeared and it should be able to recompute the odometry. Another way is to reset the odometry using the menu option "Edit->Reset odometry" (note that a new map is created each time the odometry is reset).

Where is the map saved?

~/.ros/rtabmap.db

RTAB-Map provides a tool to browse data in the database:

$ rtabmap-databaseViewer ~/.ros/rtabmap.db

Localization mode

In localization mode, a map large enough (>30 locations) must be already created (using rgbd_mapping.launch above).

In rtabmapviz (GUI), click on "Localization" in the "Detection" menu. By looking over locations in the map, RTAB-Map would localize itself in it by finding a loop closure. Once a loop closure is found, the odometry is corrected and the current cloud will be aligned to the map.

You can play with the relocation behaviour by resetting the odometry. You can use form the GUI the Detection->"Reset odometry" action or call the service on the terminal like:

  • $ rosservice call /rtabmap/reset_odom

Advanced

You can also start the launch file above directly in Localization mode with a previously built database. Set the parameter "Mem/IncrementalMemory" to "false". Also, when starting the rtabmap node, the argument "--delete_db_on_start" must not be set!

  • <node name="rtabmap" pkg="rtabmap_ros" type="rtabmap" output="screen" args="">
       ...
       <param name="Mem/IncrementalMemory" type="string" value="false"/>
    </node>

In the GUI, do Edit->"Download map" to download the map from the rtabmap node. At the start, you should see that the current displayed cloud is not aligned to the map, it is normal because the odometry is reset on each start. By looking over locations in the map, RTAB-Map would localize itself in it by finding a loop closure. Once a loop closure is found, the odometry is corrected and the map will appear with the current cloud aligned to it.

Wiki: rtabmap_ros/Tutorials/HandHeldMapping (last edited 2023-04-19 04:36:21 by MathieuLabbe)