使用张明明大神修改编译版
注意:中间出过很多错误,大部分是开源包eigen,protobuf的版本与该SLAM不匹配。
之前装了eigen的,删掉。protobuf我装的是3.6.1
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-kinetic-tf2-eigen libatlas-base-dev libsuitesparse-dev liblapack-dev
2.安装ceres slover,版本1.11,如果装过别的版本,建议删掉重新装
git clone https://github.com/hitcm/ceres-solver-1.11.0.git
cd ceres-solver-1.11.0
mkdir build
cd build
cmake ..
make -j4 //编译的时候会和eigen3.3发生冲突,需要重新安装eigen3.2
sudo make install
3.安装protobuf
# 首先安装protobuf
sudo apt-get install autoconf autogen
git clone https://github.com/protocolbuffers/protobuf.git
cd protobuf
git submodule update --init --recursive
./autogen.sh
./configure
make
# 这一步可能会报错,无视就好
make check
sudo make install
sudo ldconfig # refresh shared library cache.
4.安装Cartographer
git clone https://github.com/hitcm/cartographer.git
cd cartographer
mkdir build
cd build
cmake .. -G Ninja
ninja
ninja test
sudo ninja install
5.安装Cartographer_ros
#初始化工作空间
mkdir -p ~/cartogra_ros/src
cd ~/cartogra_ros/src
catkin_init_workspace
echo "source cartogra_ros/devel/setup.bash" >> ~/.bashrc
source ~/.bashrc
#安装cartographer_ros
cd ~/cartogra_ros/src
git clone https://github.com/hitcm/cartographer_ros.git
cd ~/cartogra_ros
catkin_make
5.数据测试
数据源:
运行launch文件即可
roslaunch cartographer_ros demo_backpack_2d.launch bag_filename:=${HOME}/Downloads/cartographer_paper_deutsches_museum.bag
roslaunch cartographer_ros demo_backpack_3d.launch bag_filename:=${HOME}/Downloads/cartographer_3d_deutsches_museum.bag
6.Revo LDS demo
运行:roslaunch cartographer_ros demo_revo_lds.launch bag_filename:=${HOME}/Downloads/cartographer_paper_revo_lds.bag