使用Velodyne 16线激光雷达跑SLAM- cartographer算法(包括常见报错)
2016年10月5日,谷歌宣布开放一个名为cartographer在二维或三维条件下,开发人员可以利用该库实现机器人的定位和建图功能。cartograhper在计算资源有限的情况下,实时获得相对较高精度的2D地图。考虑到基于模拟策略的粒子滤波方法对内存和计算资源的需求较高,cartographer基于图网的优化方法。目前cartographer主要基于激光雷达SLAM,谷歌希望通过后续的开发和社区贡献,支持更多的传感器和机器人平台,并不断增加新的功能。 cartographer功能包 cartographer功能包已与ROS目前已提供二进制安装包,这次采用源码编译的方式进行安装。最好不要与现有功能包发生冲突cartographer在这里,我们创造了一个新的工作空间catkin_google_ws,然后下载源代码并完成编译。
1.安装相应的工具
sudo apt-get update sudo apt-get install -y python-wstool python-rosdep ninja-build
2.初始化工作空间
cd catkin_google_ws wstool init src
3.加入cartographer_ros.rosinstall并更新依赖
wstool merge -t src http://raw.githubusercontent.com/googlecartographer/cartographer_ ros/master/cartographer_ros.rosinstall
wstool update -t src
4.依赖和下载安装cartographer相关功能包 命令如下:
rosdep update rosdep install ——from-paths src ——ignore-src ——rosdistro=${ROS_DISTRO} -y
(这里执行上述代码可能类似于报告ROS如果是这样的错误,试着执行下面的命令)
rosdep install --from-paths src --ignore-src -r -y catkin_make_isolated --cmake-args -DROBOTRACONTEUR_ROS=1
5.编译安装
catkin_make_isolated ——install ——use-ninja source install_isolated/setup.bash
可以报告编译过程absl以下方法可以解决错误:
sudo apt-get install stow sudo chmod x ~/catkin_google_ws/src/cartographer/scripts/install_abseil.sh cd ~/catkin_google_ws/src/cartographer/scripts ./install_abseil.sh
请注意,我的工作空间文件名是catkin_google_ws,要替换成你们创建的工作空间名。
6.下载Google提供的demo并运行感受(400左右)m)
wget -P ~/Downloads https://storage.googleapis.com/cartographer-public-data/bags/backpack_2d/cartographer_paper_deutsches_museum.bag
roslaunch cartographer_ros demo_backpack_2d.launch bag_filename:=${HOME}/Downloads/cartographer_paper_deutsches_museum.bag
安装完cartographer以上操作后demo,如果出现以下错误,可能是包的地址不对,建议检查包的地址
[FATAL] [1590630448.926035157]: Error opening file: /home/sundong/sundong/Exploring/cartographer/bag/cartographer_paper_deutsches_musm.bag [ INFO] [1590630448.998609889]: I0528 09:47:28.000000 12045 submaps.cc:176] Added submap 1 [playbag-5] process has died [pid 12055, exit code 1, cmd /opt/ros/kinetic/lib/rosbag/play --clock /home/sundong/sundong/Exploring/cartographer/bag/cartographer_paper_deutsches_musm.bag __name:=playbag __log:=/home/sundong/.ros/log/2fcbad18-a085-11ea-83d1-90cdb648c685/playbag-5.log]. log file: /home/sundong/.ros/log/2fcbad18-a085-11ea-83d1-90cdb648c685/playbag-5*.log