Apollo安装记录

主要参考文档

百度Apollo6.0(5.5)安装

1 下载git

参考文档

该教程使用中,注意两个细节:

  1. “git pull --rebase origin master” ----不需要执行,因为自己新建的仓,是空的。其实后边也可以发现这个问题,是因为,以前的github的默认branch叫master,现在默认生成的叫main导致的。
  2. “git push origin master”—执行后,发现在github上,没有炸弹哦呵上传的hello.txt。后来发现这个问题和第一个问题一样,也是上传到新生成的master分支了,在github上选择master分支,看到了上传的hello.txt文件。

2 使用git下载Apollo源码

在这里插入图片描述
查看仓库地址:https://github.com/ApolloAuto/apollo.git
使用git指令进行下载:
$ git clone https://github.com/ApolloAuto/apollo.git
不过下载中,发现文件好大,大概2G了,其实还不如在这直接使用dowload zip。不过后边又试了一次,发现还是git给力,下载速度能达到5M/s,而直接下载zip,经常掉线,还速度慢,用迅雷还时不时下载一会就不让下载下载失败。

顺便也在windows下安装了git,方便使用。 Windows系统Git安装配置

3 docker安装

参考文档

这里我们使用的是国内daocloud一键安装:

curl -sSL https://get.daocloud.io/docker | sh*

4 “Failed to pull docker image”

参考文档

$:~/test_git/apollo$ bash docker/scripts/dev_start.sh 
[INFO] Use default GeoLocation settings
[INFO] Start pulling docker image apolloauto/apollo:dev-x86_64-18.04-20210204_2153 ...
Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Post http://%2Fvar%2Frun%2Fdocker.sock/v1.24/images/create?fromImage=apolloauto%2Fapollo&tag=dev-x86_64-18.04-20210204_2153: dial unix /var/run/docker.sock: connect: permission denied
[ERROR] Failed to pull docker image : apolloauto/apollo:dev-x86_64-18.04-20210204_2153

在执行"bash docker/scripts/dev_start.sh “时,报出了"Failed to pull docker image”。仔细查看错误信息"Got permission denied while trying to connect to the Docker daemon socket at unix:"。查到了上面的参考文档。应该是用户不在docker用户组导致的,需要将当前用户添加到docker组中。注意这里是将当前用户多增加一个组,不用弄成只分配到docker组。
由于通过查看,在前面本机在执行一键安装docker时,已经增加了docker组。通过

sudo gpasswd -a $USER docker  #将当前用户添加至docker用户组
newgrp docker                 #更新docker用户组

执行完毕,发现错误依旧,既然是权限错误,直接改为使用sudo 执行
"/apollo$ sudo bash docker/scripts/dev_start.sh "
发现能够执行了,但又产生了新的错误

$:~/test_git/apollo$ sudo bash docker/scripts/dev_start.sh 
[INFO] Use default GeoLocation settings
[INFO] Start pulling docker image apolloauto/apollo:dev-x86_64-18.04-20210204_2153 ...
dev-x86_64-18.04-20210204_2153: Pulling from apolloauto/apollo
f22ccc0b8772: Pulling fs layer 
3cf8fb62ba5f: Download complete 
e80c964ece6a: Download complete 
8a451ac89a87: Waiting 
c563160b1f64: Waiting 
596a46902202: Waiting 
aa0805983180: Waiting 
5718c3da35a0: Waiting 
ecaecc0c2072: Waiting 
dd7b324046d3: Waiting 
c71390291a7c: Waiting 
5392f106e19b: Waiting 
error pulling image configuration: Get https://production.cloudflare.docker.com/registry-v2/docker/registry/v2/blobs/sha256/45/452c5e3fbf61d32edb3e24e924208e6b791242dca7e184a7c5d92a12a852655f/data?verify=1613919887-8QtDD5SVoockQ%2BrcMhZ1dqwKQ20%3D: net/http: TLS handshake timeout
[ERROR] Failed to pull docker image : apolloauto/apollo:dev-x86_64-18.04-20210204_2153

这次的错误,没有明显的提示,更像是网络问题,厚着脸皮,重试了一次,居然可以了。但问题是下载也太慢了,文件居然有过G的。这估计是个及其漫长的等待了。

$:~/test_git/apollo$ sudo bash docker/scripts/dev_start.sh 
[INFO] Use default GeoLocation settings
[INFO] Start pulling docker image apolloauto/apollo:dev-x86_64-18.04-20210204_2153 ...
dev-x86_64-18.04-20210204_2153: Pulling from apolloauto/apollo
f22ccc0b8772: Downloading  11.67MB/26.71MB
3cf8fb62ba5f: Download complete 
e80c964ece6a: Download complete 
8a451ac89a87: Download complete 
c563160b1f64: Download complete 
596a46902202: Download complete 
aa0805983180: Downloading  2.689MB/1.501GB
5718c3da35a0: Downloading  2.128MB/1.237GB
ecaecc0c2072: Waiting 
dd7b324046d3: Waiting 
c71390291a7c: Waiting 
5392f106e19b: Waiting 

这个速度实在是受不了了,直接CTRL+C结束了漫长的等待。查了下改用国内源的方式。

5 为docker增加国内源

参考文档

  • Docker——配置国内源
  • Docker中配置国内镜像
    查了下,别人都是"$ sudo bash docker/scripts/dev_start.sh -C"增加了个 -C。
    结果自己测试了下,直接报错。说是没有 -C选项。
    只好采用其他方式。查了下,可以直接增加配置文件,使用国内镜像。
    新建docker配置文件daemon.json
$ sudo vi /etc/docker/daemon.json

json文件的内容如下:(增加国内源)

{
 "registry-mirrors" : [
   "https://mirror.ccs.tencentyun.com",
   "http://registry.docker-cn.com",
   "http://docker.mirrors.ustc.edu.cn",
   "http://hub-mirror.c.163.com"
 ],
 "insecure-registries" : [
   "registry.docker-cn.com",
   "docker.mirrors.ustc.edu.cn"
 ],
 "debug" : true,
 "experimental" : true
}

重启动docker

$ systemctl daemon-reload
$ systemctl restart docker

再次执行"/apollo$ sudo bash docker/scripts/dev_start.sh "。速度果然起飞,感人。
经过等待后,终于收到了安装完成的通知。

[ OK ] Congratulations! You have successfully finished setting up Apollo Dev Environment.
[ OK ] To login into the newly created apollo_dev_root container, please run the following command:
[ OK ]   bash docker/scripts/dev_into.sh
[ OK ] Enjoy!

6 进入容器

输入密码后,进入容器。

sudo bash docker/scripts/dev_into.sh
[sudo]XXX 的密码: 
root@in-dev-docker:/apollo# 

7 编译

由于我的电脑没有GPU,直接使用CPU编译。

sudo bash apollo.sh build_cpu
[WARNING] nvidia-smi not found. CPU will be used.

在这里插入图片描述
然后就是漫长的编译了。
中间又报了下载的错误,基于前面的经验,直接重新运行编译。最终看到了编译完成。

(21:45:43) INFO: Elapsed time: 2244.349s, Critical Path: 155.57s
(21:45:43) INFO: 17477 processes: 10857 internal, 6620 local.
(21:45:43) INFO: Build completed successfully, 17477 total actions
==============================================
[ OK ] Done building apollo. Enjoy!
==============================================
root@in-dev-docker:/apollo# 

8 Dreamview启动失败"Failed to start Dreamview"

参考文档

root@in-dev-docker:/apollo# bash scripts/bootstrap.sh
[WARNING] nvidia-smi not found. CPU will be used.
[WARNING] nvidia-smi not found. CPU will be used.
[WARNING] nvidia-smi not found. CPU will be used.
[WARNING] nvidia-smi not found. CPU will be used.
nohup: appending output to 'nohup.out'
Launched module monitor.
[WARNING] nvidia-smi not found. CPU will be used.
[WARNING] nvidia-smi not found. CPU will be used.
nohup: appending output to 'nohup.out'
Launched module dreamview.
Failed to start Dreamview. Please check /apollo/data/log or /apollo/data/core for more information

但新开了终端,不在docker中运行该指令,却报出dreamview已经执行skip该指令。

$ bash scripts/bootstrap.sh
Module monitor is already running - skipping.
Module dreamview is already running - skipping.

而且这时使用chorme打开localhost:8888,也能看到运行界面。
在这里插入图片描述
查了下相关的文档,居然是在docker里,再执行一遍该语句即可,赶紧试了下,果然好使。

root@in-dev-docker:/apollo# bash scripts/bootstrap.sh
[WARNING] nvidia-smi not found. CPU will be used.
[WARNING] nvidia-smi not found. CPU will be used.
[WARNING] nvidia-smi not found. CPU will be used.
[WARNING] nvidia-smi not found. CPU will be used.
Module monitor is already running - skipping.
[WARNING] nvidia-smi not found. CPU will be used.
[WARNING] nvidia-smi not found. CPU will be used.
Module dreamview is already running - skipping.
root@in-dev-docker:/apollo# 

参考文档如下
在这里插入图片描述
再次使用chorme打开localhost:8888,也能看到运行界面。
为了避免有其他错误,顺便试下DreamView的stop/restart,并再次启动起来。注意这里的stop restart都是直接写在命令后,而不加"-",实测加"-"反而不会正确执行。

root@in-dev-docker:/apollo# bash scripts/bootstrap.sh stop   
[WARNING] nvidia-smi not found. CPU will be used.
[WARNING] nvidia-smi not found. CPU will be used.
[WARNING] nvidia-smi not found. CPU will be used.
[WARNING] nvidia-smi not found. CPU will be used.
[cyber_launch_12325] INFO Stop cyber launch finished.
[cyber_launch_12325] INFO cyber_launch exit.
Successfully stopped module dreamview.
[WARNING] nvidia-smi not found. CPU will be used.
[WARNING] nvidia-smi not found. CPU will be used.
[cyber_launch_12365] INFO Stop cyber launch finished.
[cyber_launch_12365] INFO cyber_launch exit.
Successfully stopped module monitor.
root@in-dev-docker:/apollo# bash scripts/bootstrap.sh     
[WARNING] nvidia-smi not found. CPU will be used.
[WARNING] nvidia-smi not found. CPU will be used.
[WARNING] nvidia-smi not found. CPU will be used.
[WARNING] nvidia-smi not found. CPU will be used.
nohup: appending output to 'nohup.out'
Launched module monitor.
[WARNING] nvidia-smi not found. CPU will be used.
[WARNING] nvidia-smi not found. CPU will be used.
nohup: appending output to 'nohup.out'
Launched module dreamview.
Dreamview is running at http://localhost:8888
root@in-dev-docker:/apollo# 

在这里插入图片描述
再次使用chorme打开localhost:8888,能看到运行界面。
在这里插入图片描述

9 测试

执行"# python3 record_helper.py demo_3.5.record",将记录文件写到demo_3.5.record。执行成功。

root@in-dev-docker:/apollo/docs/demo_guide# ls
README.md  README_cn.md  images  record_helper.py
root@in-dev-docker:/apollo/docs/demo_guide# python3 record_helper.py demo_3.5.record
Downloading https://github.com/ApolloAuto/apollo/releases/download/v3.5.0/demo_3.5.record
--2021-02-22 08:35:28--  https://github.com/ApolloAuto/apollo/releases/download/v3.5.0/demo_3.5.record
Resolving github.com (github.com)... 13.229.188.59
Connecting to github.com (github.com)|13.229.188.59|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://github-releases.githubusercontent.com/96246170/5ef2fd80-1274-11e9-8d26-8ff378bbd07f?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20210222%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20210222T003529Z&X-Amz-Expires=300&X-Amz-Signature=9049644f7577a845fdcddab5e044ba423738a5a7b0bee24bdfc628368862140c&X-Amz-SignedHeaders=host&actor_id=0&key_id=0&repo_id=96246170&response-content-disposition=attachment%3B%20filename%3Ddemo_3.5.record&response-content-type=application%2Foctet-stream [following]
--2021-02-22 08:35:29--  https://github-releases.githubusercontent.com/96246170/5ef2fd80-1274-11e9-8d26-8ff378bbd07f?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20210222%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20210222T003529Z&X-Amz-Expires=300&X-Amz-Signature=9049644f7577a845fdcddab5e044ba423738a5a7b0bee24bdfc628368862140c&X-Amz-SignedHeaders=host&actor_id=0&key_id=0&repo_id=96246170&response-content-disposition=attachment%3B%20filename%3Ddemo_3.5.record&response-content-type=application%2Foctet-stream
Resolving github-releases.githubusercontent.com (github-releases.githubusercontent.com)... 185.199.110.154, 185.199.111.154, 185.199.109.154, ...
Connecting to github-releases.githubusercontent.com (github-releases.githubusercontent.com)|185.199.110.154|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 96246211 (92M) [application/octet-stream]
Saving to: 'demo_3.5.record'

demo_3.5.record     100%[===================>]  91.79M  11.1MB/s    in 8.6s    

2021-02-22 08:35:38 (10.7 MB/s) - 'demo_3.5.record' saved [96246211/96246211]

Successfully downloaded demo_3.5.record
root@in-dev-docker:/apollo/docs/demo_guide# 

在这里插入图片描述

10 运行测试数据

运行"cyber_recorder play -f demo_3.5.record --loop",报出了若提示"cyber_recorder: command not found," 返回/apollo/下执行source cyber/setup.bash。问题解决。
在这里插入图片描述
重新返回到demo_guide目录下,再次执行"cyber_recorder play -f demo_3.5.record --loop"

root@in-dev-docker:/apollo/docs/demo_guide# cyber_recorder play -f demo_3.5.record --loop

这时可以看到运行情况。
在这里插入图片描述

在这里插入图片描述
至此测试完毕。

11 停止container

参考文档

测试完毕,关闭容器。
执行exit,退出容器。回头再看看怎么再进入。

root@in-dev-docker:/apollo/docs/demo_guide# exit

后来发现,另外一个方式是,从另外一个terminal下,使用"docker stop apollo_dev_root"。但没试过。

12 再次进入container

  • 进入/apollo目录,首先查看容器的名称,指令"docker ps -a"
  • 启动该容器,启动后返回该容器名称,指令" docker start apollo_dev_root"
  • 重复前面的指令" sudo bash docker/scripts/dev_into.sh "。
/apollo$  docker ps -a
CONTAINER ID   IMAGE                                              COMMAND       CREATED        STATUS          PORTS     NAMES
d5097d57f7c5   apolloauto/apollo:dev-x86_64-18.04-20210204_2153   "/bin/bash"   45 hours ago   Up 54 minutes             apollo_dev_root
/apollo$  docker start apollo_dev_root
apollo_dev_root
$ sudo bash docker/dev_into.sh
[sudo] XXX 的密码: 
bash: docker/dev_into.sh: 没有那个文件或目录
/apollo$ sudo bash docker/scripts/dev_into.sh 
root@in-dev-docker:/apollo# 
  • 7
    点赞
  • 49
    收藏
    觉得还不错? 一键收藏
  • 14
    评论
评论 14
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值