Skip to content

A CUDA reimplementation of the line/plane odometry of LIO-SAM. A point cloud hash map (inspired by iVox of Faster-LIO) on GPU is used to accelerate 5-neighbour KNN search. Run on Jetson Orin NX 8GB.

License

Notifications You must be signed in to change notification settings

qdLMF/LIO-SAM-GPU-ScanToMapOpt

Repository files navigation

LIO-SAM-GPU-ScanToMapOpt

This repository reimplements the line/plane odometry (based on LOAM) of LIO-SAM with CUDA. Replacing pcl's kdtree, a point cloud hash map (inspired by iVox of Faster-LIO) on GPU is used to accelerate local map building, 5-neighbour KNN search and non-linear optimization.

Modifications are as follow :

  • The CUDA codes of the line/plane odometry are in src/cuda_plane_line_odometry.
  • To use this CUDA odometry, the scan2MapOptimization() in mapOptimization.cpp is replaced with scan2MapOptimizationWithCUDA().

About

This repository reimplements the line/plane odometry in scan2MapOptimization() of mapOptimization.cpp with CUDA.

On my machine (Orin-NX-8GB, walking_dataset.bag, with OpenMP), original CPU version:

  • average cost of extracting surrounding key frames is more than 30ms
  • average cost of building local map is about 20ms
  • average cost of KNN search and optimization is about 30ms
  • average cost of all operations in one frame is about 85ms

This repository replaces pcl's kdtree with a point cloud hash map (inspired by iVox of Faster-LIO) implemented with CUDA.

Meanwhile, other parts of the line/plane odometry (jacobians & residuals etc) are also implemented with CUDA.

On my machine (Orin-NX-8GB, walking_dataset.bag), GPU version implemented by this project :

  • average cost of extracting surrounding key frames is down to about 2.74ms
  • average cost of incrementally updating local map is down to about 1.16ms
  • average cost of one 5-neighbour KNN search is down to about 1.40ms
  • average cost of all operations in one frame is down to about 21.56ms

Dependencies

The essential dependencies are as same as LIO-SAM

My Orin-NX-8GB's specific enviroment :

  • Ubuntu 20.04, Ros Noetic, JetPack 5.10
  • C++14
  • CUDA 11.4
  • Eigen 3.3.7

How To Build

Before build this repo, some CMAKE variables in src/cuda_plane_line_odometry/CMakeLists.txt need to be modified to fit your enviroment :

set(CMAKE_CUDA_COMPILER /usr/local/cuda/bin/nvcc)   # change it to your path to nvcc
set(CUDA_TOOLKIT_ROOT_DIR /usr/local/cuda/bin/nvcc) # change it to your path to nvcc
set(CMAKE_CUDA_ARCHITECTURES 87)                    # for example, if your device's compute capability is 6.2, then set this CMAKE variable to 62
                                                    # In my Orin-NX-8GB, this CMAKE variable is 87 

The basic steps to compile and run this repo is as same as LIO-SAM.

Speed-up

SequenceOrin-NX-8GB CPUOrin-NX-8GB GPU
extract
surrounding
key frames
build
kdtree
one
frame
extract
surrounding
key frames
incrementally
update
hashmap
one
KNN
one
frame
speed-up
Walking34.65ms20.03ms84.95ms2.74ms1.16ms1.40ms21.56ms3.94x
Campus (large)25.21ms19.34ms84.75ms1.71ms1.13ms1.49ms23.58ms3.59x
2011_09_30_drive_002868.17ms22.04ms166.67ms11.70ms3.97ms2.59ms54.06ms3.08x

Acknowledgements

This repository is a modified version of LIO-SAM, whose line/plane odometry is originally based upon LOAM.

The point cloud hash map on GPU is inspired by iVox data structure of Faster-LIO, and draws experience from kdtree_cuda_builder.h of FLANN.

Star History

Star History Chart

About

A CUDA reimplementation of the line/plane odometry of LIO-SAM. A point cloud hash map (inspired by iVox of Faster-LIO) on GPU is used to accelerate 5-neighbour KNN search. Run on Jetson Orin NX 8GB.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published