下载了一个详细注释版本
https://github.com/xiangli0608/cartographer_detailed_comments_ws
直接编译不行
然后按照下面步骤安装
参考
https://blog.csdn.net/x_r_su/article/details/52927564
(1)安装依赖

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
    
sudo apt-get install -y python-wstool python-rosdep ninja-build

然后执行脚本catkin_make.sh脚本
提示找不到absl,参考下面解决
安装cartographer,找不到 “absl” 解决方法

 sudo apt-get install stow
 sudo chmod +x ~/carto_ws/src/cartographer/scripts/install_abseil.sh
 cd ~/carto_ws/src/cartographer/scripts
./install_abseil.sh

报错

cartographer/mapping/proto/trajectory_node_data.proto:15:10: Unrecognized syntax identifier "proto3".  This parser only recognizes "proto2".
ninja: build stopped: subcommand failed.
<== Failed to process package 'cartographer': 
  Command '['ninja']' returned non-zero exit status 1

参考
https://www.kidscoding8.com/60262.html
这个是安装了proto2的原因,直接安装proto3

sh src/cartographer/scripts/install_proto3.sh
sudo mv /usr/bin/protoc  /usr/bin/protoc.bk 
sudo ln -s /usr/local/bin/protoc /usr/bin/protoc

编译有点慢,然后报qt的错误

The imported target "Qt5::Gui" references the file

     "/usr/lib/x86_64-linux-gnu/libEGL.so"
  but this file does not exist.  Possible reasons include:

解决办法:删除原来的文件并新建软链接

sudo rm /usr/lib/x86_64-linux-gnu/libEGL.so
sudo ln /usr/lib/x86_64-linux-gnu/libEGL.so.1 /usr/lib/x86_64-linux-gnu/libEGL.so

sudo rm /usr/lib/x86_64-linux-gnu/libGL.so
sudo ln /usr/lib/x86_64-linux-gnu/libGL.so.1 /usr/lib/x86_64-linux-gnu/libGL.so

编译成功

<== Finished processing package [4 of 4]: 'cartographer_rviz'
catkin_make.sh: 8: catkin_make.sh: source: not found

跑一个例子
先下载官方的包

wget -P ~/Downloads https://storage.googleapis.com/cartographer-public-data/bags/backpack_2d/cartographer_paper_deutsches_museum.bag
source install_isolated/setup.bash
roslaunch cartographer_ros demo_backpack_2d.launch bag_filename:=${HOME}/Downloads/cartographer_paper_deutsches_museum.bag

实验结果图如下
在这里插入图片描述
其他pcl多版本共存错误:

/opt/ros/kinetic/include/pcl_conversions/pcl_conversions.h:86:43: error: ‘pcl::uint64_t’ has not been declared

sudo find / -name pcl

发现我安装了pcl1.7和pcl 1.1两个版本
其中pcl 1.1 是用的源码安装
安装的时候是用的
sudo make install
还好找到了安装文件夹
直接在pcl的安装文件夹build中

sudo make uninstall

就卸载了pcl1.1

参考https://zhuanlan.zhihu.com/p/86426524

Logo

开放原子开发者工作坊旨在鼓励更多人参与开源活动,与志同道合的开发者们相互交流开发经验、分享开发心得、获取前沿技术趋势。工作坊有多种形式的开发者活动,如meetup、训练营等,主打技术交流,干货满满,真诚地邀请各位开发者共同参与!

更多推荐