apollo学习
提示:这里可以添加系列文章的所有文章的目录,目录需要自己手动添加
例如:第一章 Python 机器学习入门之pandas的使用
提示:写完文章后,目录可以自动生成,如何生成可参考右边的帮助文档
文章目录
0、安装参考文章
https://blog.csdn.net/weixin_42377570/article/details/123429583?ops_request_misc=%257B%2522request%255Fid%2522%253A%2522165112428516781435419868%2522%252C%2522scm%2522%253A%252220140713.130102334.pc%255Fall.%2522%257D&request_id=165112428516781435419868&biz_id=0&utm_medium=distribute.pc_search_result.none-task-blog-2allfirst_rank_ecpm_v1~rank_v31_ecpm-5-123429583.142v9pc_search_result_control_group,157v4control&utm_term=apollo6.0%E5%AE%89%E8%A3%85%E5%85%A8%E6%A4%92%E6%85%88&spm=1018.2226.3001.4187
https://blog.csdn.net/lo_bamboo/article/details/105214674?ops_request_misc=&request_id=&biz_id=102&utm_term=apollo,Qt&utm_medium=distribute.pc_search_result.none-task-blog-2allsobaiduweb~default-4-105214674.142v9pc_search_result_control_group,157v4control&spm=1018.2226.3001.4187
一、ubuntu20.04
安装ubuntu20.04时,需要注意系统分区。
“/”类似windows的C盘;
"/boot"为启动ubuntu目录,分配1GB足够;
“swap”为交换分区,当系统运动内存不足时,会利用swap空间代替运行内存,因此swap一般给内存的2~3倍大小;
“/home”类似于windows的D、E盘;
“EFI”如果没有,需要添加上;
以上全部选择逻辑分区。
Device for boot loader installation选择和“/boot”一致。
二、安装nvidia驱动
1.命令安装
查看电脑适合什么驱动:
ubuntu-drivers devices
根据recommended的推荐安装:
sudo apt-add-repository multiverse
sudo apt-get update
sudo apt-get install nvidia-driver-510
测试nvidia是否安装成功
nvidia-smi
2.图形界面安装
三、换源
1.命令安装
sudo gedit /etc/apt/sources.list
添加阿里源
deb http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse
更新
sudo apt-get update
sudo apt-get upgrade
2.图形界面安装
四、安装docker
1.安装docker
sudo apt install docker.io
2.查看docker版本验证
docker --version
3.显示对应版本
Docker version 20.10.11, build dea9396e18
4.下面打开docker,然后查看状态信息
systemctl start docker && systemctl enable docker
systemctl status docker
5.运行一下docker看看能否正常运行
docker run hello-world
docker: 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/containers/create": dial unix /var/run/docker.sock: connect: permission denied.
See 'docker run --help'.
6.发现不能正常运行,这时需要添加用户组
sudo groupadd docker
sudo usermod -aG docker $USER
newgrp docker
7.再一次运行hello-world,出现Hello from Docker!这一行,说明docker没有问题了
xu@xu-Inspiron-3881:~$ docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
2db29710123e: Pull complete
Digest: sha256:4c5f3db4f8a54eb1e017c385f683a2de6e06f75be442dc32698c9bbe6c861edd
Status: Downloaded newer image for hello-world:latest
Hello from Docker!
This message shows that your installation appears to be working correctly.
To generate this message, Docker took the following steps:
1. The Docker client contacted the Docker daemon.
2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
(amd64)
3. The Docker daemon created a new container from that image which runs the
executable that produces the output you are currently reading.
4. The Docker daemon streamed that output to the Docker client, which sent it
to your terminal.
To try something more ambitious, you can run an Ubuntu container with:
$ docker run -it ubuntu bash
Share images, automate workflows, and more with a free Docker ID:
https://hub.docker.com/
For more examples and ideas, visit:
https://docs.docker.com/get-started/
五、安装docker上nvidia驱动
1.安装指令
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 apt-get -y update
sudo apt-get install -y nvidia-docker2
2.完成之后重新启动一下docker
sudo systemctl restart docker
六、下载apollo6.0
可以直接去github上下载,再解压
git clone https://github.com/ApolloAuto/apollo.git
七、启动apollo开发docker容器
1.运行脚本,慢慢等待
sudo bash docker/scripts/dev_start.sh
2.出现Enjoy!表示成功
Adding user `xu' ...
Adding new user `xu' (1000) with group `docker' ...
Creating home directory `/home/xu' ...
Copying files from `/etc/skel' ...
[ OK ] Congratulations! You have successfully finished setting up Apollo Dev Environment.
[ OK ] To login into the newly created apollo_dev_xu container, please run the following command:
[ OK ] bash docker/scripts/dev_into.sh
[ OK ] Enjoy!
3.进入docker
bash docker/scripts/dev_into.sh
4.用户名变成docker,你进入也成功了
To run a command as administrator (user "root"), use "sudo <command>".
See "man sudo_root" for details.
[xu@in-dev-docker:/apollo]$
八、编译apollo程序
1.需要有较好的网络环境
./apollo.sh clean
./apollo.sh build_opt_gpu
2.如果编译失败,在编译之前安装下qt5
sudo apt-get update
sudo apt-get install qt5-default qtcreator
./apollo.sh clean
rm -rf ~/.cache/bazel/*
bash apollo.sh build
3.出现Enjoy!表示成功
九、启动Dreamview
1.运行scripts/bootstrap.sh将在启用监视模块的情况下启动Dreamview后端。
./scripts/bootstrap.sh [start | stop | restart]
2.在浏览器中打开
http://localhost:8888/
3.将cyber_record添加到环境变量中
source /apollo/cyber/setup.bash
4.播放demo
cd docs/demo_guide/
python3 record_helper.py demo_3.5.record
cd /apollo
cyber_recorder play -f docs/demo_guide/demo_3.5.record -l
十、apollo启动程序
cd apollo
sudo bash docker/scripts/dev_into.sh
./scripts/bootstrap.sh [start | stop | restart]
source /apollo/cyber/setup.bash
cyber_recorder play -f docs/demo_guide/demo_3.5.record