Ubuntu18.04安装A-Loam保姆级教程
系统环境:Ubuntu18.04.6 LTS
1.A-Loam的安装前要求:
1.1 ROS安装:参考我的另一篇博客
Ubuntu18.04安装ROS-melodic保姆级教程_灬杨三岁灬的博客-CSDN博客还是那句话,有时候加了这行也不好使,我是疯狂试了20+次,最后打了一局游戏,回来就过了,这就得看网络看命了,不行就在网上搜搜终极大招(动手能力差的不建议)。有时候加了这行也不好使,我是疯狂试了10+次,出现3.3之后就能用了,这就得看网络看命了,不行就在网上搜搜终极大招(动手能力差的不建议)。多试几十次,不行几百次,换手机网络也是,多试几次,这东西很玄学,不一定哪次就过了。多试几十次,不行几百次,换手机网络也是,多试几次,这东西很玄学,不一定哪次就过了。1.1.设置sources.list。https://blog.csdn.net/qq_23473839/article/details/131719477https://blog.csdn.net/qq_23473839/article/details/131719477
1.2 PCL安装:
Ubuntu18.04安装PCL保姆级教程_灬杨三岁灬的博客-CSDN博客Ubuntu18.04安装PCL保姆级教程https://blog.csdn.net/qq_23473839/article/details/132128455?csdn_share_tail=%7B%22type%22%3A%22blog%22%2C%22rType%22%3A%22article%22%2C%22rId%22%3A%22132128455%22%2C%22source%22%3A%22qq_23473839%22%7Dhttps://blog.csdn.net/qq_23473839/article/details/132128455?csdn_share_tail=%7B%22type%22%3A%22blog%22%2C%22rType%22%3A%22article%22%2C%22rId%22%3A%22132128455%22%2C%22source%22%3A%22qq_23473839%22%7D1.3 Ceres Solver安装:
建议用ceres-solver-1.14.0版本,尝试ceres-solver-2.2.0、ceres-solver-2.1.0编译A-Loam报错,尝试修改CMakeLists.txt依旧报错,果断降级不要再试了!
wget ceres-solver.org/ceres-solver-1.14.0.tar.gz #下载1.14.0
# 安装依赖
# CMake
sudo apt-get install cmake
# google-glog + gflags
sudo apt-get install libgoogle-glog-dev libgflags-dev
# Use ATLAS for BLAS & LAPACK
sudo apt-get install libatlas-base-dev
# Eigen3
sudo apt-get install libeigen3-dev
# SuiteSparse (optional)
sudo apt-get install libsuitesparse-dev
# 正式安装
tar xvf ceres-solver-1.14.0.tar.gz
cd ceres-solver-1.14.0
mkdir build
cd build
cmake .. # 如果提示cmake版本不够,看1.4装一下新版cmake就行
make -j4
make test
# Optionally install Ceres, it can also be exported using CMake which
# allows Ceres to be used without requiring installation, see the documentation
# for the EXPORT_BUILD_DIR option for more information.
sudo make install # 这里一定要加sudo否则报错
# 测试一下
bin/simple_bundle_adjuster ../data/problem-16-22106-pre.txt
若结果出现上图则证明ceres安装成功。
卸载ceres命令:
sudo rm -r /usr/local/lib/cmake/Ceres
sudo rm -rf /usr/local/include/ceres /usr/local/lib/libceres.a
sudo rm -r /usr/local/share/Ceres
1.4 cmake升级:(上面没报错可不升级)
Ubuntu18.04安装Cmake教程_灬杨三岁灬的博客-CSDN博客文章浏览阅读267次。注:文件路径是可以指定的,一般选择在/opt或/usr路径下,这里选择/opt。如果已经安装了ROS等其他库,卸载会出现很多问题!_ubuntu18.04安装cmakehttps://blog.csdn.net/qq_23473839/article/details/132132907
2.安装:
2.1.建立catkin工作空间(我取名为A-LOAM)
2.2.建立src文件夹
2.3.编译
cd ~/A-LOAM/src
git clone https://github.com/HKUST-Aerial-Robotics/A-LOAM.git
cd ../
catkin_make
3.编译出现的问题:
3.1.ceres版本问题:
/usr/local/include/ceres/internal/integer_sequence_algorithm.h:67:21: error:
原因:ceres版本太高
解决办法:使用ceres1.14.0编译A-Loam即可
4.运行Loam:
Shell1:
source devel/setup.bash
roslaunch aloam_velodyne aloam_velodyne_VLP_16.launch
Shell2:(跑Loam的数据集)
rosbag play ~/Dataset/A-LOAM/nsh_indoor_outdoor.bag
Shell3:保存地图
用bag_to_pcd方法保存点云图
rosrun pcl_ros bag_to_pcd xxx.bag /laser_cloud_surround pcd
用pointcloud_to_pcd方法保存点云图
mkdir pcd
cd pcd
rosrun pcl_ros pointcloud_to_pcd input:=/laser_cloud_surround
运行结束,可以看到生成了一个pcd文件夹,将里面的文件按照修改时间排序,最新的就是最后的点云地图pcd文件。
结果:
看到别的博客上,这个工具可以将点云地图转换成二维栅格地图(暂时还没试,感兴趣的同学可以试试):
git clone -b develop https://github.com/Hinson-A/pcd2pgm_package