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
    评论
### 回答1: 安装Cartographer需要以下步骤: 1. 首先,在Ubuntu 18.04上安装依赖项。打开终端并执行以下命令: ``` 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.3-dev libprotobuf-dev libsuitesparse-dev lsb-release ninja-build python-sphinx protobuf-compiler python3-dev python3-sphinx ros-melodic-tf2-sensor-msgs libceres-dev ``` 2. 安装Google的protobuf: ``` wget https://github.com/google/protobuf/releases/download/v3.8.0/protobuf-all-3.8.0.tar.gz tar -xf protobuf-all-3.8.0.tar.gz cd protobuf-3.8.0/ ./configure make sudo make install ``` 3. 克隆Cartographer存储库: ``` git clone https://github.com/googlecartographer/cartographer.git ``` 4. 创建并进入构建目录: ``` cd cartographer mkdir build cd build ``` 5. 运行CMake编译配置: ``` cmake .. make -j ``` 6. 安装Cartographer: ``` sudo make install ``` 完成安装后,您可以在终端中测试Cartographer: ``` cartographer_rosbag_validate -h ``` 这将显示Cartographer的命令行帮助。 ### 回答2: 在Ubuntu 18.04上安装Cartographer可以按照以下步骤进行操作: 1. 打开终端,使用命令sudo apt-get update来更新软件包。 2. 安装依赖项:sudo apt-get install -y google-mock libboost-all-dev libeigen3-dev libceres-dev liblua5.3-dev ninja-build protobuf-compiler python-sphinx libatlas-base-dev 3. 安装CMake:sudo apt-get install -y cmake 4. 进入要安装Cartographer的目录,例如/home/username/Documents。 5. 使用以下命令克隆Cartographer源代码: git clone https://github.com/cartographer-project/cartographer.git cd cartographer git checkout master git fetch --all git reset --hard origin/master git submodule init git submodule update 6. 创建一个用于构建的目录并进入该目录: mkdir build && cd build 7. 运行以下命令配置构建: cmake .. 8. 运行以下命令编译并安装Cartographer: make -j sudo make install 9. 安装完成后,可以使用以下命令验证Cartographer是否正确安装cartographer_assets_writer cartographer_grpc_assets_writer cartographer_info cartographer_pbstream_to_rosbag cartographer_ros cartographer_rosbag cartographer_rosver cartographer_turtlebot_3_localization 通过以上步骤,您应该可以成功在Ubuntu 18.04上安装Cartographer。可能需要一些时间来完成编译和安装过程,请耐心等待。如果遇到任何问题,可以参考Cartographer的官方文档或寻求相关技术支持。 ### 回答3: 在Ubuntu 18.04上安装Cartographer是一个相对繁琐的过程,以下是详细步骤: 1. 首先,你需要确认你的系统已经安装好了一些基本的开发工具。可以在终端中运行以下命令来安装这些工具: ``` sudo apt-get update sudo apt-get install -y build-essential cmake git ``` 2. 接下来,需要安装一些依赖项。运行以下命令进行安装: ``` sudo apt-get install -y google-mock libboost-all-dev libcairo2-dev libeigen3-dev libgflags-dev libgoogle-glog-dev liblua5.2-dev libsuitesparse-dev libwebp-dev ninja-build protobuf-compiler python-sphinx ``` 3. 安装配置Java开发环境。Cartographer使用Java来构建文档,所以需要安装Java JDK: ``` sudo apt-get install -y openjdk-8-jdk ``` 然后设置Java环境变量: ``` export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64 export PATH=$JAVA_HOME/bin:$PATH ``` 4. 现在,你可以从GitHub上克隆Cartographer的源代码库: ``` git clone https://github.com/googlecartographer/cartographer.git ``` 然后进入克隆下来的目录: ``` cd cartographer ``` 并且检出最新的稳定版本: ``` git fetch --all git tag git checkout tags/<tag_name> ``` 5. 创建一个构建目录,并切换到该目录: ``` mkdir build cd build ``` 6. 使用CMake来配置Cartographer的构建: ``` cmake .. ``` 7. 使用ninja构建Cartographer: ``` ninja ``` 8. 最后,运行测试来确保安装成功: ``` ninja test ``` 至此,你已经成功安装Cartographer。记得将Cartographer添加到你的系统路径中,以便在任何目录下都可以使用它: ``` export CARTOGRAPHER_PATH=<path_to_cartographer> export PATH=$CARTOGRAPHER_PATH:$PATH ``` 希望以上步骤对你有所帮助!
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值