百度Apollo搭建步驟(待更新)

 

百度Apollo搭建步驟html

##1、安裝ubuntu16.04

無需多說,安裝完成打開命令行。python

##2、下載Apollo鏡像

git clone https://github.com/ApolloAuto/apollo

若提示未安裝git,則安裝git。linux

##3、安裝docker-ce


若是你過去安裝過其餘版本的docker,先刪掉:git

sudo apt-get remove docker docker-engine docker.io

首先安裝依賴:github

sudo apt-get install apt-transport-https ca-certificates curl gnupg2 software-properties-common

信任 Docker 的 GPG 公鑰:web

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -

對於 amd64 架構的計算機,添加軟件倉庫:chrome

sudo add-apt-repository \
"deb [arch=amd64] https://mirrors.tuna.tsinghua.edu.cn/docker-ce/linux/ubuntu \
$(lsb_release -cs) \
stable"docker


若是你是樹莓派或其它ARM架構計算機,請運行:shell

echo "deb [arch=armhf] https://mirrors.tuna.tsinghua.edu.cn/docker-ce/linux/ubuntu \
$(lsb_release -cs) stable" | \
sudo tee /etc/apt/sources.list.d/docker.list

最後安裝json

sudo apt-get update
sudo apt-get install docker-ce

把當前用戶加到docker用戶組中:
######添加docker用戶組

sudo groupadd docker

######把本身加到docker用戶組中

sudo gpasswd -a myusername docker

myusername是指你的用戶名
######重啓docker後臺服務

sudo service docker restart

######切換當前用戶到新group

newgrp - docker

######確認docker能夠非sudo運行

docker ps

image

##4、安裝ros(apollo裏集成ros,就不用安裝ros了)

參見:http://www.javashuo.com/article/p-vmfdcyng-er.html

##5、.安裝apollo-kernel(未安裝,跳過)


######(1)在Apollo github下載百度編譯好的內核
https://github.com/ApolloAuto/apollo-kernel/releases

 

這裏寫圖片描述

 

安裝參見:百度無人車ApolloAuto使用入門

https://blog.csdn.net/ss910/article/details/74998172 

 

https://github.com/ApolloAuto/apollo-kernel
爲運行Apollo軟件提供了kernel層面的支持。
從這裏下載linux-4.4.32-apollo-1.0.0.tar.gz:
https://github.com/ApolloAuto/apollo-kernel/releases
解壓安裝:
tar zxvf linux-4.4.32-apollo-1.0.0.tar.gz
cd install
sudo ./install_kernel.sh
重啓系統。

 

##6、    安裝apollo-platform (ubuntu14.04 ,跳過)

https://github.com/ApolloAuto/apollo-platform
相對於原版ROS,作出了以下改進:
。加強了ROS的去中心化特性;
。基於共享內存的更高效的通訊;
。支持Protobuf;
下載apollo-platform並解壓:
https://github.com/ApolloAuto/apollo-platform/releases

解壓縮:
tar zxvf ros-indigo-apollo-1.0.0.x86_64.tar.gz

將文件夾中的ros拷貝到apollo工程中:

rsync -av ros/ ~/apollo/third_party/ros_x86_64
cd apollo
source ./third_party/ros_x86_64/setup.bash

##7、    Apollo編譯

執行 service docker start 命令
######1.設置docker環境

cd apollo
bash docker/scripts/dev_start.sh -C #-C表示從中國鏡像服務器下載,速度較快(很長時間5個小時)

image


bash docker/scripts/dev_into.sh

######2.編譯Apollo

bash apollo.sh build  #若提示權限不足,則sudo su  (小時)

######3.啓動人機交互界面(HMI)

bash scripts/bootstrap.sh

打開chrome瀏覽器,輸入地址「localhost:8888」便可訪問dreamview。

 

從新打開apollo,演示代碼以下:

cd apollo
bash docker
/scripts/dev_start.sh -C bash docker/scripts/dev_into.sh bash scripts/bootstrap.sh

rosbag play demo_2.0.bag --loop #--loop設置循環回放 localhost:
8888

 

##8、    Apollo演示(出錯)


######1.啓動docker的release環境

bash docker/scripts/release_start.sh

######2.進入release環境

bash docker/scripts/release_into.sh

######3.回放rosbag

python docs/demo_guide/rosbag_helper.py demo_1.5.bag #下載rosbag

 

下載測試數據包demo_2.0.bag      參見:http://www.javashuo.com/article/p-blmajxbj-nh.html

輸入 python docs/demo_guide/rosbag_helper.py demo_2.0.bag 來下載demo_2.0.bag數據包,不過因爲資源在github上,因此很大多是下載不下來的。來這裏下載吧:https://pan.baidu.com/s/1jQwavKBzTvHHVnSlwxM1ZQ 密碼:1nz8

此時你還在docker環境下:root@in_dev_docker:/apollo,把下載的demo_2.0.bag複製到此處。

cd ~/apollo
bash scripts/hmi.sh
在瀏覽器輸入http://localhost:8887後回車,在Debug中開啓Dreamview,而後點擊右上方的Dreamview。
在另外一個終端裏輸入:


rosbag play demo_1.5.bag --loop #--loop設置循環回放

打開chrome瀏覽器,輸入地址「localhost:8888」便可在dreamview中看到demo演示。

 

問題:

(1) 遇到一個問題,老是 build failed

這時候在docker 環境下執行命令:

bazel query //...

而後再執行 build 那一句,就正常了。

 

(2) Error response from daemon: Container CONTAINER_NAME is not running

 

Build in Visual Studio Code

Install VSCode

The easiest way to install for Debian/Ubuntu based distributions is to download from https://code.visualstudio.com and install the .deb package (64-bit) either through the graphical software center if it's available or through the command line with:

sudo dpkg -i <file>.deb sudo apt-get install -f # Install dependencies

Start VSCode

Start VSCode with the following command:

code

Open the Apollo project in VSCode

Use the keyboard shortcut (Ctrl+K Ctrl+O) to open the Apollo project.

Build the Apollo project in VSCode

Use the keyboard shortcut (Ctrl+Shift+B) to build the Apollo project.

Run all unit tests for the Apollo project in VSCode

Select the "Tasks->Run Tasks..." menu command and click "run all unit tests for the apollo project" from a popup menu to check the code style for the Apollo project.

If you are currently developing on 16.04, you will get a build error. As seen in the image below, 2 perception tests. To avoid this build error, refer to the how to build Apollo using Ubuntu 16.

Build error

(虛擬機+ubuntu16.04+vscode 編譯沒有出現錯誤)

Run a code style check task for the Apollo project in VSCode

Select the "Tasks->Run Tasks..." menu command and click "code style check for the apollo project" from a popup menu to check the code style for the Apollo project.

Clean the Apollo project in VSCode

Select the "Tasks->Run Tasks..." menu command and click "clean the apollo project" from a popup menu to clean the Apollo project.

Change the building option

You can change the "build" option to another one such as "build_gpu" (refer to the "apollo.sh" file for details) in ".vscode/tasks.json"

Test

bash docker/scripts/release_start.sh [release tag]

The HMI will automatically start and you can control each apollo module through any web browser by inputting IP address and port number, such as localhost:8887. You can get into the release container if quick fix needed.

bash docker/scripts/release_into.sh

參見:

https://github.com/ApolloAuto/apollo/blob/master/docs/howto/how_to_build_and_release.md#open-the-apollo-project-in-vscode

 

另外參見:

ubuntu16.04 安裝 apollo-kernel,apollo-platform以及apollo

http://www.51apollo.com/2018/08/21/ubuntu16-04-安裝-apollo-kernel,apollo-platform以及apollo/

百度阿波羅Apollo r3.0完整安裝以及經常使用操做教程

http://www.javashuo.com/article/p-blmajxbj-nh.html

https://blog.csdn.net/ss910/article/details/74998172

https://blog.csdn.net/qq_34906391/article/details/81478968     (重要)

https://blog.csdn.net/jinzhuojun/article/details/80210180

 

Apollo 2.5 安裝踩坑指南

https://www.jianshu.com/p/2c287aaf58bc

相關文章
相關標籤/搜索