在自己小车上部署LIO-SAM和LVI-SAM,简单记录一下经历,经历了十多天的终于将LIO-SAM和LVI-SAM两个算法的实测工作基本完成,期间遇到了一些问题,尤其是自己的设备上,遇到的运行问题网上也很少见,也很少有从算法的编译到实测部署全过程,因此自己的经历在此记录,也是帮助自己进行梳理,有不正确的地方还请大佬们批评指正,进行讨论交流!!
一、LIO-SAM与LVI-SAM论文与源码地址
LIO-SAM与LVI-SAM这里不做过多介绍,直接给出论文与源码地址!
LIO-SAM论文链接:LIhttps://github.com/TixiaoShan/LIO-SAM/blob/master/config/doc/paper.pdf
LIO-SAM源码链接:
LVI-SAM论文链接:https://arxiv.org/abs/2007.00258
LVI-SAM源码链接:https://github.com/TixiaoShan/LVI-SAM.git
二、环境配置
ubuntu18.04+ROS melodic+gtsam4.0.2+ceres1.14.0
1.虽然保姆级教程安装Ubuntu18.04安装就不做介绍了,哈哈哈!
2.ROS melodic可以使用鱼香ROS安装,轻松加愉快!我只能说非常的哇塞,分分钟完成,链接如下:
ros安装(一键最简安装,吹爆鱼香ROS,请叫我鱼吹)-CSDN博客
(ps:若要源码安装参考第一篇博客,但是坑较多,不建议使用)
3.gtsam4.0.2安装
地址:https://github.com/borglab/gtsam/archive/4.0.2.zip
mkdir ~/Downloads
//解压到该文件下,gtsam4.0.2文件
cd ~/Downloads/gtsam-4.0.2/
mkdir build && cd build
cmake -DGTSAM_BUILD_WITH_MARCH_NATIVE=OFF ..
sudo make install -j8
(ps:也可以直接克隆,但我一般就直接下载,,这一步基本上没有错误!)
4.ceres1.14.0安装
这个优化库在LVI-SAM中用到,如果只运行LIO-SAM可以不用安装。
sudo apt-get install -y libgoogle-glog-dev //安装依赖
sudo apt-get install -y libatlas-base-dev //安装依赖
下载ceres1.14.0: https://github.com/ceres-solver/ceres-solver/archive/1.14.0.zip
解压到:Downloads
cd ~/Downloads/ceres-solver-1.14.0
mkdir ceres-bin && cd ceres-bin
cmake .. //编译
sudo make install -j4 //安装
ps:安装完成后, /usr/local/include/ceres 下找到Ceres的头文件,并在 /usr/local/lib/ 下找到名为libceres.a的库文件,表示安装成功了!!接下来可以安装LIO-SAM和LVI-SAM了
三、运行LIO-SAM
1.创建好工作空间catkin_lio_ws,将lio-sam源码下载到catkin_lio_ws/src目录下编译
mkdir -p ~/catkin_lio_ws/src
cd ~/catkin_ws/src
git clone https://github.com/TixiaoShan/LIO-SAM.git
cd ..
catkin_make
2.数据集下载
https://drive.google.com/drive/folders/1gJHwfdHCRdjP7vuT556pv8atqrCJPbUq?usp=sharing
ps:需要梯子!
如果不使用数据集测试,也可使用上交殷杰的M2DGR数据集测试,只需要将LIO-SAM-master/config/params.yaml修改为该数据集中的话题、IMU参数、激光雷达与IMU的外参,M2DGR数据集官网已给出,地址为:GitHub – SJTU-ViSYS/M2DGR: M2DGR: a Multi-modal and Multi-scenario Dataset for Ground Robots
3.运行
source devel/setup.bash
roslaunch lio_sam run.launch
此处可能会报错
[lio_sam_imuPreintegration-2] process has died [pid 1671, exit code 127, cmd /home/shuai/subject/catkin_lio_ws/devel/lib/lio_sam/lio_sam_imuPreintegration __name:=lio_sam_imuPreintegration __log:=/home/shuai/.ros/log/635269ee-46bc-11ed-a61b-1c697af31044/lio_sam_imuPreintegration-2.log].
[lio_sam_mapOptmization-5] process has died [pid 1672, exit code 127, cmd /home/shuai/subject/catkin_lio_ws/devel/lib/lio_sam/lio_sam_mapOptmization __name:=lio_sam_mapOptmization __log:=/home/shuai/.ros/log/635269ee-46bc-11ed-a61b-1c697af31044/lio_sam_mapOptmization-5.log].
原因是因为没有找到安装的库文件,所以将 /usr/local/lib 目录中libmetis.so添加到/opt/ros/melodic/lib/。解决方法:
cd /usr/local/lib/
sudo cp libmetis.so /opt/ros/melodic/lib/ //将库文件复制到 ROS下的库文件中
在此执行:
source devel/setup.bash
roslaunch lio_sam run.launch
成功运行,画面如下:
4.播放bag包。
rosbag play XXXXX.bag
PS:该数据bag包的话题一定与yaml文件中对应,不然运行失败!
我是运行的M2DGR数据集,效果如上图,感觉还不错!
四、运行LVI-SAM
mkdir -p ~/catkin_lvi_ws/src
cd ~/catkin_lvi_ws/src
git clone https://github.com/TixiaoShan/LVI-SAM.git
cd ..
catkin_make
数据集下载,同LIO-SAM
https://drive.google.com/drive/folders/1q2NZnsgNmezFemoxhHnrDnp1JV_bqrgV?usp=sharinghttps://drive.google.com/drive/folders/1q2NZnsgNmezFemoxhHnrDnp1JV_bqrgV?usp=sharing
source devel/setup.bash
roslaunch lio_sam run.launch
rosbag play XXXXX.bag //播放包
若有报错:
[mapOptmization-7] process has died [pid 14493, exit code 127, cmd
/home/zard/catkin_ws/devel/lib/lego_loam/mapOptmization __name:=mapOptmization __log:
=/home/zard/.ros/log/922c7a94-0354-11ed-951b-8d0be314719f/mapOptmization-7.log].
杀死了进程!
解决办法:
通过安装libparmetis-dev修复它重新运行即可:
sudo apt-get install libparmetis-dev
以上两个算法跑通并不复杂,今天先写那么多,下次写硬件部署小车,激光雷达与IMU标定、相机与IMU标定、LIO-SAM和LVI-SAM实测 !
文章出处登录后可见!