google激光雷达slam算法Cartographer的安装及bag包demo测试

Cartographer 是google于2016年9月开源的一套激光雷达slam算法,精度和效果在业界处于领先水准。点击查看最终效果。

操作步骤:

1.安装依赖包

# Install the required libraries that are available as debs.
sudo apt-get update
sudo apt-get install -y \
    cmake \
    g++ \
    git \
    google-mock \
    libboost-all-dev \
    libcairo2-dev \
    libeigen3-dev \
    libgflags-dev \
    libgoogle-glog-dev \
    liblua5.2-dev \
    libprotobuf-dev \
    libsuitesparse-dev \
    libwebp-dev \
    ninja-build \
    protobuf-compiler \
    python-sphinx
python-sphinx   可以换成 sphinx-common

2.安装ceres solver

cd  ~/Documents
git clone https://github.com.cnpmjs.org/ceres-solver/ceres-solver.git
cd ceres-solver
git checkout 1.14.x
mkdir build
cd build
cmake ..  #git hook时间比较长,耐心等待
make -j
sudo make install

3.安装prtobuf 3.0

cd  ~/Documents
git clone https://github.com.cnpmjs.org/google/protobuf.git
cd protobuf
git checkout v3.6.1
mkdir build
cd build
cmake  \
  -DCMAKE_POSITION_INDEPENDENT_CODE=ON \
  -DCMAKE_BUILD_TYPE=Release \
  -Dprotobuf_BUILD_TESTS=OFF \
  ../cmake
make -j 2
sudo make install

4.安装cartographer

cd  ~/Documents
git clone https://gitee.com/BlueWhaleRobot/cartographer.git
cd cartographer
mkdir build
cd build
cmake ..
make -j
sudo make install

5.安装cartographer_ros

cd ~/Documents/ros/src   #请修改路径到自己的ROS catkin工作空间
git clone https://gitee.com/BlueWhaleRobot/cartographer_ros.git
cd ..
catkin_make

6.安装已完成,开始下载测试用的bag文件

点击下述链接下载文件,保存到桌面 下载链接

7.启动demo演示,正常可以看到rviz启动并开始建图

根据个人平台计算能力不同,本demo完整运行时间一般为半个小时到1个小时之间

roslaunch cartographer_ros offline_backpack_2d.launch  bag_filenames:=${HOME}/Desktop/cartographer_paper_deutsches_museum.bag

8.提取建立的地图,结束测试

上面步骤7会生成一个pbstream文件,用cartographer_ assets_writer可以转换成栅格地图

roslaunch cartographer_ros assets_writer_ros_map.launch bag_filenames:=${HOME}/Desktop/cartographer_paper_deutsches_museum.bag pose_graph_filename:=${HOME}/Desktop/cartographer_paper_deutsches_museum.bag.pbstream

0_1531754676780_map_yaml.png 现在在home目录下的Desktop文件夹内会生成建立的地图文件,这两个文件(pgm 和 yaml)在ros中的map_server中可以加载使用

results matching ""

    No results matching ""