-
Notifications
You must be signed in to change notification settings - Fork 80
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: 🎸 initial commit: forked by gisbi-kim/FAST_LIO_SLAM and add liv…
…ox_ros_driver
- Loading branch information
0 parents
commit c904a8e
Showing
240 changed files
with
61,833 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,9 @@ | ||
build | ||
FAST-LIO/Log/*.png | ||
FAST-LIO/Log/*.txt | ||
FAST-LIO/Log/*.csv | ||
FAST-LIO/Log/*.pdf | ||
.vscode/c_cpp_properties.json | ||
.vscode/settings.json | ||
PCD/*.pcd | ||
*.pyc |
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,4 @@ | ||
[submodule "include/ikd-Tree"] | ||
path = include/ikd-Tree | ||
url = https://github.com/hku-mars/ikd-Tree.git | ||
branch = 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,89 @@ | ||
cmake_minimum_required(VERSION 2.8.3) | ||
project(fast_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(PythonLibs REQUIRED) | ||
find_path(MATPLOTLIB_CPP_INCLUDE_DIRS "matplotlibcpp.h") | ||
|
||
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) | ||
|
||
message(Eigen: ${EIGEN3_INCLUDE_DIR}) | ||
|
||
include_directories( | ||
${catkin_INCLUDE_DIRS} | ||
${EIGEN3_INCLUDE_DIR} | ||
${PCL_INCLUDE_DIRS} | ||
${PYTHON_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}) | ||
target_include_directories(fastlio_mapping PRIVATE ${PYTHON_INCLUDE_DIRS}) |
Large diffs are not rendered by default.
Oops, something went wrong.
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,135 @@ | ||
clear | ||
close all | ||
|
||
Color_red = [0.6350 0.0780 0.1840]; | ||
Color_blue = [0 0.4470 0.7410]; | ||
Color_orange = [0.8500 0.3250 0.0980]; | ||
Color_green = [0.4660 0.6740 0.1880]; | ||
Color_lightblue = [0.3010 0.7450 0.9330]; | ||
Color_purple = [0.4940 0.1840 0.5560]; | ||
Color_yellow = [0.9290 0.6940 0.1250]; | ||
|
||
fast_lio_ikdtree = csvread("./fast_lio_time_log.csv",1,0); | ||
timestamp_ikd = fast_lio_ikdtree(:,1); | ||
timestamp_ikd = timestamp_ikd - min(timestamp_ikd); | ||
total_time_ikd = fast_lio_ikdtree(:,2)*1e3; | ||
scan_num = fast_lio_ikdtree(:,3); | ||
incremental_time_ikd = fast_lio_ikdtree(:,4)*1e3; | ||
search_time_ikd = fast_lio_ikdtree(:,5)*1e3; | ||
delete_size_ikd = fast_lio_ikdtree(:,6); | ||
delete_time_ikd = fast_lio_ikdtree(:,7) * 1e3; | ||
tree_size_ikd_st = fast_lio_ikdtree(:,8); | ||
tree_size_ikd = fast_lio_ikdtree(:,9); | ||
add_points = fast_lio_ikdtree(:,10); | ||
|
||
fast_lio_forest = csvread("fast_lio_time_log.csv",1,0); | ||
fov_check_time_forest = fast_lio_forest(:,5)*1e3; | ||
average_time_forest = fast_lio_forest(:,2)*1e3; | ||
total_time_forest = fast_lio_forest(:,6)*1e3; | ||
incremental_time_forest = fast_lio_forest(:,3)*1e3; | ||
search_time_forest = fast_lio_forest(:,4)*1e3; | ||
timestamp_forest = fast_lio_forest(:,1); | ||
|
||
% Use slide window to calculate average | ||
L = 1; % Length of slide window | ||
for i = 1:length(timestamp_ikd) | ||
if (i<L) | ||
average_time_ikd(i) = mean(total_time_ikd(1:i)); | ||
else | ||
average_time_ikd(i) = mean(total_time_ikd(i-L+1:i)); | ||
end | ||
end | ||
for i = 1:length(timestamp_forest) | ||
if (i<L) | ||
average_time_forest(i) = mean(total_time_forest(1:i)); | ||
else | ||
average_time_forest(i) = mean(total_time_forest(i-L+1:i)); | ||
end | ||
end | ||
|
||
|
||
|
||
|
||
f = figure; | ||
set(gcf,'Position',[80 433 600 640]) | ||
tiled_handler = tiledlayout(3,1); | ||
tiled_handler.TileSpacing = 'compact'; | ||
tiled_handler.Padding = 'compact'; | ||
nexttile; | ||
hold on; | ||
set(gca,'FontSize',12,'FontName','Times New Roman') | ||
plot(timestamp_ikd, average_time_ikd,'-','Color',Color_blue,'LineWidth',1.2); | ||
plot(timestamp_forest, average_time_forest,'--','Color',Color_orange,'LineWidth',1.2); | ||
lg = legend("ikd-Tree", "ikd-Forest",'location',[0.1314 0.8559 0.2650 0.0789],'fontsize',14,'fontname','Times New Roman') | ||
title("Time Performance on FAST-LIO",'FontSize',16,'FontName','Times New Roman') | ||
xlabel("time/s",'FontSize',16,'FontName','Times New Roman') | ||
yl = ylabel("Run Time/ms",'FontSize',15,'Position',[285.7 5.5000 -1]); | ||
xlim([32,390]); | ||
ylim([0,23]); | ||
ax1 = gca; | ||
ax1.YAxis.FontSize = 12; | ||
ax1.XAxis.FontSize = 12; | ||
grid on | ||
box on | ||
% print('./Figures/fastlio_exp_average','-depsc','-r600') | ||
|
||
|
||
index_ikd = find(search_time_ikd > 0); | ||
search_time_ikd = search_time_ikd(index_ikd); | ||
index_forest = find(search_time_forest > 0); | ||
search_time_forest = search_time_forest(index_forest); | ||
|
||
t = nexttile; | ||
hold on; | ||
boxplot_data_ikd = [incremental_time_ikd,total_time_ikd]; | ||
boxplot_data_forest = [incremental_time_forest,total_time_forest]; | ||
Colors_ikd = [Color_blue;Color_blue;Color_blue]; | ||
Colors_forest = [Color_orange;Color_orange;Color_orange]; | ||
% xticks([3,8,13]) | ||
h_search_ikd = boxplot(search_time_ikd,'Whisker',50,'Positions',1,'Colors',Color_blue,'Widths',0.3); | ||
h_search_forest = boxplot(search_time_forest,'Whisker',50,'Positions',1.5,'Colors',Color_orange,'Widths',0.3); | ||
h_ikd = boxplot(boxplot_data_ikd,'Whisker',50,'Positions',[3,5],'Colors',Color_blue,'Widths',0.3); | ||
h_forest = boxplot(boxplot_data_forest,'Whisker',50,'Positions',[3.5,5.5],'Colors',Color_orange,'Widths',0.3); | ||
ax2 = gca; | ||
ax2.YAxis.Scale = 'log'; | ||
xlim([0.5,6.0]) | ||
ylim([0.0008,100]) | ||
xticks([1.25 3.25 5.25]) | ||
xticklabels({'Nearest Search',' Incremental Updates','Total Time'}); | ||
yticks([1e-3,1e-2,1e-1,1e0,1e1,1e2]) | ||
ax2.YAxis.FontSize = 12; | ||
ax2.XAxis.FontSize = 14.5; | ||
% ax.XAxis.FontWeight = 'bold'; | ||
ylabel('Run Time/ms','FontSize',14,'FontName','Times New Roman') | ||
box_vars = [findall(h_search_ikd,'Tag','Box');findall(h_ikd,'Tag','Box');findall(h_search_forest,'Tag','Box');findall(h_forest,'Tag','Box')]; | ||
for j=1:length(box_vars) | ||
if (j<=3) | ||
Color = Color_blue; | ||
else | ||
Color = Color_orange; | ||
end | ||
patch(get(box_vars(j),'XData'),get(box_vars(j),'YData'),Color,'FaceAlpha',0.25,'EdgeColor',Color); | ||
end | ||
Lg = legend(box_vars([1,4]), {'ikd-Tree','ikd-Forest'},'Location',[0.6707 0.4305 0.265 0.07891],'fontsize',14,'fontname','Times New Roman'); | ||
grid on | ||
set(gca,'YMinorGrid','off') | ||
nexttile; | ||
hold on; | ||
grid on; | ||
box on; | ||
set(gca,'FontSize',12,'FontName','Times New Roman') | ||
plot(timestamp_ikd, alpha_bal_ikd,'-','Color',Color_blue,'LineWidth',1.2); | ||
plot(timestamp_ikd, alpha_del_ikd,'--','Color',Color_orange, 'LineWidth', 1.2); | ||
plot(timestamp_ikd, 0.6*ones(size(alpha_bal_ikd)), ':','Color','black','LineWidth',1.2); | ||
lg = legend("\alpha_{bal}", "\alpha_{del}",'location',[0.7871 0.1131 0.1433 0.069],'fontsize',14,'fontname','Times New Roman') | ||
title("Re-balancing Criterion",'FontSize',16,'FontName','Times New Roman') | ||
xlabel("time/s",'FontSize',16,'FontName','Times New Roman') | ||
yl = ylabel("\alpha",'FontSize',15, 'Position',[285.7 0.4250 -1]) | ||
xlim([32,390]); | ||
ylim([0,0.85]); | ||
ax3 = gca; | ||
ax3.YAxis.FontSize = 12; | ||
ax3.XAxis.FontSize = 12; | ||
% print('./Figures/fastlio_exp_combine','-depsc','-r1200') | ||
% exportgraphics(f,'./Figures/fastlio_exp_combine_1.pdf','ContentType','vector') | ||
|
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 @@ | ||
Here saved the debug records which can be drew by the ../Log/plot.py. The record function can be found frm the MACRO: DEBUG_FILE_DIR(name) in common_lib.h. |
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,94 @@ | ||
# import matplotlib | ||
# matplotlib.use('Agg') | ||
import numpy as np | ||
import matplotlib.pyplot as plt | ||
|
||
|
||
#######for ikfom | ||
fig, axs = plt.subplots(4,2) | ||
lab_pre = ['', 'pre-x', 'pre-y', 'pre-z'] | ||
lab_out = ['', 'out-x', 'out-y', 'out-z'] | ||
plot_ind = range(7,10) | ||
a_pre=np.loadtxt('mat_pre.txt') | ||
a_out=np.loadtxt('mat_out.txt') | ||
time=a_pre[:,0] | ||
axs[0,0].set_title('Attitude') | ||
axs[1,0].set_title('Translation') | ||
axs[2,0].set_title('Extrins-R') | ||
axs[3,0].set_title('Extrins-T') | ||
axs[0,1].set_title('Velocity') | ||
axs[1,1].set_title('bg') | ||
axs[2,1].set_title('ba') | ||
axs[3,1].set_title('Gravity') | ||
for i in range(1,4): | ||
for j in range(8): | ||
axs[j%4, j/4].plot(time, a_pre[:,i+j*3],'.-', label=lab_pre[i]) | ||
axs[j%4, j/4].plot(time, a_out[:,i+j*3],'.-', label=lab_out[i]) | ||
for j in range(8): | ||
# axs[j].set_xlim(386,389) | ||
axs[j%4, j/4].grid() | ||
axs[j%4, j/4].legend() | ||
plt.grid() | ||
#######for ikfom####### | ||
|
||
|
||
#### Draw IMU data | ||
fig, axs = plt.subplots(2) | ||
imu=np.loadtxt('imu.txt') | ||
time=imu[:,0] | ||
axs[0].set_title('Gyroscope') | ||
axs[1].set_title('Accelerameter') | ||
lab_1 = ['gyr-x', 'gyr-y', 'gyr-z'] | ||
lab_2 = ['acc-x', 'acc-y', 'acc-z'] | ||
for i in range(3): | ||
# if i==1: | ||
axs[0].plot(time, imu[:,i+1],'.-', label=lab_1[i]) | ||
axs[1].plot(time, imu[:,i+4],'.-', label=lab_2[i]) | ||
for i in range(2): | ||
# axs[i].set_xlim(386,389) | ||
axs[i].grid() | ||
axs[i].legend() | ||
plt.grid() | ||
|
||
# #### Draw time calculation | ||
# plt.figure(3) | ||
# fig = plt.figure() | ||
# font1 = {'family' : 'Times New Roman', | ||
# 'weight' : 'normal', | ||
# 'size' : 12, | ||
# } | ||
# c="red" | ||
# a_out1=np.loadtxt('Log/mat_out_time_indoor1.txt') | ||
# a_out2=np.loadtxt('Log/mat_out_time_indoor2.txt') | ||
# a_out3=np.loadtxt('Log/mat_out_time_outdoor.txt') | ||
# # n = a_out[:,1].size | ||
# # time_mean = a_out[:,1].mean() | ||
# # time_se = a_out[:,1].std() / np.sqrt(n) | ||
# # time_err = a_out[:,1] - time_mean | ||
# # feat_mean = a_out[:,2].mean() | ||
# # feat_err = a_out[:,2] - feat_mean | ||
# # feat_se = a_out[:,2].std() / np.sqrt(n) | ||
# ax1 = fig.add_subplot(111) | ||
# ax1.set_ylabel('Effective Feature Numbers',font1) | ||
# ax1.boxplot(a_out1[:,2], showfliers=False, positions=[0.9]) | ||
# ax1.boxplot(a_out2[:,2], showfliers=False, positions=[1.9]) | ||
# ax1.boxplot(a_out3[:,2], showfliers=False, positions=[2.9]) | ||
# ax1.set_ylim([0, 3000]) | ||
|
||
# ax2 = ax1.twinx() | ||
# ax2.spines['right'].set_color('red') | ||
# ax2.set_ylabel('Compute Time (ms)',font1) | ||
# ax2.yaxis.label.set_color('red') | ||
# ax2.tick_params(axis='y', colors='red') | ||
# ax2.boxplot(a_out1[:,1]*1000, showfliers=False, positions=[1.1],boxprops=dict(color=c),capprops=dict(color=c),whiskerprops=dict(color=c)) | ||
# ax2.boxplot(a_out2[:,1]*1000, showfliers=False, positions=[2.1],boxprops=dict(color=c),capprops=dict(color=c),whiskerprops=dict(color=c)) | ||
# ax2.boxplot(a_out3[:,1]*1000, showfliers=False, positions=[3.1],boxprops=dict(color=c),capprops=dict(color=c),whiskerprops=dict(color=c)) | ||
# ax2.set_xlim([0.5, 3.5]) | ||
# ax2.set_ylim([0, 100]) | ||
|
||
# plt.xticks([1,2,3], ('Outdoor Scene', 'Indoor Scene 1', 'Indoor Scene 2')) | ||
# # # print(time_se) | ||
# # # print(a_out3[:,2]) | ||
# plt.grid() | ||
# plt.savefig("time.pdf", dpi=1200) | ||
plt.show() |
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 @@ | ||
1 |
Oops, something went wrong.