安装依赖
ROS(默认应该已经安装了叭
gtsam
```c
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
```
这是官方给出的方法,但是你如果不太幸运,就会像我一样
一直一直连接不上,于是
```c
git clone https://bitbucket.org/gtborg/gtsam.git
cd gtsam
mkdir build
cd build
cmake ..
sudo make install
```
运行成功之后就可以开始LeGO-LOAM的编译和运行了!
LeGO-LOAM编译
cd ~/catkin_ws/src
git clone https://github.com/RobustFieldAutonomyLab/LeGO-LOAM.git
cd ..
catkin_make -j1
第一次编译代码时,需要在“catkin_make”后面添加“-j1”,以生成一些消息类型。之后的编译不再需要。
LeGO-LOAM运行
//1.运行launch文件
roslaunch lego_loam run.launch
//2.播放数据包
rosbag play *.bag --clock --topic /velodyne_points /imu/data
而我是需要测试KITTI数据集,所以需要先修改utility.h文件。文件中给出了一些Lidar型号的参数,KITTI数据集使用的是HDL-64E雷达,对应的配置文件参数为:
extern const int N_SCAN = 64;
extern const int Horizon_SCAN = 2083;
extern const float ang_res_x = 360.0/float(Horizon_SCAN);
extern const float ang_res_y = 26.8/float(N_SCAN-1);
extern const float ang_bottom = 24.8;
extern const int groundScanInd = 55;
同时要按照自己的数据包的topic更改文件53,54行的点云topic和imu的topic。还需要修改60行的useCloudRing参数为false,否则你就会遇到这样的bug:
Point cloud is not in dense format, please remove NaN points first!
运行结果(好像哪里不对?????):
KITTI的轨迹好像有点问题,具体解决方法看我之后的博客叭TAT