ROS-Noetic安装Cartographer,复制粘贴流,方便快捷

在安装之前请确保正确完成了ROS-Noetic,完整的安装教程以及兼容性问题解决请查看我的上一篇博文。

安装Cartographer步骤

1. 安装编译过程中必备插件

sudo apt update
sudo apt install -y python3-wstool python3-rosdep ninja-build stow

2. 准备carto编译环境

mkdir ~/carto_ws
cd ~/carto_ws
wstool init src
wstool merge -t src https://raw.githubusercontent.com/cartographer-project/cartographer_ros/master/cartographer_ros.rosinstall

执行最后一条命令可能会报错,没关系下面操作:

vim ./src/.rosinstall

替换添加:

- git:
    local-name: cartographer
    uri: https://gitee.com/moresweet/cartographer.git
    version: master
- git:
    local-name: cartographer_ros
    uri: https://gitee.com/moresweet/cartographer_ros.git
    version: master
- git:
    local-name: ceress-solver
    uri: https://gitee.com/moresweet/ceres-solver.git

3. 下载carto文件

stool update -t src

4.安装依赖(rosdep 不过的去看我上一篇博客)

sudo rosdep init
rosdep update
rosdep install --from-paths src --ignore-src --rosdistro=noetic -y

5. 安装库

src/cartographer/scripts/install_abseil.sh
src/cartographer/scripts/install_proto3.sh
sudo apt-get install libceres-dev

6. 编译安装

catkin_make_isolated --install --use-ninja

这里如果报了python的错建议查看我上一篇博客的最后一条,或执行:

catkin_make_isolated --install --use-ninja -DPYTHON_EXECUTABLE=$(which python3)

7. 配置环境变量

echo "source ~/carto_ws/devel_isolated/setup.bash">>~/.bashrc

8. 测试

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

完成安装。
参考:
https://zhuanlan.zhihu.com/p/345761455
https://www.guyuehome.com/37956
https://www.pythonheidong.com/blog/article/1095200/fdff2e3f88ca6b8f48c7/

你可能感兴趣的:(ros,noetic,cartographer,ubuntu)