步骤一,安装所有的依赖项:
sudo apt-get install -y google-mock libboost-all-dev libeigen3-dev libgflags-dev libgoogle-glog-dev liblua5.2-dev libprotobuf-dev libsuitesparse-dev libwebp-dev ninja-build protobuf-compiler python-sphinx ros-kinetic-tf2-eigen libatlas-base-dev libsuitesparse-dev liblapack-dev
二:下载abseil
网址:https://github.com/abseil/abseil-cpp.
安装abseil的静态库:
mkdir build && cd build cmake .. make sudo make install
安装abseil的动态库:可以将之前的build文件删掉,重新建立
mkdir build && cd build cmake .. -DBUILD_SHARED_LIBS=ON make sudo make install
步骤三,安装ceres-solver-master:
git clone https://github.com/ceres-solver/ceres-solver.git cd ceres-solver mkdir build cd build cmake .. make -j4 sudo make install
步骤四,cartographer(安装在根目录下):
git clone https://github.com/googlecartographer/cartographer.git cd cartographer mkdir build cd build cmake .. -G Ninja ninja ninja test sudo ninja install
更改cartographer的CMakeList.txt文件(有2处)和cartographer-config.cmake.in文件(有1处)
CMakeList.txt 第1处:
find_package(Abseil REQUIRED) --> find_package(absl REQUIRED) CMakeList.txt 第2处:#默认的库文件是 standalone_absl target_link_libraries(${PROJECT_NAME} PUBLIC ${PROTOBUF_LIBRARY} absl::base absl::synchronization absl::strings absl::flat_hash_map absl::numeric absl::flags)
然后重新编译即可
cartographer-config.cmake.in 1处:
find_package(Abseil ${QUIET_OR_REQUIRED_OPTION}) Abseil 改为 absl
步骤五,安装cartographer_ros:
#初始化工作空间,我之前有一个工作空间为catkin_ws,我的命名为google_ws mkdir -p ~/catkin_ws/src cd ~/catkin_ws/src catkin_init_workspace echo "source ~/catkin_ws/devel/setup.bash" >> ~/.bashrc source ~/.bashrc #安装cartographer_ros cd ~/catkin_ws/src git clone https://github.com/hitcm/cartographer_ros.git cd ~/catkin_ws catkin_make
更改cartographer_ros的CMakeList.txt,有2处cartographer_ros 和 cartographer_rviz的改法均一致
find_package(Abseil REQUIRED) --> find_package(absl REQUIRED)
然后重新编译即可。
本实验经过验证,可行通过