1.安装依赖
sudo apt-get update
sudo apt-get install -y python3-wstool python3-rosdep ninja-build stow
2.建立工作空间并下载源码
mkdir cartographer_ws
cd cartographer_ws
mkdir src
cd src
git clone https://github.com/googlecartographer/cartographer_ros.git
git clone https://github.com/googlecartographer/cartographer.git
git clone https://github.com/ceres-solver/ceres-solver.git
3.安装Cartographer的依赖
删除cartographer_ws/src/cartographer
中的行 <depend>libabsl-dev</depend>
执行以下指令
sudo rosdepc init
rosdepc update
rosdep install --from-paths src --ignore-src --rosdistro=${ROS_DISTRO} -y
若先前安装ROS时已经执行过sudo rosdepc init
则再次执行可能出错,该错误可以忽略。
4.安装abseil-cpp
cd ..
src/cartographer/scripts/install_abseil.sh
5.编译
catkin_make_isolated --install --use-ninja
6.配置环境变量
source ~/cartographer_ws/install_isolated/setup.bash
也可将路径添加至.bashrc
不必每次运行Cartographer前再source路径
echo "source ~/cartographer_ws/install_isolated/setup.bash" >> ~/.bashrc
sudo gedit ~/.bashrc
7.测试
下载测试集
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
参考文献
[1]. Ubuntu20安装并使用Cartographer建图导航
[2]. cartographer快速安装方案
[3]. cartographer: [libabsl-dev] defined as “not available“ for OS version解决方案
[4]. Cartographer(1)源码安装,rosdep问题解决
[5]. ROS问题:ERROR: cannot launch node of type
[6]. Cartographer建图实操
[7]. cartographer配置环境与踩坑问题以及理论分析
[8]. 【SLAM-建图】Ubuntu18.04安装cartographer记录
[9]. rviz一些无法正常显示的问题