(一)运行环境:
- ubuntu18.04
- ROS——>melodic
(二)复现过程:
-
通过github了解LeGo-LOAM-BOR是什么,github链接
-
在ubuntu中安装依赖库
wget -O ~/Downloads/gtsam.zip https://github.com/borglab/gtsam/archive/4.0.0-alpha2.zip cd ~/Downloads/ && unzip gtsam.zip -d ~/Downloads/ cd ~/Downloads/gtsam-4.0.0-alpha2/ mkdir build && cd build cmake .. sudo make install
具体操作:打开终端,分别直接运行以上命令行,下载后的文件在Downloads文件夹下,下载的文件是gtsam-4.0.0-alpha2
-
下载编译LeGo-LOAM-BOR包
cd ~/catkin_ws/src git clone https://github.com/facontidavide/LeGO-LOAM-BOR.git cd .. catkin_make
具体操作:直接打开终端,运行以上命令,下载编译的包在catkin_ws/src文件夹下,然后新建一个dataset文件夹。
注意:编译过程中可能出现问题,下面我遇到的问题,和解决方案。遇到问题: If you got the following error: Errors << lidar_imu_calib:make /home/he/catkin_ws/logs/lidar_imu_calib/build.make.003.log In file included from /home/he/catkin_ws/src/lidar_imu_calib/include/calibExRLidar2Imu.h:16:0, from /home/he/catkin_ws/src/lidar_imu_calib/src/lib/calibExRLidar2Imu.cpp:1: /usr/include/lz4.h:196:57: error: conflicting declaration ‘typedef struct LZ4_stream_t LZ4_stream_t’ typedef struct { long long table[LZ4_STREAMSIZE_U64]; } LZ4_stream_t; In file included from /home/he/catkin_ws/src/lidar_imu_calib/include/calibExRLidar2Imu.h:16:0, from /home/he/catkin_ws/src/lidar_imu_calib/src/lib/calibExRLidar2Imu.cpp:1: /usr/include/lz4.h:249:72: error: conflicting declaration ‘typedef struct LZ4_streamDecode_t LZ4_streamDecode_t’ typedef struct { unsigned long long table[LZ4_STREAMDECODESIZE_U64]; } LZ4_streamDecode_t;
解决方案 sudo mv /usr/include/flann/ext/lz4.h /usr/include/flann/ext/lz4.h.bak sudo mv /usr/include/flann/ext/lz4hc.h /usr/include/flann/ext/lz4.h.bak sudo ln -s /usr/include/lz4.h /usr/include/flann/ext/lz4.h sudo ln -s /usr/include/lz4hc.h /usr/include/flann/ext/lz4hc.h
-
下载rosbag包,放刚刚新建的dataset文件夹中
nsh_indoor_outdoor.bag,提取码:2rkd -
开始复现
(1)在catkin_ws文件夹下打开终端,运行roscoreroscore
(2)在catkin_ws文件夹下在打开一个新终端,运行下面命令,同时会打开Rviz
roslaunch lego_loam_bor run.launch lidar_topic:=/velodyne_points imu_topic:=/imu/data
(3)在dataset文件夹下新打开一个终端,运行下面命令,同时会在Rviz上显示点云rosbag play --clock nsh_indoor_outdoor.bag
(4)遇到的问题遇到问题: error while loading shared libraries: libxxx.so: cannot open shared object file
解决方案: 原因在于: libmetis-gtsam.so这个文件位于路径“/usr/local/lib” 中,而程序默认找的位置是路径“/usr/lib”,所以没有找到,看了很多方法,还挺麻烦的,所以自己想出来一种方法——把文件复制过去。 具体操作就是在打开终端,运行 sudo cp /usr/local/lib/libxxx.so usr/lib
(三)ROS学习总结:
- 了解怎样查看ROS版本
终端1:roscore 终端2:rosparam get /rosdistro
- 了解Rviz最基本操作
鼠标左键:旋转地图
鼠标滚轮:放大缩小地图
按住滚轮:平移地图