前言
记录ubuntu18.04下安装运行cartographer。
1.安装依赖
sudo apt-get update
sudo apt-get install -y python-wstool python-rosdep ninja-build stow
sudo apt-get install cmake
sudo apt-get install build-essential
sudo apt-get install libgoogle-glog-dev
sudo apt-get install libatlas-base-dev
sudo apt-get install lua5.2
2.下载功能包
参考谷歌链接:
mkdir catkin_ws
cd catkin_ws
wstool init src
wstool merge -t src https://raw.githubusercontent.com/cartographer-project/cartographer_ros/master/cartographer_ros.rosinstall
wstool update -t src
虽然有点慢,但尽可能的从谷歌链接中下载cartographer和cartographer_ros,对于ceres-slover可以在github上下载,编译安装,ceres-slover链接。
cd ceres-solver
mkdir build
cd cbuild
cmake ..
make
make test
sudo make install
3.下载安装abseil-cpp
这里我没有用cartographer中src/cartographer/scripts 下的install_abseil.sh 安装,而是从abseil链接中下载,因此以下的安装编译仅针对从该链接下载的abseil-cpp。
cd abseil-cpp
mkdir build
cmake ..
make
sudo make install
mkdir build && cd build
cmake .. -DBUILD_SHARED_LIBS=ON
make
sudo make install
4.安装cartographer_ros依赖
sudo rosdep init
rosdep update
rosdep install --from-paths src --ignore-src --rosdistro=${ROS_DISTRO} -y
5.编译安装。
catkin_make_isolated --install --use-ninja
6.下载bag包测试。
[ERROR] [1646225605.588546642, 1432647017.439283900]: PluginlibFactory: The plugin for class 'Submaps' failed to load. Error: Failed to load library /home/XXX/catkin_ws/install_isolated
/lib//libcartographer_rviz.so. Make sure that you are calling the PLUGINLIB_EXPORT_CLASS macro in the library code, and that names are consistent between this macro and your XML.
Error string: Could not load library (Poco exception = libabsl_synchronization.so.0: 无法打开共享对象文件: 没有那个文件或目录)
sudo gedit /etc/ld.so.conf
include /etc/ld.so.conf.d/*.conf
/usr/local/lib
sudo /sbin/ldconfig
参考:博主:__铭天的解决方案。
下载测试:
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
总结
以上就是安装cartographer的过程,之前安装过几次,遇到各种问题,虽然都成功了,很浪费时间。这次写下笔记记录一下。
|