1 准备工作
(1)准备Ubuntu20系统。
(2)安装ROS系统,参考
https://blog.csdn.net/weixin_46123033/article/details/139527141
(3)Cartographer相关软件包和源码下载:
https://gitee.com/mrwangmaomao/cartographer_slam
(4)安装依赖
sudo apt-get update
sudo apt-get install -y \clang \cmake \g++ \git \google-mock \libboost-all-dev \libcairo2-dev \libceres-dev \libcurl4-openssl-dev \libeigen3-dev \libgflags-dev \libgoogle-glog-dev \liblua5.2-dev \libsuitesparse-dev \lsb-release \ninja-build \python3-sphinx \stow
2 编译
编译abseil
cd abseil-cpp
git checkout 215105818dfde3174fe799600bb0f3cae233d0bf # 20211102.0
mkdir build
cd build
cmake -G Ninja \-DCMAKE_BUILD_TYPE=Release \-DCMAKE_POSITION_INDEPENDENT_CODE=ON \-DCMAKE_INSTALL_PREFIX=/usr/local/stow/absl \..
ninja
sudo ninja install
cd /usr/local/stow
sudo stow absl
编译protobuf
VERSION="v3.4.1"# Build and install proto3.
git clone https://github.com/google/protobuf.git
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
编译Ceres
cd ceres-solver-1.14.0
mkdir build
cd build
cmake ..
make -j3
make test
sudo make install
编译cartographer
cd cartographer
mkdir build
cd build
cmake .. -G Ninja
ninja
CTEST_OUTPUT_ON_FAILURE=1 ninja test
sudo ninja install
编译cartographer_ros
catkin_make_isolated --install --use-ninja