在官网的基础上稍加修改,但保证代码都是最新的
我的系统配置: Debian9 strech, ROS lunar 该方法对 ubuntu 系列操作系统以及其他ROS版本同样适用。
1. 安装依赖库
sudo apt-get install -y \ g++ \ git \ google-mock \ libboost-all-dev \ libcairo2-dev \ libeigen3-dev \ libgflags-dev \ libgoogle-glog-dev \ liblua5.2-dev \ libsuitesparse-dev \ ninja-build \ python-sphinx
2. 安装ceres-solver
google提供的地址下载太慢,在github上git clone 也是太慢, 索性直接Donload zip
https://github.com/ceres-solver/ceres-solver.git
然后编译安装:
cd ceres-solver mkdir build cd build cmake .. make -j4 sudo make install
3. 安装proto3
重要说明: 如果你已经安装了ROS, 恭喜你,其实你已经安装了protobuf了, 但是你没有安装protobuf-compiler, 你只需要安装一下protobuf-compiler就可以了
sudo apt-get install protobuf-compiler
然后你可以执行 protoc --version 查看protobuf 的版本.
如果你没有装ROS那么执行下面的步骤吧:
安装依赖
sudo apt-get install autoconf automake libtool curl make g++ unzip
方式一(推荐):
sudo apt-get install libprotobuf-dev sudo apt-get install protobuf-compiler
方式二:
下载zip(git clone 太慢了)
地址: https://github.com/protocolbuffers/protobuf
编译安装:
./autogen.sh ./configure make -j4 make check sudo make install sudo ldconfig # refresh shared library cache.
make check 会提示又一些错误,没关系啦,核心库已经编译好啦
4. 安装cartographer
clone cartographer代码,这个速度还可以
git clone https://github.com/googlecartographer/cartographer.git
编译安装
cd cartographer mkdir build cd build cmake .. make -j4 sudo make install
5. 安装cartographer_ros
这个就简单了,地址:
https://github.com/googlecartographer/cartographer_ros
clone 或者下载到自己的ROS工作空间,编译一下就可以了.
6. 测试
2D:
// launch 2D example roslaunch cartographer_ros demo_backpack_2d.launch bag_filename:=${HOME}/Downloads/cartographer_paper_deutsches_museum.bag
3D:
# Launch the 3D backpack demo. roslaunch cartographer_ros demo_backpack_3d.launch bag_filename:=${HOME}/Downloads/b3-2016-04-05-14-14-00.bag
OK, 到此结束!