source ${HOME}/catkin_ws/devel/setup.bash
//如果你的shell是zsh,则用zsh替代bash
下载和运行2d安装包,第1句是下载离线包,第2句是安装
离线包下载 百度云盘 提取码:rwp7
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
下载和运行3d安装包,第1句是下载,第2句是安装
wget -P ~/Downloads https://storage.googleapis.com/cartographer-public-data/bags/backpack_3d/with_intensities/b3-2016-04-05-14-14-00.bag
roslaunch cartographer_ros demo_backpack_3d.launch bag_filename:=${HOME}/Downloads/b3-2016-04-05-14-14-00.bag
运行纯定位要用2个离线包数据,第一个包用来建图,第二个用来进行纯定位
[为什么?] 为啥叫纯定位,其实它就是纯粹只用来定位的,程序运行时只在局部建图(保留固定数量的子图),随着机器人的运动和观测,新的子图会添加进来,旧的子图会被删除,就是只保留局部的地图数据。然后你可能会问为什么只保留局部的地图数据?我的理解是保留局部数据越多,越多的数据与原有地图的数据进行回环检测就增多,这样会使计算量增加的同时也增加了误匹配的概率,使得整个系统不稳定,所以这里只进行定位,不用于建图(即地图的更新),然后你可能会问如何能在原有的地图上进行更新(因为很多环境是随时间变化的)?这个问题问得好,目前没有人在开源的代码上实现这个功能,但是我认为其实是不难的,只要告诉给机器人一个准确的初始位置(可以通过landmark((apriltag、二维码等强特征),或者激光特征,最后可能加上人为评判),按照更新地图的思路来就可以了(代码实现可能与建图稍有不同,建图是0到1的过程,更新地图是1到1的过程,工程上更新地图的计算量应该要小于建图)
下载2d离线包
wget -P ~/Downloads https://storage.googleapis.com/cartographer-public-data/bags/backpack_2d/b2-2016-04-05-14-44-52.bag
wget -P ~/Downloads https://storage.googleapis.com/cartographer-public-data/bags/backpack_2d/b2-2016-04-27-12-31-41.bag
第一句生成地图,第二句运行重定位
roslaunch cartographer_ros offline_backpack_2d.launch bag_filenames:=${HOME}/Downloads/b2-2016-04-05-14-44-52.bag
roslaunch cartographer_ros demo_backpack_2d_localization.launch \
load_state_filename:=${HOME}/Downloads/b2-2016-04-05-14-44-52.bag.pbstream \
bag_filename:=${HOME}/Downloads/b2-2016-04-27-12-31-41.bag
load_state_filename是第一个包生成的地图数据,地图格式是pbstream
bag_filename是第二个离线包的名字
下载3d离线包
wget -P ~/Downloads https://storage.googleapis.com/cartographer-public-data/bags/backpack_3d/b3-2016-04-05-13-54-42.bag
wget -P ~/Downloads https://storage.googleapis.com/cartographer-public-data/bags/backpack_3d/b3-2016-04-05-15-52-20.bag
第一句生成地图,第二句运行重定位
roslaunch cartographer_ros offline_backpack_3d.launch bag_filenames:=${HOME}/Downloads/b3-2016-04-05-13-54-42.bag
roslaunch cartographer_ros demo_backpack_3d_localization.launch \
load_state_filename:=${HOME}/Downloads/b3-2016-04-05-13-54-42.bag.pbstream \
bag_filename:=${HOME}/Downloads/b3-2016-04-05-15-52-20.bag
第一句下载离线包,第二句运行离线包
# Download the landmarks example bag.
wget -P ~/Downloads https://storage.googleapis.com/cartographer-public-data/bags/mir/landmarks_demo_uncalibrated.bag
# Launch the landmarks demo.
roslaunch cartographer_mir offline_mir_100_rviz.launch bag_filename:=${HOME}/Downloads/landmarks_demo_uncalibrated.bag
注意:运行这个包有些问题,部分热心网友已经耐心解答,具体如下:
知乎地址:Cartographer源码阅读之附件2——带Landmark的demo运行和测试
祝大家跑demo顺利。
[为什么?] landmark是什么?landmark是路标点,为什么叫static landmark?因为这个路标是静止的,不动的。一根消防柱可以是static landmark,因为它在环境中是不动的,为什么是不动的呢?不动有什么好处?static landmark的作用是用于快速定位的(我认为),不动的好处是下次再次观测到这个landmark我们就可以知道自己(机器人)在当前环境中的位置了,就好比我此刻用手机拍了一张泰山石刻“五岳独尊”的照片给你(一个大的landmark),不用说,你肯定知道我在泰山上无疑了(快速定位我的位置)
就是有个低成本的激光雷达叫Revo,用它的数据跑SLAM
如下:
wget -P ~/Downloads https://storage.googleapis.com/cartographer-public-data/bags/revo_lds/cartographer_paper_revo_lds.bag
roslaunch cartographer_ros demo_revo_lds.launch bag_filename:=${HOME}/Downloads/cartographer_paper_revo_lds.bag
有个人型机器人叫PR2,前几年很出名,用它的硬件采集的数据跑SLAM
wget -P ~/Downloads https://storage.googleapis.com/cartographer-public-data/bags/pr2/2011-09-15-08-32-46.bag
roslaunch cartographer_ros demo_pr2.launch bag_filename:=${HOME}/Downloads/2011-09-15-08-32-46.bag
有个可以远程控制的机器人,好像是用于消防的,具体没仔细看,用它的硬件采集的数据跑SLAM
wget -P ~/Downloads https://storage.googleapis.com/cartographer-public-data/bags/taurob_tracker/taurob_tracker_simulation.bag
roslaunch cartographer_ros demo_taurob_tracker.launch bag_filename:=${HOME}/Downloads/taurob_tracker_simulation.bag