实测 ubuntu 20.04 编译LIO-SAM
【摘要】 LIO-SAM 在 ubuntu16.04 和 ubuntu18.04 编译都不麻烦。但是最近配置的工控机是 ubuntu20.04 的 安装的ROS版本的是noetic,在编译LIO-SAM中遇到了很多问题,在此记录并发布出来。 eigen3的问题在usr/local/include 中找不到 eigen3 ,因为它在 usr/include中,将其复制下 opencv 的问题In fil...
LIO-SAM 在 ubuntu16.04 和 ubuntu18.04 编译都不麻烦。
但是最近配置的工控机是 ubuntu20.04 的 安装的ROS版本的是noetic,在编译LIO-SAM中遇到了很多问题,在此记录并发布出来。
eigen3的问题
在usr/local/include 中找不到 eigen3 ,因为它在 usr/include中,将其复制下
opencv 的问题
In file included from /home/jone/jone_ws/src/LIO-SAM/src/featureExtraction.cpp:1:
/home/jone/jone_ws/src/LIO-SAM/include/utility.h:18:10: fatal error: opencv/cv.h: 没有那个文件或目录
18 | #include <opencv/cv.h>
| ^~~~~~~~~~~~~
In file included from /home/jone/jone_ws/src/LIO-SAM/src/mapOptmization.cpp:1:
/home/jone/jone_ws/src/LIO-SAM/include/utility.h:18:10: fatal error: opencv/cv.h: 没有那个文件或目录
18 | #include <opencv/cv.h>
| ^~~~~~~~~~~~~
In file included from /home/jone/jone_ws/src/LIO-SAM/src/imuPreintegration.cpp:1:
/home/jone/jone_ws/src/LIO-SAM/include/utility.h:18:10: fatal error: opencv/cv.h: 没有那个文件或目录
18 | #include <opencv/cv.h>
| ^~~~~~~~~~~~~
In file included from /home/jone/jone_ws/src/LIO-SAM/src/imageProjection.cpp:1:
/home/jone/jone_ws/src/LIO-SAM/include/utility.h:18:10: fatal error: opencv/cv.h: 没有那个文件或目录
18 | #include <opencv/cv.h>
| ^~~~~~~~~~~~~
compilation terminated.
compilation terminated.
compilation terminated.
compilation terminated.
由于 20.04 自带的是OpenCV4,所以要对 LIO-SAM 代码做一点改动
在 utility.h 中的
#include<opencv/cv.h>
改为
#include<opencv2/imgproc.hpp>
pcl的问题
pcl的问题主要是需要 C++14的编译
这里修改 lio-sam 的编译配置就行 ,打开 liosam的CMakeLists.txt:
将第5行的
set(CMAKE_CXX_FLAGS "-std=c++11")
改为
set(CMAKE_CXX_FLAGS "-std=c++14")
运行时的问题
process[lio_sam_mapOptmization-5]: started with pid [10295]
/home/jone/jone_ws/devel/lib/lio_sam/lio_sam_mapOptmization: error while loading shared libraries: libmetis.so: cannot open shared object file: No such file or directory
[lio_sam_imuPreintegration-2] process has died [pid 10294, exit code 127, cmd /home/jone/jone_ws/devel/lib/lio_sam/lio_sam_imuPreintegration __name:=lio_sam_imuPreintegration __log:=/home/jone/.ros/log/26ccf03a-2997-11ed-8e43-49590f7f8a53/lio_sam_imuPreintegration-2.log].
log file: /home/jone/.ros/log/26ccf03a-2997-11ed-8e43-49590f7f8a53/lio_sam_imuPreintegration-2*.log
[lio_sam_mapOptmization-5] process has died [pid 10295, exit code 127, cmd /home/jone/jone_ws/devel/lib/lio_sam/lio_sam_mapOptmization __name:=lio_sam_mapOptmization __log:=/home/jone/.ros/log/26ccf03a-2997-11ed-8e43-49590f7f8a53/lio_sam_mapOptmization-5.log].
log file: /home/jone/.ros/log/26ccf03a-2997-11ed-8e43-49590f7f8a53/lio_sam_mapOptmization-5*.log
报错找不到 libmetis.so 这个文件
这个和 gtsam 编译时候的 方法有关
实际问题是库文件libmetis.so 的位置。它是一个运行时库,但是当应用程序查找它时,它的位置不在预期的目录中。在通过运行命令sudo make install -j8安装库gtsam 时,文件libmetis.so安装在/usr/local/lib/的默认位置,但是当我们启动 ros 工作区时,运行时库查看位置/opt/ros/noetic/lib/
cd /usr/local/lib/
sudo cp libmetis.so /opt/ros/noetic/lib/
可以解决这个问题
再次运行
ERROR: cannot launch node of type [robot_localization/ekf_localization_node]: robot_localization
ROS path [0]=/opt/ros/noetic/share/ros
ROS path [1]=/home/jone/jone_ws/src
ROS path [2]=/opt/ros/noetic/share
ERROR: cannot launch node of type [robot_localization/navsat_transform_node]: robot_localization
ROS path [0]=/opt/ros/noetic/share/ros
ROS path [1]=/home/jone/jone_ws/src
ROS path [2]=/opt/ros/noetic/share
这个错位是少了 robot_localization 这个功能包
sudo apt-get install ros-noetic-fake-localization
sudo apt-get install ros-noetic-robot-localization
终于成功运行
将imu与雷达的外参进行配置
#extrinsicRot: [-1, 0, 0,
# 0, 1, 0,
# 0, 0, -1]
#extrinsicRPY: [0, -1, 0,
# 1, 0, 0,
# 0, 0, 1]
extrinsicRot: [0.999014, -0.0354845, 0.0266871,
0.035815, 0.999286, -0.0120079,
-0.026242, 0.0129519, 0.999572]
extrinsicRPY: [0.999014, -0.0354845, 0.0266871,
0.035815, 0.999286, -0.0120079,
-0.026242, 0.0129519, 0.999572]
pointCloudTopic: "/velodyne_points" # Point cloud data
imuTopic: "/imu" # IMU data
result
【版权声明】本文为华为云社区用户原创内容,转载时必须标注文章的来源(华为云社区)、文章链接、文章作者等基本信息, 否则作者和本社区有权追究责任。如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱:
cloudbbs@huaweicloud.com
- 点赞
- 收藏
- 关注作者
评论(0)