Re: Generating multiple maps with rosbags
Posted by
matlabbe on
URL: http://official-rtab-map-forum.206.s1.nabble.com/Generating-multiple-maps-with-rosbags-tp1405p1434.html
Hi,
I fixed a bug (see this
commit) that when odometry was reset, the last image of the previous bag was still in the ROS message synchronizer's queue list. So when a new bag was played, odometry started with the last image of the previous bag even after calling /reset_odom service, causing an odometry lost at start (if the first image of the new bag is not correlated with the previous bag). To have this fix, you will have to
build rtabmap_ros from source. Now the message queue list is correctly flushed when /reset_odom is called.
The following steps are now working. Make 10 bags:
$ roslaunch freenect_launch freenect.launch depth_registration:=true data_skip:=2
$ mkdir bags
$ cd bags
$ rosbag record /tf /camera/rgb/image_rect_color /camera/rgb/camera_info /camera/depth_registered/image_raw -O 1.bag
...
$ rosbag record /tf /camera/rgb/image_rect_color /camera/rgb/camera_info /camera/depth_registered/image_raw -O 10.bag
Create a cloud for each bag:
$ roscore
$ rosparam set use_sim_time true
$ roslaunch rtabmap_ros rtabmap.launch
$ rosbag play --clock 1.bag
### wait to finish, then in rtabmapviz:
1- click Pause
2- File->Export 3D clouds (uncheck Meshing) -> Save to "cloud1.pcd"
3- click Pause again to resume
4- Edit-> Delete Memory (if you use service /rtabmap/reset instead, make sure to do Edit->"Clear the cache" in rtabmapviz)
5- Detection -> Reset odometry (same as service /rtabmap/reset_odom)
$ rosbag play --clock 2.bag
## Do the 5 steps above and so on for each bag
...
Note that the bags should be played chronologically, as TF is used.
cheers