文/冷冬寒梅
下面即為具體步驟
(一)安裝cartographer_ros
1)首先安裝wstool和rosdep工具
sudo apt-get update
sudo apt-getinstall -y python-wstool python-rosdep ninja-build
2)然后建立一個(gè)新的workspace
mkdir slam_ws
cd slam_ws
wstool init src
3)安裝cartographer_ros.rosinstall文件烁登,更新
wstool merge -t srchttps://raw.githubusercontent.com/googlecartographer/cartographer_ros/master/cartographer_ros.rosinstall
wstool update -t src
4)安裝deb依賴Installdeb dependencies.
rosdep update
rosdep install --from-paths src --ignore-src --rosdistro=${ROS_DISTRO} -y
5)安裝和設(shè)置路徑
catkin_make_isolated --install –use-ninja
(此處需要時(shí)間比較長衣洁,要耐心等待撒璧,我在運(yùn)行時(shí)候舟舒,以為此處進(jìn)行不下去了掠归,結(jié)果等的時(shí)間長些蒙畴,運(yùn)行成功)
source install_isolated/setup.bash 此語句設(shè)置路徑
(二)根據(jù)需要修改lua配置文件
launch文件如下
參數(shù)如下受楼,不使用odom转唉,只使用激光命迈,參數(shù)如下
每次修改了lua代碼都需要運(yùn)行下面代碼進(jìn)行編譯和設(shè)置路徑
cd slam_ws
catkin_make_isolated --install --use-ninja進(jìn)行編譯
source install_isolated/setup.bash設(shè)置路徑
運(yùn)行l(wèi)aunch文件
roslaunch cartographer_ros demo_backpack_2d.launch bag_filename:=/home/dmchen/slam_ws/src/cartographer_ros/cartographer_ros/bag/1014.bag
其中我們自己的數(shù)據(jù)包包1014.bag存儲(chǔ)路徑為/home/dmchen/slam_ws/src/cartographer_ros/cartographer_ros/bag
運(yùn)行結(jié)果
使用激光和odom數(shù)據(jù)贩绕,參數(shù)設(shè)置如下
注意需要運(yùn)行catkin_make_isolated--install –use-ninja編譯
運(yùn)行效果如下: