1.安装依赖
sudo apt-get update
sudo apt-get install -y python-wstool python-rosdep ninja-build
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
2.安装Eigen3
sudo apt-get install libeigen3-dev
#构建ceres作为一个静态的库
sudo apt-get install libsuitesparse-dev
3.安装lua5.2
sudo apt install lua5.2
4.获取源代码
获取源代码的方法有很多种,有采用git clone的方法。但是国内的如果没有一些方法的话访问github非常慢,非常容易导致git clone失败。所以这里直接从网盘直接下载好代码。cartographer.zip - 蓝奏云【参考:】备用链接百度云:链接:https://pan.baidu.com/s/1gWaSSftWyDQ-U2MxxdEEwA 提取码:1234
这里可以把版本信息去掉。
5.安装protobuf 3.0.0
直接将下载好的protobuf放在cartographer/scripts/目录下,注意cartographer_ros不用放。放好之后如图所示:
执行下面命令安装:
cd protobuf
mkdir build
cd build
cmake -G Ninja \
-DCMAKE_POSITION_INDEPENDENT_CODE=ON \
-DCMAKE_BUILD_TYPE=Release \
-Dprotobuf_BUILD_TESTS=OFF \
../cmake
ninja
sudo ninja install
6.安装ceres-solver
make -j 8 这个根据硬件选,我的RK3566选8挂了
cd ceres-solver
mkdir build
cd build
cmake ..
make -j 8
#make test # 此选项可选
sudo make install
7.编译安装
cd cartographer_ws
rosdep update
rosdep install --from-paths src --ignore-src --rosdistro=${ROS_DISTRO} -y
#Build and install.这一步会花费很长的时间,耐心等待
catkin_make_isolated --install --use-ninja
source install_isolated/setup.bash
8.运行DEMO 2D包
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
9.效果图
参考:
[1] ubuntu18.04 安装测试ros cartographer_足迹-优快云博客
[2] ubuntu18.04 安装cartographer教程_缘来17的博客-优快云博客_ubuntu 安装cartographer