cartographer Ubuntu 20.04下安装

本文详细介绍了在Ubuntu 20.04系统上安装最新版本的Ceres、Abseil、Protobuf和Cartographer库,并展示了如何在ROS Noetic环境下配置和运行示例。重点讲述了依赖安装、编译步骤以及解决rosdep问题的方法。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

cartographer

ubuntu系统版本:20.04
开发主要应用cartographer编译出来的库,所以直接在ubuntu系统下安装cartographer库。
参照:https://google-cartographer.readthedocs.io/en/latest/安装文档,过程比较顺利。

一、相关源码下载

源码都是下载的最新版本。如果下载慢,可以先导入码云,再从码云下载会比较快点,
其中Ceres的下载路径换成github下的,具体如下。

1、git clone https://github.com/googlecartographer/cartographer.git  
2、git clone https://github.com/ceres-solver/ceres-solver.git  
3、git clone https://github.com/abseil/abseil-cpp.git  
4、git clone https://github.com/google/protobuf.git 

二、依赖安装

1、sudo apt-get update
2、sudo apt-get install -y \
    clang \
    cmake \
    g++ \
    git \
    google-mock \
    libboost-all-dev \
    libcairo2-dev \
    libcurl4-openssl-dev \
    libeigen3-dev \
    libgflags-dev \
    libgoogle-glog-dev \
    liblua5.2-dev \
    libsuitesparse-dev \
    lsb-release \
    ninja-build \
    stow 

三、编译安装

下面软件所有的安装都是最新版本。

3.1 安装abseil

1、cd abseil-cpp  
2、cd build
3、cmake -G Ninja -CMAKE_BUILD_TYPE=Release -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DCMAKE_INSTALL_PREFIX=/usr/local/stow/absl ..  
4、ninja  
5、sudo ninja install  
6、cd /usr/local/stow  
7、sudo stow absl 

3.2 安装ceres

1、cd ceres-solver  
2、mkdir build  
3、cd build  
4、cmake .. -G Ninja -DCXX11=ON  
5、ninja  
6、sudo ninja install  

3.3 安装protobuf

1、cd protobuf  
2、mkdir build  
3、cd build  
4、cmake -G Ninja -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DCMAKE_BUI-Dprotobuf_BUIL-D_TESTS=OFFLD_TYPE=Release  ../cmake  
5、ninja  
6、sudo ninja install  

3.4 安装cartograoger

1、cd cartographer   
2、mkdir build   
3、cmake .. -G Ninja   
4、ninja   
5、sudo ninja install

ROS安装cartographer

为了尽快的能欣赏下cartographer的风姿,还是在ros下安装了cartographer。
ROS版本:Noetic
参考:https://google-cartographer-ros.readthedocs.io/en/latest/compilation.html

sudo apt-get update
sudo apt-get install -y python3-wstool python3-rosdep ninja-build stow
mkdir catkin_ws
cd catkin_ws
wstool init src
wstool merge -t src https://raw.githubusercontent.com/cartographer-project/cartographer_ros/master/cartographer_ros.rosinstall
wstool update -t src
sudo rosdep init
rosdep update
rosdep install --from-paths src --ignore-src --rosdistro=${ROS_DISTRO} -y
catkin_make_isolated --install --use-ninja
source install_isolated/setup.bash

下载并启动数据包:
2D:

wget -P ~/Downloads https://storage.googleapis.com/cartographer-public-data/bags/backpack_2d/cartographer_paper_deutsches_museum.bag  

roslaunch cartographer_ros demo_backpack_2d.launch bag_filename:=${HOME}/Downloads/cartographer_paper_deutsches_museum.bag

3D:

wget -P ~/Downloads https://storage.googleapis.com/cartographer-public-data/bags/backpack_3d/with_intensities/b3-2016-04-05-14-14-00.bag
roslaunch cartographer_ros demo_backpack_3d.launch bag_filename:=${HOME}/Downloads/b3-2016-04-05-14-14-00.bag
wget -P ~/Downloads https://storage.googleapis.com/cartographer-public-data/bags/revo_lds/cartographer_paper_revo_lds.bag
roslaunch cartographer_ros demo_revo_lds.launch bag_filename:=${HOME}/Downloads/cartographer_paper_revo_lds.bag

安装过程中遇到:sudo rosdep init ERROR: cannot download default sources list from:
rosdep update , 通过以下方式解决。

#打开hosts文件
sudo gedit /etc/hosts
#在文件末尾添加
151.101.84.133  raw.githubusercontent.com
#保存后退出再尝试

后续进行cartographer相关源码分下。

评论 8
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值