-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit e570908
Showing
34 changed files
with
5,691 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
cmake_minimum_required(VERSION 2.8.3) | ||
project(sfast_lio) | ||
|
||
SET(CMAKE_BUILD_TYPE "Debug") | ||
|
||
ADD_COMPILE_OPTIONS(-std=c++14 ) | ||
ADD_COMPILE_OPTIONS(-std=c++14 ) | ||
set( CMAKE_CXX_FLAGS "-std=c++14 -O3" ) | ||
|
||
add_definitions(-DROOT_DIR=\"${CMAKE_CURRENT_SOURCE_DIR}/\") | ||
|
||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fexceptions" ) | ||
set(CMAKE_CXX_STANDARD 14) | ||
set(CMAKE_CXX_STANDARD_REQUIRED ON) | ||
set(CMAKE_CXX_EXTENSIONS OFF) | ||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14 -pthread -std=c++0x -std=c++14 -fexceptions") | ||
|
||
message("Current CPU archtecture: ${CMAKE_SYSTEM_PROCESSOR}") | ||
if(CMAKE_SYSTEM_PROCESSOR MATCHES "(x86)|(X86)|(amd64)|(AMD64)" ) | ||
include(ProcessorCount) | ||
ProcessorCount(N) | ||
message("Processer number: ${N}") | ||
if(N GREATER 4) | ||
add_definitions(-DMP_EN) | ||
add_definitions(-DMP_PROC_NUM=3) | ||
message("core for MP: 3") | ||
elseif(N GREATER 3) | ||
add_definitions(-DMP_EN) | ||
add_definitions(-DMP_PROC_NUM=2) | ||
message("core for MP: 2") | ||
else() | ||
add_definitions(-DMP_PROC_NUM=1) | ||
endif() | ||
else() | ||
add_definitions(-DMP_PROC_NUM=1) | ||
endif() | ||
|
||
find_package(OpenMP QUIET) | ||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}") | ||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}") | ||
|
||
find_package(catkin REQUIRED COMPONENTS | ||
geometry_msgs | ||
nav_msgs | ||
sensor_msgs | ||
roscpp | ||
rospy | ||
std_msgs | ||
pcl_ros | ||
tf | ||
livox_ros_driver | ||
message_generation | ||
eigen_conversions | ||
) | ||
|
||
find_package(Eigen3 REQUIRED) | ||
find_package(PCL 1.8 REQUIRED) | ||
find_package( Sophus REQUIRED ) | ||
|
||
message(Eigen: ${EIGEN3_INCLUDE_DIR}) | ||
|
||
include_directories( | ||
${catkin_INCLUDE_DIRS} | ||
${EIGEN3_INCLUDE_DIR} | ||
${PCL_INCLUDE_DIRS} | ||
${PYTHON_INCLUDE_DIRS} | ||
${Sophus_INCLUDE_DIRS} | ||
include) | ||
|
||
add_message_files( | ||
FILES | ||
Pose6D.msg | ||
) | ||
|
||
generate_messages( | ||
DEPENDENCIES | ||
geometry_msgs | ||
) | ||
|
||
catkin_package( | ||
CATKIN_DEPENDS geometry_msgs nav_msgs roscpp rospy std_msgs message_runtime | ||
DEPENDS EIGEN3 PCL | ||
INCLUDE_DIRS | ||
) | ||
|
||
add_executable(fastlio_mapping src/laserMapping.cpp include/ikd-Tree/ikd_Tree.cpp src/preprocess.cpp) | ||
target_link_libraries(fastlio_mapping ${catkin_LIBRARIES} ${PCL_LIBRARIES} ${PYTHON_LIBRARIES} ${Sophus_LIBRARIES}) | ||
target_include_directories(fastlio_mapping PRIVATE ${PYTHON_INCLUDE_DIRS}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
# S-FAST_LIO | ||
## Simplified Implementation of FAST_LIO | ||
|
||
S-FAST_LIO is a simplified implementation of FAST_LIO (Xu, Wei, et al. "Fast-lio2: Fast direct lidar-inertial odometry."), which is modified from [FAST_LIO](https://github.com/hku-mars/FAST_LIO). This code is clean and accessible. It is a reference material for SLAM beginners.The main modifications are as follows: | ||
* The [Sophus](https://github.com/strasdat/Sophus) is used to define the state variables, instead of the complicated [IKFOM](https://github.com/hku-mars/IKFoM) | ||
* The gravity component is directly defined by a Vector3d, thus the complicated calculation of two-dimensional manifold can be omitted | ||
* The code structure has been optimized, and the unnecessary codes have been deleted | ||
* Detailed Chinese notes are added to the code | ||
* Support for Robosense LiDAR has been added | ||
|
||
<div align=center> | ||
<img src="pic/avia_1.png" width = 70% height = 70%/> | ||
</div> | ||
|
||
## 1. Prerequisites | ||
### 1.1 **Ubuntu** and **ROS** | ||
Ubuntu >= 16.04. | ||
|
||
### 1.2. **PCL && Eigen** | ||
PCL >= 1.8, Eigen >= 3.3.4. | ||
|
||
### 1.3. **livox_ros_driver** | ||
Follow [livox_ros_driver Installation](https://github.com/Livox-SDK/livox_ros_driver). | ||
|
||
Source:The easiest way is add the line ``` source $Licox_ros_driver_dir$/devel/setup.bash ``` to the end of file ``` ~/.bashrc ```, where ``` $Licox_ros_driver_dir$ ``` is the directory of the livox ros driver workspace (should be the ``` ws_livox ``` directory if you completely followed the livox official document). | ||
|
||
### 1.4. **Sophus** | ||
We use the old version of Sophus | ||
``` | ||
git clone https://github.com/strasdat/Sophus.git | ||
cd Sophus | ||
git checkout a621ff | ||
mkdir build | ||
cd build | ||
cmake ../ -DUSE_BASIC_LOGGING=ON | ||
make | ||
sudo make install | ||
``` | ||
|
||
|
||
## 2. Build S-FAST_LIO | ||
Clone the repository and catkin_make: | ||
|
||
``` | ||
cd ~/catkin_ws/src | ||
git clone https://github.com/zlwang7/S-FAST_LIO.git | ||
cd ../ | ||
catkin_make | ||
source ~/catkin_ws/devel/setup.bash | ||
``` | ||
|
||
## 3. Rosbag Example | ||
### 3.1 Livox Avia Rosbag | ||
Here we provide some additional Avia Rosbags. They are collected by [Arafat-ninja](https://github.com/Arafat-ninja). | ||
|
||
<div align="left"> | ||
<img src="pic/avia_11.png" width = 40% height = 10% /> | ||
<img src="pic/avia_2.png" width = 40% height = 10% /> | ||
<img src="pic/avia_1.gif" width = 40% height = 10% /> | ||
<img src="pic/avia_2.gif" width = 40% height = 10% > | ||
|
||
Files: Can be downloaded from [google drive](https://drive.google.com/drive/folders/1EqNt6Bm_6Jf3beRf_RI3yrhiUCND09se?usp=share_link). | ||
You can also directly use the Avia Rosbags provided by FAST_LIO [(google drive)](https://drive.google.com/drive/folders/1YL5MQVYgAM8oAWUm7e3OGXZBPKkanmY1?usp=sharing). | ||
|
||
Run: | ||
``` | ||
roslaunch sfast_lio mapping_avia.launch | ||
rosbag play YOUR_DOWNLOADED.bag | ||
``` | ||
|
||
### 3.2 RS-LiDAR Rosbag | ||
Datasets are collected by a RS-Helios LiDAR and an Xsens IMU. | ||
|
||
<div align="left"> | ||
<img src="pic/RS_indoor1.png" width=47% /> | ||
<img src="pic/RS_indoor2.png" width=46% /> | ||
<img src="pic/RS_indoor1.gif" width = 47% height = 10% /> | ||
<img src="pic/RS_indoor2.gif" width = 47% height = 10% > | ||
|
||
Files: Can be downloaded from [google drive](https://drive.google.com/drive/folders/1EqNt6Bm_6Jf3beRf_RI3yrhiUCND09se?usp=share_link). | ||
|
||
Run: | ||
``` | ||
roslaunch sfast_lio mapping_rs.launch | ||
rosbag play YOUR_DOWNLOADED.bag | ||
``` | ||
|
||
|
||
## 4. Directly Run | ||
The same as [FAST_LIO](https://github.com/hku-mars/FAST_LIO). | ||
|
||
|
||
## 5.Acknowledgements | ||
Thanks for the authors of [FAST-LIO](https://github.com/hku-mars/FAST_LIO). | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
common: | ||
lid_topic: "/livox/lidar" | ||
imu_topic: "/livox/imu" | ||
time_sync_en: false # ONLY turn on when external time synchronization is really not possible | ||
time_offset_lidar_to_imu: 0.0 # Time offset between lidar and IMU calibrated by other algorithms, e.g. LI-Init (can be found in README). | ||
# This param will take effect no matter what time_sync_en is. So if the time offset is not known exactly, please set as 0.0 | ||
|
||
preprocess: | ||
lidar_type: 1 # 1 for Livox serials LiDAR, 2 for Velodyne LiDAR, 3 for ouster LiDAR, | ||
scan_line: 6 | ||
blind: 4 | ||
|
||
mapping: | ||
acc_cov: 0.1 | ||
gyr_cov: 0.1 | ||
b_acc_cov: 0.0001 | ||
b_gyr_cov: 0.0001 | ||
fov_degree: 90 | ||
det_range: 450.0 | ||
extrinsic_est_en: false # true: enable the online estimation of IMU-LiDAR extrinsic | ||
extrinsic_T: [ 0.04165, 0.02326, -0.0284 ] | ||
extrinsic_R: [ 1, 0, 0, | ||
0, 1, 0, | ||
0, 0, 1] | ||
|
||
publish: | ||
path_en: true | ||
scan_publish_en: true # false: close all the point cloud output | ||
dense_publish_en: true # false: low down the points number in a global-frame point clouds scan. | ||
scan_bodyframe_pub_en: false # true: output the point cloud scans in IMU-body-frame | ||
|
||
pcd_save: | ||
pcd_save_en: false | ||
interval: 100 # how many LiDAR frames saved in each pcd file; | ||
# -1 : all frames will be saved in ONE pcd file, may lead to memory crash when having too much frames. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
common: | ||
lid_topic: "/livox/lidar" | ||
imu_topic: "/livox/imu" | ||
time_sync_en: false # ONLY turn on when external time synchronization is really not possible | ||
time_offset_lidar_to_imu: 0.0 # Time offset between lidar and IMU calibrated by other algorithms, e.g. LI-Init (can be found in README). | ||
# This param will take effect no matter what time_sync_en is. So if the time offset is not known exactly, please set as 0.0 | ||
|
||
preprocess: | ||
lidar_type: 1 # 1 for Livox serials LiDAR, 2 for Velodyne LiDAR, 3 for ouster LiDAR, | ||
scan_line: 6 | ||
blind: 4 | ||
|
||
mapping: | ||
acc_cov: 0.1 | ||
gyr_cov: 0.1 | ||
b_acc_cov: 0.0001 | ||
b_gyr_cov: 0.0001 | ||
fov_degree: 100 | ||
det_range: 260.0 | ||
extrinsic_est_en: false # true: enable the online estimation of IMU-LiDAR extrinsic | ||
extrinsic_T: [ 0.05512, 0.02226, -0.0297 ] | ||
extrinsic_R: [ 1, 0, 0, | ||
0, 1, 0, | ||
0, 0, 1] | ||
|
||
publish: | ||
path_en: false | ||
scan_publish_en: true # false: close all the point cloud output | ||
dense_publish_en: true # false: low down the points number in a global-frame point clouds scan. | ||
scan_bodyframe_pub_en: true # true: output the point cloud scans in IMU-body-frame | ||
|
||
pcd_save: | ||
pcd_save_en: true | ||
interval: -1 # how many LiDAR frames saved in each pcd file; | ||
# -1 : all frames will be saved in ONE pcd file, may lead to memory crash when having too much frames. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
common: | ||
lid_topic: "/os_cloud_node/points" | ||
imu_topic: "/os_cloud_node/imu" | ||
time_sync_en: false # ONLY turn on when external time synchronization is really not possible | ||
time_offset_lidar_to_imu: 0.0 # Time offset between lidar and IMU calibrated by other algorithms, e.g. LI-Init (can be found in README). | ||
# This param will take effect no matter what time_sync_en is. So if the time offset is not known exactly, please set as 0.0 | ||
|
||
preprocess: | ||
lidar_type: 3 # 1 for Livox serials LiDAR, 2 for Velodyne LiDAR, 3 for ouster LiDAR, | ||
scan_line: 64 | ||
timestamp_unit: 3 # 0-second, 1-milisecond, 2-microsecond, 3-nanosecond. | ||
blind: 4 | ||
|
||
mapping: | ||
acc_cov: 0.1 | ||
gyr_cov: 0.1 | ||
b_acc_cov: 0.0001 | ||
b_gyr_cov: 0.0001 | ||
fov_degree: 180 | ||
det_range: 150.0 | ||
extrinsic_est_en: false # true: enable the online estimation of IMU-LiDAR extrinsic | ||
extrinsic_T: [ 0.0, 0.0, 0.0 ] | ||
extrinsic_R: [1, 0, 0, | ||
0, 1, 0, | ||
0, 0, 1] | ||
|
||
publish: | ||
path_en: false | ||
scan_publish_en: true # false: close all the point cloud output | ||
dense_publish_en: true # false: low down the points number in a global-frame point clouds scan. | ||
scan_bodyframe_pub_en: true # true: output the point cloud scans in IMU-body-frame | ||
|
||
pcd_save: | ||
pcd_save_en: true | ||
interval: -1 # how many LiDAR frames saved in each pcd file; | ||
# -1 : all frames will be saved in ONE pcd file, may lead to memory crash when having too much frames. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
common: | ||
#RS LiDar | ||
lid_topic: "/rslidar_points" | ||
imu_topic: "/imu/data" | ||
# lid_topic: "/rslidar_points1" | ||
# imu_topic: "/imu/data1" | ||
time_sync_en: false # ONLY turn on when external time synchronization is really not possible | ||
|
||
preprocess: | ||
lidar_type: 4 # 1 for Livox serials LiDAR, 2 for Velodyne LiDAR, 3 for ouster LiDAR, 4 RS | ||
scan_line: 32 | ||
scan_rate: 10 # only need to be set for velodyne, unit: Hz, | ||
blind: 4 | ||
|
||
mapping: | ||
acc_cov: 0.1 | ||
gyr_cov: 0.1 | ||
b_acc_cov: 0.0001 | ||
b_gyr_cov: 0.0001 | ||
fov_degree: 180 | ||
det_range: 100.0 | ||
extrinsic_est_en: true # true: enable the online estimation of IMU-LiDAR extrinsic, | ||
extrinsic_T: [ 0, 0, -0.1] | ||
extrinsic_R: [ 1, 0, 0, | ||
0, 1, 0, | ||
0, 0, 1] | ||
|
||
publish: | ||
path_en: true | ||
scan_publish_en: true # false: close all the point cloud output | ||
dense_publish_en: true # false: low down the points number in a global-frame point clouds scan. | ||
scan_bodyframe_pub_en: true # true: output the point cloud scans in IMU-body-frame | ||
|
||
pcd_save: | ||
pcd_save_en: false | ||
interval: 100 # how many LiDAR frames saved in each pcd file; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
common: | ||
lid_topic: "/velodyne_points" | ||
imu_topic: "/imu/data" | ||
time_sync_en: false # ONLY turn on when external time synchronization is really not possible | ||
time_offset_lidar_to_imu: 0.0 # Time offset between lidar and IMU calibrated by other algorithms, e.g. LI-Init (can be found in README). | ||
# This param will take effect no matter what time_sync_en is. So if the time offset is not known exactly, please set as 0.0 | ||
|
||
preprocess: | ||
lidar_type: 2 # 1 for Livox serials LiDAR, 2 for Velodyne LiDAR, 3 for ouster LiDAR, | ||
scan_line: 32 | ||
scan_rate: 10 # only need to be set for velodyne, unit: Hz, | ||
timestamp_unit: 2 # the unit of time/t field in the PointCloud2 rostopic: 0-second, 1-milisecond, 2-microsecond, 3-nanosecond. | ||
blind: 2 | ||
|
||
mapping: | ||
acc_cov: 0.1 | ||
gyr_cov: 0.1 | ||
b_acc_cov: 0.0001 | ||
b_gyr_cov: 0.0001 | ||
fov_degree: 180 | ||
det_range: 100.0 | ||
extrinsic_est_en: false # true: enable the online estimation of IMU-LiDAR extrinsic, | ||
extrinsic_T: [ 0, 0, 0.28] | ||
extrinsic_R: [ 1, 0, 0, | ||
0, 1, 0, | ||
0, 0, 1] | ||
|
||
publish: | ||
path_en: false | ||
scan_publish_en: true # false: close all the point cloud output | ||
dense_publish_en: true # false: low down the points number in a global-frame point clouds scan. | ||
scan_bodyframe_pub_en: true # true: output the point cloud scans in IMU-body-frame | ||
|
||
pcd_save: | ||
pcd_save_en: true | ||
interval: -1 # how many LiDAR frames saved in each pcd file; | ||
# -1 : all frames will be saved in ONE pcd file, may lead to memory crash when having too much frames. |
Oops, something went wrong.