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

Rtab-Map ICP + visual loop closing

asked 2020-06-22 07:10:43 -0600

Chris91 gravatar image

updated 2020-06-22 11:41:26 -0600


i used rtabmap in Reg/Strategy 0 so far with my kinect camera. I wanted to try to fake a laserscan to use rtabmap with ICP and visual loop closing. For some reason when i start the application it's says there is no laserscan data. But the laserscan data is published under the topic /cloud as a 3D laserscan. I checked that topic using rviz and rostopic.


<arg name="model" default="$(env TURTLEBOT3_MODEL)" doc="model type [burger, waffle, waffle_pi]"/>
<arg name="open_rviz" default="true"/>
<arg name="rtabmapviz" default="true"/>
<arg name="move_forward_only" default="false"/>

<arg name="with_camera" default="true"/>
<arg name="localization" default="false"/>
<arg name="database_path" default="~/.ros/rtabmap.db"/>
<arg     if="$(arg localization)" name="rtabmap_args" default="--uinfo"/>
<arg unless="$(arg localization)" name="rtabmap_args" default="-d"/>

<include file="$(find turtlebot3_bringup)/launch/turtlebot3_remote.launch">
<arg name="model" value="$(arg model)" />

<node pkg="nodelet" type="nodelet" name="rgbd_relay" args="standalone rtabmap_ros/rgbd_relay" output="screen">
<remap from="/rtabmap/rgbd_image"      to="/rgbd_image"/>
<remap from="/rtabmap/rgbd_image_relay"      to="/rgbd_image_relay"/>

<group ns="rtabmap">

<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="base_footprint"/>

<param name="subscribe_depth" type="bool" value="false"/>
<param name="subscribe_rgb" type="bool" value="false"/>
<param name="subscribe_rgbd" type="bool" value="true"/>
<param name="subscribe_scan_cloud" type="bool" value="true"/>
<param name="map_frame_id" type="string" value="map"/>
<param name="Grid/FromDepth" type="string" value="true"/>
<param name="approx_sync"    type="bool" value="true"/>
<param name="publish_tf" type="bool" value="true"/>
<param name="tf_delay" type="double" value="0.05"/>
<param name="rgbd_cameras" type="int" value="1"/>
<param name="wait_for_transform_duration" type="double" value="0.1"/>

<!-- use actionlib to send goals to move_base --> 
<param name="use_action_for_goal" type="bool" value="true"/>
<remap from="move_base"            to="/move_base"/>
<remap from="odom"            to="/odom"/>
<remap from="rgbd_image"      to="/rgbd_image_relay"/>
<remap from="rgb/camera_info" to="/camera/rgb/camera_info"/>
<remap from="scan_cloud"      to="/cloud"/>
<remap from="grid_map" to="/map"/>

<!-- RTAB-Map's Paramter -->
<param name="Reg/Strategy"                 type="string" value="2"/>
<param name="Reg/Force3DoF"                type="string" value="true"/>
<param name="GridGlobal/MinSize"           type="string" value="20"/>   
<param name="Grid/MaxObstacleHeight"       type="string" value="0.5"/>
<param name="Grid/MaxGroundHeight"         type="string" value="0.1"/> 
<param name="Grid/MinGroundHeight"         type="string" value="-0.05"/>
<param name="Icp/VoxelSize"                type="string" value="0.02"/>
<!-- localization mode -->
<param     if="$(arg localization)" name="Mem/IncrementalMemory" type="string" value="false"/>
<param unless="$(arg localization)" name="Mem/IncrementalMemory" type="string" value="true"/>

<node pkg="nodelet" type="nodelet" name="points_xyzrgb" args="standalone rtabmap_ros/point_cloud_xyzrgb" output="screen">
<remap from="/rtabmap/rgbd_image"      to="/rgbd_image_relay"/>
<remap from="cloud"             to="/cloud" />
<param name="voxel_size"  type ...
edit retag flag offensive close merge delete



Please put the launchfile in code tags in the question, for future searchability and completeness. Thanks.

Dragonslayer gravatar image Dragonslayer  ( 2020-06-22 09:48:44 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2020-06-22 09:13:48 -0600

Dragonslayer gravatar image

updated 2020-06-22 09:15:43 -0600

From the little data you posted, to me it seems you are missing the depthimage to laserscan node (or similar). You input (remap) "scan_cloud (sensor_msgs/PointCloud2)" into rtabmap where there should be "scan (sensor_msgs/LaserScan)" - this is a 2d laserscan type of datastream. To get a LaserScan messege out of a 3d datastream you need a node for interpretation. Standard nodes to do this are depthimage_to_laserscan link or pointcloud_to_laserscan link Be aware that those two nodes have different capabilities, specially tilted sensors only work with one.

Here is a tutorial link for doing what you want link 2.2 is the depthimage to laserscan example.

rtabmap wiki: link

edit flag offensive delete link more


Hey again, i updated my question including the complete config file. Yeah i thought it might be possible to use the pointcloud directly because there's the parameter subscribe_scan_cloud. The pointcloud itself is fine btw.

Chris91 gravatar image Chris91  ( 2020-06-22 09:22:01 -0600 )edit

Well, there is this "~gen_scan (bool, default: "false")

Generate laser scans from depth images (using the middle horizontal line of the depth image). Not generated if subscribe_scan or subscribe_scan_cloud are true. "

It seems after all, rtabmap actually does have an inbuild converter. As your config shows you have a depthimage, I would go this way. You have to look it up how to use this with icp to be on the save side. Likely its as easy as switching it to true, changing the strategy and throwing out the scan_cloud stuff again.

Dragonslayer gravatar image Dragonslayer  ( 2020-06-22 09:47:51 -0600 )edit

Yeah i have already seen that one. I activated it but it's still not working. I disabled subscribe_scan and subscribe_scan_cloud of course.


Chris91 gravatar image Chris91  ( 2020-06-22 11:34:40 -0600 )edit

How do you determine that it isnt working? I have seen a lot of people, including myself, turning away from rtabmap because IRL it just doesnt work out very well. Many go for cartographer.

Dragonslayer gravatar image Dragonslayer  ( 2020-06-22 17:53:33 -0600 )edit

It's still reporting the same error. For me rtab-map it's working fine after all. I haven't tested it in a large area or with multi sensors though. For me cartographer is more complicated to configure. My map is okay with cartographer but better with rtab-map.

Chris91 gravatar image Chris91  ( 2020-06-23 01:55:04 -0600 )edit

What do you mean by "still reporting the same error" what did you change? Is the launchfile in the question updated? The error is because in the beginning you put in 3d data where it expected 2d data (in a 3d messege format though). Did you setup one of the nodes mentioned to get laserscan message, and remaped, enabled acordingly?

Dragonslayer gravatar image Dragonslayer  ( 2020-06-23 09:29:55 -0600 )edit

Hey, i tested using depthimage_to_laserscan with a scan topic. I also checked the scan topic and it's publishing data. Next to that i also tested using the rtabmap parameter gen_scan. But rtabmap is still reporting an error. I will update the question to include the exact error message. I somehow forgot that ...

Chris91 gravatar image Chris91  ( 2020-06-24 06:49:28 -0600 )edit

[ WARN] (2020-06-25 13:07:46.209) SensorData.cpp:718::uncompressDataConst() Requested laser scan data, but the sensor data (131) doesn't have laser scan.

/rtabmap/rtabmap/gen_scan: True

Here is the error message. As you can see in this example is used the gen_scan parameter and set it to true.

Chris91 gravatar image Chris91  ( 2020-06-25 06:09:52 -0600 )edit

Question Tools



Asked: 2020-06-22 07:10:43 -0600

Seen: 505 times

Last updated: Jun 22 '20