0
$\begingroup$

Rosanswers logo

Hey,

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.

<launch>

<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)" />
</include>

<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"/>
</node>

<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>

<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="double" value="0.02"/>
<param name="approx_sync" type="bool"   value="true"/>
</node>

<node pkg="nodelet" type="nodelet" name="obstacles_detection" args="standalone rtabmap_ros/obstacles_detection">
<remap from="cloud" to="/cloud"/>
<remap from="obstacles" to="/planner_cloud"/>
<param name="frame_id" type="string" value="base_footprint"/>
<param name="map_frame_id" type="string" value="map"/>
<param name="min_cluster_size" type="int" value="20"/>
</node>

<!-- Maping Node -->
<node pkg="gmapping" type="slam_gmapping" name="gmapping_node" output="screen" >
<remap from="odom" to="your/odom/topic" />
</node>

<node if="$(arg rtabmapviz)" pkg="rtabmap_ros" type="rtabmapviz" name="rtabmapviz" args="-d $(find rtabmap_ros)/launch/config/rgbd_gui.ini" output="screen">
<param name="subscribe_odom"   type="bool"   value="true"/>
<param name="frame_id"         type="string" value="base_footprint"/>
<param name="approx_sync"      type="bool"   value="true"/>
<remap from="odom"            to="/odom"/>
</node>
</group>

<include file="$(find turtlebot3_navigation)/launch/move_base.launch">
<arg name="model" value="$(arg model)" />
<arg name="move_forward_only" value="$(arg move_forward_only)"/>
</include>  

<group if="$(arg open_rviz)"> 
<node pkg="rviz" type="rviz" name="rviz" required="true"
args="-d $(find turtlebot3_navigation)/rviz/turtlebot3_navigation.rviz"/>
</group>

</launch>

The exact error displayed is:

[ WARN] (2020-06-22 14:04:20.141) SensorData.cpp:718::uncompressDataConst() Requested laser scan data, but the sensor data (739) doesn't have laser scan.

What do i miss here ? @matlabbe do you have any idea ?

Edit: Here is the complete config, I'm sorry i forgot posting it.


Originally posted by Chris91 on ROS Answers with karma: 15 on 2020-06-22

Post score: 0


Original comments

Comment by Dragonslayer on 2020-06-22:
Please put the launchfile in code tags in the question, for future searchability and completeness. Thanks.

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

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


Originally posted by Dragonslayer with karma: 574 on 2020-06-22

This answer was ACCEPTED on the original site

Post score: 0


Original comments

Comment by Chris91 on 2020-06-22:
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.

Comment by Dragonslayer on 2020-06-22:
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.

Comment by Chris91 on 2020-06-22:
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.

http://official-rtab-map-forum.67519.x6.nabble.com/quot-gen-scan-quot-option-td610.html

Comment by Dragonslayer on 2020-06-22:
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.

Comment by Chris91 on 2020-06-23:
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.

Comment by Dragonslayer on 2020-06-23:
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?

Comment by Chris91 on 2020-06-24:
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 ...

Comment by Chris91 on 2020-06-25:
[ 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.

Comment by Dragonslayer on 2020-06-25:
As you seem to launch all together, what does your log files say, what node is throwing it. Might even just be viz configured to display laserscan. But anyway, what exact launchfile is producing this? the ...v6.launch on the google drive with gen_scan: true?

Comment by Chris91 on 2020-06-30:
Okay i restarted the machine now it seems to work. Maybe something was chached by rtabmap ? The pose is very unstable though ...

Comment by Dragonslayer on 2020-06-30:
Good old restart trick ;) Well, the thing is of course that most laserscan icp algorithms are build for 360° scans. The small sector and likely much more noisy "fake" scan that is generated from a rgb-d camera might not be ideal. When I experimented with scans from rgb-d it all practically failed. With a real 360° lidar, even a cheap one it works like a charm. And of course all the data and mechanics work together in a robot. 2cm noise might not be to relevant if you are moving at 2m/s, but at 0.05cm/s or standstill its a mess. But then once again, if your base is a car, it might not be relevant if your robot is just 0,3x0,3 meters its a different case. You might consider marking the answered.

$\endgroup$

Your Answer

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