参考了:
https://blog.csdn.net/jc15988821760/article/details/99731809
https://blog.csdn.net/mylovechao/article/details/83902951
在ubuntu18.04 Melodic下安装cartographer
方法一、二进制包直接安装
sudo apt-get update
sudo apt-get install ros-melodic-cartographer* //安装全部关于cartographer的包
方法二:
1、安装相关的依赖
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-melodic-tf2-eigen libatlas-base-dev libsuitesparse-dev liblapack-dev
2.install ceres solver,建议在home下创建个目录(cartographer)
(路径你可以自己随意,不过建议最好和和下面安装的放在一起;如: path:/home/chenub/cartographer)
从以下网址下载
http://distfiles.macports.org/ceres-solver/
tar zxf ceres-solver-1.14.0.tar.gz
cd ceres-solver-1.14.0/
mkdir ceres-bin
cd ceres-bin
cmake ..
make -j3
make test
# Optionally install Ceres, it can also be exported using CMake which
# allows Ceres to be used without requiring installation, see the documentation
# for the EXPORT_BUILD_DIR option for more information.
sudo make install
(err:check dependency 如果报错,请查看依赖项是否添加正确)
3.install cartographer
回到路径如: path:/home/chenub/cartographer)
git clone https://github.com/hitcm/cartographer.git
cd cartographer/
mkdir build
cd build
cmake .. -G Ninja
ninja
ninja test
sudo ninja install
4.install cartographer_ros
$ sudo apt-get update
$ sudo apt-get install -y python-wstool python-rosdep ninja-build
$ mkdir catkin_ws
$ cd catkin_ws
$ wstool init src
$ cd src
$ git clone https://github.com/hitcm/cartographer_ros.git
$ cd
$ cd catkin_ws
$ catkin_make
最后为了避免每次都要加工作空间麻烦,所以可以执行下面的直接写好即可.
echo "source ~/catkin_ws/devel/setup.bash" >> ~/.bashrc