Skip to content

Example2

koide3 edited this page Mar 12, 2020 · 12 revisions

Edit: You can use the customized LeGO-LOAM to save the mapping result in the dump format readable from interactive_slam. The mapping result will be written to /tmp/dump after running run.launch.


In this example, we create a map with odometry data generated from a rosbag file using LeGO-LOAM.
Example rosbag file: hdl_400.bag.tar.gz (about 900MB)

Installation

cd catkin_ws/src
git clone https://github.com/RobustFieldAutonomyLab/LeGO-LOAM.git
git clone https://github.com/koide3/odometry_saver.git

*** Note: You need to edit "utility.h" in LeGO-LOAM to adapt it to your sensor. ***

Generating odometry data

Launch odometry_saver:

roslaunch odometry_saver online.launch dst_directory:=/tmp/odometry points_topic:=/velodyne_points odom_topic:=/integrated_to_init endpoint_frame:=base_link origin_frame:=map
  • dst_directory: Destination directory
  • points_topic: Point cloud topic
  • odom_topic: Odometry topic (nav_msgs/Odometry)
  • endpoint_frame: Odometry endpoint TF frame
  • origin_frame: Odometry origin TF frame

Launch LeGO-LOAM and start playing rosbag:

roslaunch lego_loam run.launch
rosbag play --clock hdl_400.bag

After finishing to play back the rosbag, press Ctrl+C to terminate odometry_saver and LeGO-LOAM. You'll see odometry data in the destination directory.

/tmp/odometry
├── 1570513628_110666000.pcd
├── 1570513628_110666000.odom
├── 1570513628_161063000.pcd
├── 1570513628_161063000.odom
├── 1570513628_211459000.pcd
├── 1570513628_211459000.odom

Generate graph data from odometry

rosrun interactive_slam odometry2graph
Menubar -> File -> Open -> ROS -> Choose /tmp/odometry

Screenshot_20191017_105630 png

You can tweak parameters to change the keyframe interval and downsampling resolution: Screenshot_20191017_105657 png (downsample_resolution=0.1, keyframe_delta_x=2.0)
*** Note: Too many and dense keyframes affect the following map correction processing speed ***

Save graph data

Menubar -> File -> Save -> Choose the destination directory

You can open and edit the created graph with interactive_slam. See Example1.