关于apollo:百度Apollo系统学习01-安装Apollo

26次阅读

共计 3642 个字符,预计需要花费 10 分钟才能阅读完成。

Apollo 学习 001: 装置 Apollo

本文旨在具体记录 Apollo 在个人电脑的 Ubuntu 18.04 零碎中的残缺装置及运行过程。

硬件要求

百度 Apollo 零碎失常须要装置在工业计算机 IPC 中,在个人电脑上也能够装置。因为网上没有查到具体的硬件要求,这里 PO 出集体笔记本电脑配置作为参考:电脑型号:神州战神 z7m,CPU i7, 16G 内存,GPU: GTX965m。实测能够跑通。(PS:Unbutu 零碎须要空间大一些,实测 200 个 G 的空间装完并且将 Apollo 齐全编译后仅剩 50G)

Apollo 装置过程

  1. 装置 Nvidia 显卡驱动。

    sudo apt-get update
    sudo apt-add-repository multiverse
    sudo apt-get update
    sudo apt-get install nvidia-driver-455

    装置结束采纳 nvidia-smi 命令查看显卡:

    Wed Aug 25 21:55:21 2021       
    +-----------------------------------------------------------------------------+
    | NVIDIA-SMI 460.73.01    Driver Version: 460.73.01    CUDA Version: 11.2     |
    |-------------------------------+----------------------+----------------------+
    | GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
    | Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
    |                               |                      |               MIG M. |
    |===============================+======================+======================|
    |   0  GeForce GTX 965M    Off  | 00000000:01:00.0 Off |                  N/A |
    | N/A   61C    P0    N/A /  N/A |    438MiB /  2002MiB |     25%      Default |
    |                               |                      |                  N/A |
    +-------------------------------+----------------------+----------------------+
                                                                                   
    +-----------------------------------------------------------------------------+
    | Processes:                                                                  |
    |  GPU   GI   CI        PID   Type   Process name                  GPU Memory |
    |        ID   ID                                                   Usage      |
    |=============================================================================|
    |    0   N/A  N/A      1515      G   /usr/lib/xorg/Xorg                216MiB |
    |    0   N/A  N/A      1771      G   /usr/bin/gnome-shell               26MiB |
    |    0   N/A  N/A      3659      G   ...AAAAAAAAA= --shared-files       16MiB |
    |    0   N/A  N/A      4582      G   ...AAAAAAAAA= --shared-files      133MiB |
    |    0   N/A  N/A      7588      G   ...AAAAAAAAA= --shared-files        7MiB |
    |    0   N/A  N/A     10792      G   ...AAAAAAAAA= --shared-files       27MiB |
    +-----------------------------------------------------------------------------+
  2. 装置 docker

    curl https://get.docker.com | sh
    sudo systemctl start docker && sudo systemctl enable docker

    重启 Docker 守护过程以使改变失效:

    sudo systemctl restart docker

    实现 Docker 装置后,在终端中执行下述命令并重启零碎,这样能够免去每次执行 Docker 命令时须要增加 sudo 的繁琐:

    sudo groupadd docker
    sudo usermod -aG docker your_username
  3. 装置 nvidia 工具包

    如果是在物理机中装置的 Ubuntu,且机器配有 NVIDIA 显卡,在装置了驱动的前提下,还须要装置 NVIDIA 容器工具包以运行 Apollo Docker 镜像中的 CUDA:

    distribution=$(. /etc/os-release;echo $ID$VERSION_ID)
    curl -s -L https://nvidia.github.io/nvidia-docker/gpgkey | sudo apt-key add -
    curl -s -L https://nvidia.github.io/nvidia-docker/$distribution/nvidia-docker.list | sudo tee /etc/apt/sources.list.d/nvidia-docker.list
    sudo apt-get -y update
    sudo apt-get install -y nvidia-docker2
  4. git clone 源码

    # 应用 SSH 的形式
    git clone git@github.com:ApolloAuto/apollo.git
    
    # 应用 HTTPS 的形式
    git clone https://github.com/ApolloAuto/apollo.git

Docker 构建启动 Apollo

  1. 进入到 Apollo 源码根目录,终端执行下述命令以启动 Apollo Docker 开发容器:

    ./docker/scripts/dev_start.sh
  2. 进入 docker

    ./docker/scripts/dev_into.sh
  3. 容器中构建 Apollo,

    ./apollo.sh build
    
    #若编译失败可多尝试几次,卡死可尝试
    ./apollo.sh build_opt
  4. 启动 Apollo

    ./scripts/bootstrap.sh start

    上述命令会启动 DreamView 并使能模块监控机制,在浏览器中拜访 http://localhost:8888 来显示 DreamView 界面。

踩坑记录

git clone Apollo 仓库遇到谬误

andre@andre-CN15S:~$ git clone git clone https://github.com/ApolloAuto/apollo.git
Cloning into 'apollo'... 
remote: Enumerating objects: 2618, done. 
remote: Counting objects: 100% (2618/2618), done. 
remote: Compressing objects: 100% (1495/1495), done. 
error: RPC failed; curl 56 GnuTLS recv error (-110): The TLS connection was non-properly terminated. 
fatal: The remote end hung up unexpectedly 
fatal: early EOF 
fatal: index-pack failed 

解决办法:

https://github.com/ApolloAuto…

Apollo 执行 ./apollo.h build 遇到谬误

(16:20:38) ERROR: no such package '@com_github_grpc_grpc//bazel': java.io.IOException: Error downloading [https://apollo-system.cdn.bcebos.com/archive/6.0/v1.30.0.tar.gz, https://github.com/grpc/grpc/archive/v1.30.0.tar.gz] to /apollo/.cache/bazel/540135163923dd7d5820f3ee4b306b32/external/com_github_grpc_grpc/temp13334635335104087956/v1.30.0.tar.gz: Unknown host: github.com 
(16:20:38) INFO: Elapsed time: 164.995s 
(16:20:38) INFO: 0 processes. 
(16:20:38) FAILED: Build did NOT complete successfully (0 packages loaded) 

解决办法: 多编译几次 就好了

装置 VS code 并配置 C ++ 环境

VS code 装置和配置参见: https://segmentfault.com/a/11…

正文完
 0