ubuntu18.04配置安装cartographer

ubuntu 配置安装Cartographer

作为记录使用

cartographer官方地址

我的系统配置

  • ubuntu: 18.04
  • ROS1: melodic
  • VMware: 15.5.7 build-17171714

1. 更新和安装编译工具

sudo apt-get update
sudo apt-get install -y python-wstool python-rosdep ninja-build

2. 创建工作空间

mkdir catkin_ws_google && cd catkin_ws_google
wstool init src
wstool merge -t src https://ghproxy.com/https://raw.githubusercontent.com/googlecartographer/cartographer_ros/master/cartographer_ros.rosinstall

3. 修改.rosinstall,将码云上的代码地址对应的更改过来,三处都改

vim src/.rosinstall

修改成如下:

# THIS IS AN AUTOGENERATED FILE, LAST GENERATED USING wstool ON 2020-07-30
- git:
    local-name: cartographer
    uri: https://ghproxy.com/https://github.com/cartographer-project/cartographer.git
    version: 1.0.0
- git:
    local-name: cartographer_ros
    uri: https://ghproxy.com/https://gitee.com/zhaokexue/cartographer_ros.git
    version: 1.0.0
- git:
    local-name: ceres-solver
    uri: https://ghproxy.com/https://github.com/ceres-solver/ceres-solver.git
    version: 1.13.0

4. 更新src

wstool update -t src

下来是修改install_proto3.sh和install_abseil.sh,这两个文件在cartographer/scripts/这个文件夹下。
主要在他们的github链接加上了代理,添加后确保百分比克隆下来,不会出错。

5. 修改install_proto3.sh

VERSION="v3.4.1"

# Build and install proto3.
git clone https://ghproxy.com/https://github.com/protocolbuffers/protobuf.git
cd protobuf
git checkout tags/${VERSION}
mkdir build
cd build
cmake -G Ninja \
  -DCMAKE_POSITION_INDEPENDENT_CODE=ON \
  -DCMAKE_BUILD_TYPE=Release \
  -Dprotobuf_BUILD_TESTS=OFF \
  ../cmake
ninja
sudo ninja install

6. 修改install_abseil.sh

#!/bin/sh

# Copyright 2019 The Cartographer Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

set -o errexit
set -o verbose

git clone https://ghproxy.com/https://github.com/abseil/abseil-cpp.git
cd abseil-cpp
git checkout d902eb869bcfacc1bad14933ed9af4bed006d481
mkdir build
cd build
cmake -G Ninja \
  -DCMAKE_BUILD_TYPE=Release \
  -DCMAKE_POSITION_INDEPENDENT_CODE=ON \
  -DCMAKE_INSTALL_PREFIX=/usr/local/stow/absl \
  ..
ninja
sudo ninja install
cd /usr/local/stow
sudo stow absl


7. 安装protobuf3和abeil

src/cartographer/scripts/install_proto3.sh
src/cartographer/scripts/install_abseil.sh

8. 最后执行下面的命令。一般来说,如果初始安装了ros,执行sudo rosdep init时会出现错误,

这里我放个链接,修改完成百分比通过。通过修改rosdep update肯定会通过

sudo rosdep init #这里报错很正常,不用在意
rosdep update    #这里超时报错,就重新执行几次改命令就好
rosdep install --from-paths src --ignore-src --rosdistro=${ROS_DISTRO} -y

catkin_make_isolated --install --use-ninja
# 编译时间较长,可以静等编译成功,
# 如果编译不成功,多数是系统被更该过于严重,不建议使用网上教程更改,因为多说情况下,还是会有问题,建议重装系统,
# 在纯净的系统下,按照该教程安装完全没有问题,而且安装十分迅速。

参考链接
[https://zhuanlan.zhihu.com/p/392082731]
[https://zhuanlan.zhihu.com/p/165398798]

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值