Skip to content

Instantly share code, notes, and snippets.

@StepTurtle
Last active December 5, 2023 12:22
Show Gist options
  • Select an option

  • Save StepTurtle/5d9cb72d51d8f3b5de551f12c7493e3a to your computer and use it in GitHub Desktop.

Select an option

Save StepTurtle/5d9cb72d51d8f3b5de551f12c7493e3a to your computer and use it in GitHub Desktop.
Create colorful maps with LIO-SAM

Introduction

This documentation shows you how can you create color maps with LIO-SAM. LIO-SAM is a real-time lidar-inertial odometry package. With our modifications you can create color maps using your multiple number of cameras. You can reach our fork with this link

system

Required Data

To create color maps with LIO-SAM, there is need for ROS2 bag file and ROS2 bag file should contain these topics:

  • sensor_msgs/msg/PointCloud2
  • sensor_msgs/msg/Imu
  • nav_msgs/msg/Odometry (optional)
  • sensor_msgs/msg/Image (you should provide multiple image)

Usage

1. Clone and build package

git clone https://github.com/leo-drive/LIO-SAM-COLOR.git
cd LIO-SAM

colcon build --symlink-install

2. Configure the parameters.

Open lio_sam/config/params.yaml and set following parameters.

pointCloudTopic: "/points" # required: your lidar topic
imuTopic: "/imu/data" # required: your imu topic
gpsTopic: "odometry/gpsz" # optional: your odometry topic

useImuHeadingInitialization: true # set true if you use odometry
useGpsElevation: true # set true if you use odometry

# select your lidar sensor from supported types. If your lidar not sport, select velodyne and change other lidar parameters with using your lidar features.
sensor: velodyne
N_SCAN: 32
Horizon_SCAN: 1800

# set your lidar-imu calibration
extrinsicRot: [1.0,  0.0,  0.0,
                  0.0,  1.0,  0.0,
                  0.0,  0.0, 1.0 ]
extrinsicRPY: [ 1.0,  0.0,  0.0,
                  0.0,  1.0,  0.0,
                  0.0,  0.0,  1.0 ]
                  
# Example Parameters
#
# Example Image Topics: "/sensing/camera/camera0/image_raw", "/sensing/camera/camera1/image_raw", "/sensing/camera/camera2/image_raw"
# Example Camera Info Topics: "/sensing/camera/camera0/camera_info", "/sensing/camera/camera1/camera_info", "/sensing/camera/camera2/camera_info"
#
# For the above examples, parameters should be set as follows.

cameraTopics: ["/sensing/camera/camera0/", "/sensing/camera/camera1/", "/sensing/camera/camera2/"]
imageTopicLastName: "image_raw"
cameraInfoTopicLastName: "camera_info"

3. Run

⚠️ Be sure to publish the transform between lidar and each camera

Install environment and start launch file.

source install/setup.bash
ros2 launch lio_sam run.launch.py

4. Save Map

When mapping process is finished, run following command and save slam map to specified path. Be sure you are in LIO-SAM directory.

source install/setup.bash
ros2 service call /lio_sam/save_map lio_sam/srv/SaveMap "{resolution: 0.2, destination: /Downloads/service_LOAM}"

Result

slam1 slam2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment