Skip to content

Commit 5258912

Browse files
committed
init commit
0 parents  commit 5258912

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+8917
-0
lines changed

.github/stale.yml

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Number of days of inactivity before an issue becomes stale
2+
daysUntilStale: 14
3+
# Number of days of inactivity before a stale issue is closed
4+
daysUntilClose: 1
5+
# Issues with these labels will never be considered stale
6+
exemptLabels:
7+
- pinned
8+
- security
9+
# Label to use when marking an issue as stale
10+
staleLabel: stale
11+
# Comment to post when marking an issue as stale. Set to `false` to disable
12+
markComment: >
13+
This issue has been automatically marked as stale because it has not had
14+
recent activity. It will be closed if no further activity occurs. Thank you
15+
for your contributions.
16+
# Comment to post when closing a stale issue. Set to `false` to disable
17+
closeComment: false

CMakeLists.txt

+111
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
cmake_minimum_required(VERSION 2.8.3)
2+
project(lio_sam LANGUAGES CXX CUDA)
3+
4+
set(CMAKE_BUILD_TYPE "Release")
5+
set(CMAKE_CXX_FLAGS "-std=c++14")
6+
set(CMAKE_CXX_FLAGS_RELEASE "-O3 -Wall -g -pthread")
7+
8+
find_package(catkin REQUIRED COMPONENTS
9+
tf
10+
roscpp
11+
rospy
12+
cv_bridge
13+
# pcl library
14+
pcl_conversions
15+
# msgs
16+
std_msgs
17+
sensor_msgs
18+
geometry_msgs
19+
nav_msgs
20+
message_generation
21+
visualization_msgs
22+
)
23+
24+
find_package(OpenMP REQUIRED)
25+
find_package(PCL REQUIRED QUIET)
26+
find_package(OpenCV REQUIRED QUIET)
27+
find_package(GTSAM REQUIRED QUIET)
28+
29+
add_message_files(
30+
DIRECTORY msg
31+
FILES
32+
cloud_info.msg
33+
)
34+
35+
add_service_files(
36+
DIRECTORY srv
37+
FILES
38+
save_map.srv
39+
)
40+
41+
generate_messages(
42+
DEPENDENCIES
43+
geometry_msgs
44+
std_msgs
45+
nav_msgs
46+
sensor_msgs
47+
)
48+
49+
catkin_package(
50+
INCLUDE_DIRS include
51+
DEPENDS PCL GTSAM
52+
53+
CATKIN_DEPENDS
54+
std_msgs
55+
nav_msgs
56+
geometry_msgs
57+
sensor_msgs
58+
message_runtime
59+
message_generation
60+
visualization_msgs
61+
)
62+
63+
# include directories
64+
include_directories(
65+
include
66+
${catkin_INCLUDE_DIRS}
67+
${PCL_INCLUDE_DIRS}
68+
${OpenCV_INCLUDE_DIRS}
69+
${GTSAM_INCLUDE_DIR}
70+
)
71+
72+
# link directories
73+
link_directories(
74+
include
75+
${PCL_LIBRARY_DIRS}
76+
${OpenCV_LIBRARY_DIRS}
77+
${GTSAM_LIBRARY_DIRS}
78+
)
79+
80+
##### cuda_plane_line_odometry #####
81+
include_directories(/usr/local/cuda/include) # for "#include <math_functions.hpp>"
82+
include_directories(/usr/local/cuda/include/crt) # for "#include <math_functions.hpp>"
83+
add_subdirectory(src/cuda_plane_line_odometry)
84+
##### cuda_plane_line_odometry #####
85+
86+
###########
87+
## Build ##
88+
###########
89+
90+
# Range Image Projection
91+
add_executable(${PROJECT_NAME}_imageProjection src/imageProjection.cpp)
92+
add_dependencies(${PROJECT_NAME}_imageProjection ${catkin_EXPORTED_TARGETS} ${PROJECT_NAME}_generate_messages_cpp)
93+
target_link_libraries(${PROJECT_NAME}_imageProjection ${catkin_LIBRARIES} ${PCL_LIBRARIES} ${OpenCV_LIBRARIES})
94+
95+
# Feature Association
96+
add_executable(${PROJECT_NAME}_featureExtraction src/featureExtraction.cpp)
97+
add_dependencies(${PROJECT_NAME}_featureExtraction ${catkin_EXPORTED_TARGETS} ${PROJECT_NAME}_generate_messages_cpp)
98+
target_link_libraries(${PROJECT_NAME}_featureExtraction ${catkin_LIBRARIES} ${PCL_LIBRARIES} ${OpenCV_LIBRARIES})
99+
100+
# Mapping Optimization
101+
add_executable(${PROJECT_NAME}_mapOptmization src/mapOptmization.cpp)
102+
add_dependencies(${PROJECT_NAME}_mapOptmization ${catkin_EXPORTED_TARGETS} ${PROJECT_NAME}_generate_messages_cpp)
103+
target_compile_options(${PROJECT_NAME}_mapOptmization PRIVATE ${OpenMP_CXX_FLAGS})
104+
target_link_libraries(${PROJECT_NAME}_mapOptmization ${catkin_LIBRARIES} ${PCL_LIBRARIES} ${OpenCV_LIBRARIES} ${OpenMP_CXX_FLAGS} gtsam)
105+
##### cuda_plane_line_odometry #####
106+
target_link_libraries(${PROJECT_NAME}_mapOptmization CUDALinePlaneOdometry)
107+
##### cuda_plane_line_odometry #####
108+
109+
# IMU Preintegration
110+
add_executable(${PROJECT_NAME}_imuPreintegration src/imuPreintegration.cpp)
111+
target_link_libraries(${PROJECT_NAME}_imuPreintegration ${catkin_LIBRARIES} ${PCL_LIBRARIES} ${OpenCV_LIBRARIES} gtsam)

LICENSE

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
BSD 3-Clause License
2+
3+
Copyright (c) 2020, Tixiao Shan
4+
All rights reserved.
5+
6+
Redistribution and use in source and binary forms, with or without
7+
modification, are permitted provided that the following conditions are met:
8+
9+
* Redistributions of source code must retain the above copyright notice, this
10+
list of conditions and the following disclaimer.
11+
12+
* Redistributions in binary form must reproduce the above copyright notice,
13+
this list of conditions and the following disclaimer in the documentation
14+
and/or other materials provided with the distribution.
15+
16+
* Neither the name of the copyright holder nor the names of its
17+
contributors may be used to endorse or promote products derived from
18+
this software without specific prior written permission.
19+
20+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
24+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
26+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
27+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
28+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

README.md

+70
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
# LIO-SAM-CUDA-ScanToMapOpt
2+
This repository reimplements of the line/plane odometry of LIO-SAM with CUDA. Replacing pcl's kdtree, a point cloud hash map (inspired by iVox of [Faster-LIO](https://github.com/gaoxiang12/faster-lio])) on GPU is used to accelerate 5-neighbour KNN search.
3+
4+
5+
6+
## About
7+
This repository reimplements the line/plane odometry in scan2MapOptimization() of mapOptimization.cpp with CUDA. The most significant cost of the original implementation is the 5-neighbour KNN search using pcl's kdtree, which, on my machine (intel i7-6700k CPU, walking_dataset.bag, with OpenMP), usually takes about 5ms. This repository replaces pcl's kdtree with a point cloud cloud hash map (inspired by iVox of [Faster-LIO](https://github.com/gaoxiang12/faster-lio])) implemented with CUDA. On my machine (Nvidia 980TI CPU, walking_dataset.bag), average cost of the 5-neighbour KNN search is down to about 0.5~0.6ms, average cost of all one frame is down to about 11ms. Meanwhile, other parts of the line/plane odometry (jacobians & residuals etc) are also implemented with CUDA.
8+
9+
10+
11+
## Dependencies
12+
The essential dependencies are as same as [LIO-SAM](https://github.com/TixiaoShan/LIO-SAM). In addition, the CUDA reimplementation of the line/plane odometry requires :
13+
- C++14
14+
- [CUDA](https://developer.nvidia.com/cuda-downloads) (>= 11.0)
15+
- CUBLAS
16+
- thrust
17+
- [Eigen](https://eigen.tuxfamily.org/) (>= 3.3.9)
18+
19+
20+
21+
## Speed-up
22+
<table style="text-align:center;font-size:11pt">
23+
<tr>
24+
<th rowspan="2">Sequence</th><th colspan="2">CPU (Intel I7-6700K)</th><th colspan="3">GPU (Nvidia 980TI)</th>
25+
</tr>
26+
<tr>
27+
<th>build kdtree</th><th>one frame<br>(build kdtree & all iteraions)</th><th>build hashmap</th><th>one KNN</th><th>one frame<br>(build hashmap & all iteraions)</th>
28+
</tr>
29+
<tr>
30+
<td><a href="https://drive.google.com/drive/folders/1gJHwfdHCRdjP7vuT556pv8atqrCJPbUq?usp=sharing">Walking</a></td><td>16.06ms no RVIZ<br>29.00ms with RVIZ</td><td>49.98ms no RVIZ<br>84.20ms with RVIZ</td><td>4.52ms no RVIZ<br>6.93ms with RVIZ</td><td>0.57ms no RVIZ<br>0.58ms with RVIZ</td><td>11.06ms no RVIZ<br>15.68ms with RVIZ</td>
31+
</tr>
32+
<tr>
33+
<td><a href="https://drive.google.com/drive/folders/1gJHwfdHCRdjP7vuT556pv8atqrCJPbUq?usp=sharing">Park</a></td><td>16.11ms no RVIZ<br>28.08ms with RVIZ</td><td>59.02ms no RVIZ<br>101.38ms with RVIZ</td><td>4.18ms no RVIZ<br>6.71ms with RVIZ</td><td>0.62ms no RVIZ<br>0.62ms with RVIZ</td><td>11.41ms no RVIZ<br>16.55ms with RVIZ</td>
34+
</tr>
35+
<tr>
36+
<td><a href="https://drive.google.com/drive/folders/1gJHwfdHCRdjP7vuT556pv8atqrCJPbUq?usp=sharing">Garden</a></td><td>17.66ms no RVIZ<br>31.71ms with RVIZ</td><td>53.40ms no RVIZ<br>84.24ms with RVIZ</td><td>5.01ms no RVIZ<br>7.43ms with RVIZ</td><td>0.60ms no RVIZ<br>0.61ms with RVIZ</td><td>11.42ms no RVIZ<br>15.66ms with RVIZ</td>
37+
</tr>
38+
<tr>
39+
<td><a href="https://drive.google.com/drive/folders/1gJHwfdHCRdjP7vuT556pv8atqrCJPbUq?usp=sharing">Rooftop</a></td><td>17.48ms no RVIZ<br>36.78ms with RVIZ</td><td>67.81ms no RVIZ<br>120.75ms with RVIZ</td><td>4.96ms no RVIZ<br>8.30ms with RVIZ</td><td>0.81ms no RVIZ<br>0.82ms with RVIZ</td><td>13.63ms no RVIZ<br>19.86ms with RVIZ</td>
40+
</tr>
41+
<tr>
42+
<td><a href="https://drive.google.com/drive/folders/1gJHwfdHCRdjP7vuT556pv8atqrCJPbUq?usp=sharing">Rotation</a></td><td>11.01ms no RVIZ<br>10.80ms with RVIZ</td><td>50.30ms no RVIZ<br>53.15ms with RVIZ</td><td>4.01ms no RVIZ<br>4.40ms with RVIZ</td><td>0.54ms no RVIZ<br>0.55ms with RVIZ</td><td>9.77ms no RVIZ<br>10.27ms with RVIZ</td>
43+
</tr>
44+
<tr>
45+
<td><a href="https://drive.google.com/drive/folders/1gJHwfdHCRdjP7vuT556pv8atqrCJPbUq?usp=sharing">Campus (small)</a></td><td>17.88ms no RVIZ<br>37.30ms with RVIZ</td><td>58.68ms no RVIZ<br>115.68ms with RVIZ</td><td>4.70ms no RVIZ<br>7.62ms with RVIZ</td><td>0.60ms no RVIZ<br>0.62ms with RVIZ</td><td>11.89ms no RVIZ<br>17.83ms with RVIZ</td>
46+
</tr>
47+
<tr>
48+
<td><a href="https://drive.google.com/drive/folders/1gJHwfdHCRdjP7vuT556pv8atqrCJPbUq?usp=sharing">Campus (large)</a></td><td>16.20ms no RVIZ<br>28.39ms with RVIZ</td><td>60.67ms no RVIZ<br>108.08ms with RVIZ</td><td>4.76ms no RVIZ<br>7.50ms with RVIZ</td><td>0.62ms no RVIZ<br>0.63ms with RVIZ</td><td>12.48ms no RVIZ<br>17.47ms with RVIZ</td>
49+
</tr>
50+
<tr>
51+
<td><a href="https://drive.google.com/drive/folders/1gJHwfdHCRdjP7vuT556pv8atqrCJPbUq?usp=sharing">2011_09_30_drive_0028</a></td><td>14.33ms no RVIZ<br>22.25ms with RVIZ</td><td>110.22ms no RVIZ<br>168.98ms with RVIZ</td><td>5.20ms no RVIZ<br>7.44ms with RVIZ</td><td>1.05ms no RVIZ<br>1.05ms with RVIZ</td><td>19.64ms no RVIZ<br>24.50ms with RVIZ</td>
52+
</tr>
53+
<!--
54+
<tr>
55+
<td>1</td><td>2</td><td>3</td><td>4</td><td>5</td><td>6</td><td>7</td><td>8</td><td>9</td>
56+
</tr>
57+
-->
58+
</table>
59+
60+
61+
62+
P.S. It seems that RVIZ will largely slow down the speed of this reimplementation. For example, with RVIZ running, average cost of one frame in walking dataset is dragged to about 15.56ms.
63+
64+
65+
66+
## Acknowledgements
67+
This repository is a modified version of [LIO-SAM](https://github.com/TixiaoShan/LIO-SAM), whose line/plane odometry is originally based upon LOAM.
68+
69+
The point cloud hash map on GPU is inspired by iVox data structure of [Faster-LIO](https://github.com/gaoxiang12/faster-lio]), and draws experience from [kdtree_cuda_builder.h](https://github.com/flann-lib/flann/blob/master/src/cpp/flann/algorithms/kdtree_cuda_builder.h) of [FLANN](https://github.com/flann-lib/flann).
70+

config/doc/demo.gif

7.07 MB
Loading

config/doc/device-boat.png

128 KB
Loading

config/doc/device-hand-2.png

467 KB
Loading

config/doc/device-hand.png

111 KB
Loading

config/doc/device-jackal.png

198 KB
Loading

config/doc/gps-demo.gif

6.47 MB
Loading

config/doc/imu-debug.gif

3.45 MB
Loading

config/doc/imu-transform.png

1.09 MB
Loading

config/doc/kitti-demo.gif

10.2 MB
Loading

config/doc/kitti-map.png

210 KB
Loading

config/doc/kitti2bag/README.md

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# kitti2bag
2+
3+
## How to run it?
4+
5+
```bash
6+
wget https://s3.eu-central-1.amazonaws.com/avg-kitti/raw_data/2011_09_26_drive_0084/2011_09_26_drive_0084_sync.zip
7+
wget https://s3.eu-central-1.amazonaws.com/avg-kitti/raw_data/2011_09_26_drive_0084/2011_09_26_drive_0084_extract.zip
8+
wget https://s3.eu-central-1.amazonaws.com/avg-kitti/raw_data/2011_09_26_calib.zip
9+
unzip 2011_09_26_drive_0084_sync.zip
10+
unzip 2011_09_26_drive_0084_extract.zip
11+
unzip 2011_09_26_calib.zip
12+
python kitti2bag.py -t 2011_09_26 -r 0084 raw_synced .
13+
```
14+
15+
That's it. You have a bag that contains your data.
16+
17+
Other source files can be found at [KITTI raw data](http://www.cvlibs.net/datasets/kitti/raw_data.php) page.

0 commit comments

Comments
 (0)