參照cartographer官方安裝流程:http://google-cartographer-ros.readthedocs.io/en/latest/index.html 。流程會依次安裝proto3、ceres-solver、cartographer和cartographer_ros。安裝過程需要根據實際情況(針對無法翻牆的環境)做少許修改,流程如下:
一、安裝wstool,rosdep,ninja等
1、sudo apt-get update
2、sudo apt-get install -y python-wstool python-rosdep ninja-build
二、創建cartographer的工作空間
3、mkdir catkin_ws
4、cd catkin_ws
5、wstool init src
三、下載ceres-solver、cartographer、cartographer_ros工程代碼。在此需要注意的一點是需要把ceres-solver的下載地址由google修改爲github。
6、到GitHub上的cartographer_ros目錄下下載cartographer_ros.rosinstall文件。
https://github.com/googlecartographer/cartographer_ros
7、修改文件內容:
- git: {local-name: ceres-solver, uri:'https://ceres-solver.googlesource.com/ceres-solver.git', version: '1.13.0'}
修改爲:
- git: {local-name: ceres-solver, uri:'https://github.com/ceres-solver/ceres-solver.git', version: '1.13.0'}
8、wstool merge -t src cartographer_ros.rosinstall
9、wstool update -t src
四、安裝proto3.
10、src/cartographer/scripts/install_proto3.sh
該腳本實際上是進行下載protobuf,編譯,安裝。
五、安裝deb依賴
11、sudo rosdep init
如果在安裝ros已經進行過初始化,可以備份後刪除/etc/ros/rosdep/sources.list.d/20-default.list再執行初始化
12、rosdep update
13、rosdep install --from-paths src --ignore-src --rosdistro=${ROS_DISTRO} -y
六、編譯
14、catkin_make_isolated --install --use-ninja
編譯速度取決於處理器能力,一般來說編譯時間十分漫長
15、source install_isolated/setup.bash
七、測試
1、下載任意數據包
http://google-cartographer-ros.readthedocs.io/en/latest/data.html
2、roslaunch cartographer_rosdemo_backpack_2d.launch bag_filename:=數據包路徑
3、如能正常建圖,則cartographer安裝成功。
至此,cartographer安裝完畢,下一步需要結合自身設備及環境進行參數配置,詳情請關注cartographer在github上的項目。