Re: Map Optimized before Loop Closure detected
Posted by
matlabbe on
URL: http://official-rtab-map-forum.206.s1.nabble.com/Map-Optimized-before-Loop-Closure-detected-tp1409p1481.html
Hi,
Not sure why you are getting rviz datatype error for MapCloud topic as by default in the tutorial, the MapCloud is linked to /rtabmap/mapData (when launching rviz with the tutorial's launch file):
$ roslaunch rtabmap_ros rgbd_mapping.launch rviz:=true rtabmapviz:=false
On loop closures, /map -> /odom will change accordingly to map corrections (which may appear random). A loop closure can be detected for each image acquired. However, if you don't move while a loop closure is detected, it may not be added to graph if the latest node is not added. Even if we are not moving, the environment may change. For example, the first time we traversed an area it was sunny, then the second time it is cloudy: visual features may be very different between cloudy and sunny images, if we don't move and the cloud is passing by so that it is sunny again, a loop closure could be then detected.
TF doesn't like child transforms with two parents. You may have /odom -> /kinect and /odom -> /kinect_fake. I did something similar to compare the ground truth of TUM datasets with rtabmap, see
rgbdslam_datasets.launch.
<node pkg="tf" type="static_transform_publisher" name="world_to_map"
args="0.0 0.0 0.0 0.0 0.0 0.0 /world /map 100" />
<!-- Odometry -->
<node pkg="rtabmap_ros" type="rgbd_odometry" name="rgbd_odometry">
<remap from="odom" to="vis_odom"/>
<param name="odom_frame_id" type="string" value="vis_odom"/>
<param name="frame_id" type="string" value="kinect"/>
<param name="publish_tf" type="bool" value="false"/>
<param name="ground_truth_frame_id" type="string" value="world"/>
</node>
<!-- rename the child frame of odometry -->
<node name="odom_msg_to_tf" pkg="rtabmap_ros" type="odom_msg_to_tf">
<param name="frame_id" type="string" value="kinect_est"/>
</node>
So odometry publishes "/vis_odom -> /kinect_est" instead of "/odom -> /kinect". Note that "/world -> /kinect" is the ground truth. The resulting TF tree was something like this:
/world -----> /map ----> /vis_odom ----> /kinect_est
\
---> /kinect
cheers