本文目录
本篇主要用作个人学习记录,大部分内容转载自各优秀博主。
ros noetic 安装 cartographer
1.1 安装依赖项
首先,我们需要安装一些依赖项。在终端中输入以下命令:
sudo apt-get update
sudo apt-get install -y python-wstool python-rosdep ninja-build
1.2 安装 Cartographer ROS
接下来,创建一个新的工作空间并获取 Cartographer ROS 代码:
mkdir -p ~/catkin_ws/src
cd ~/catkin_ws/src
git clone https://github.com/cartographer-project/cartographer_ros.git
这部分也可以这样:
mkdir catkin_ws
cd catkin_ws
wstool init src
wstool merge -t src https://raw.githubusercontent.com/googlecartographer/cartographer_ros/master/cartographer_ros.rosinstall
1.3 安装所有必要的依赖项
使用 rosdep 安装所有必要的依赖项:
cd ~/catkin_ws
rosdep update
rosdep install --from-paths src --ignore-src --rosdistro=${ROS_DISTRO} -y
我使用的是noetic版本也就是ubuntu20.04,在这里这条指令会有问题,替换为下条指令
rosdep install -i --from-path src --ignore-src -r
1.4 构建 Cartographer ROS
cd ~/catkin_ws
catkin_make_isolated --install --use-ninja
我在这里出现问题:
问题 ① absl库报错
CMake Error at CMakeLists.txt:32 (find_package):
By not providing "Findabsl.cmake" in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by "absl", but
CMake did not find one.
Could not find a package configuration file provided by "absl" with any of
the following names:
abslConfig.cmake
absl-config.cmake
Add the installation prefix of "absl" to CMAKE_PREFIX_PATH or set
"absl_DIR" to a directory containing one of the above files. If "absl"
provides a separate development package or SDK, be sure it has been
installed.
解决方法:
sudo apt-get install stow
去catkin_ws/src/cartographer/scripts路径下
sudo chmod +x install_abseil.sh
./install_abseil.sh
1.5 更新环境变量
source install_isolated/setup.bash
cartographer建图测试
下载示例包(例如Deutsches Museum(德意志博物馆)的2D和3D背包系列)到~/Downloads(这里下载到哪时无所谓的),并使用roslaunch来调出演示:
wget -P ~/Downloads https://storage.googleapis.com/cartographer-public-data/bags/backpack_2d/cartographer_paper_deutsches_museum.bag
这个我下载不下来,会有问题,我最后从网上随便找了一个bag尝试的
roslaunch cartographer_ros demo_backpack_2d.launch bag_filename:=${HOME}/Downloads/cartographer_paper_deutsches_museum.bag
结果展示: