本文思路主要参照书籍**自动驾驶-汽车平台技术基础(百度Apollo&北航)**操作,系统为Ubuntu 18.04。
安装Docker是失败多次,重装系统。参见清华大学镜像网站提供的方法成功: https://mirror.tuna.tsinghua.edu.cn/help/docker-ce/。留意截图中,复选框Ubuntu。
网上介绍该步骤功能是Docker用户省去sudo。
$ sudo groupadd docker
$ sudo usermod -aG docker morven
完毕后,关掉 terminal窗口,重启电脑。
Docker安装成功,确认方法:
$ docker run hello-world
提示不成功,可能原因是未重启电脑。
运行“ hello-world”代码,安装成功标志如下:
morven@Morven-ThinkPad:~$ docker run hello-world
Unable to find image 'hello-world:latest' locally
………………………………………………
Status: Downloaded newer image for hello-world:latest
Hello from Docker!
This message shows that your installation appears to be working correctly.
………………………………………………
设置Git缓存值大小方法 CSDN_lliolvye:设置Git缓存值大小,设置为5G(git config --list 查看设置值)
$ sudo git config --global http.postBuffer 5242880000
$ sudo git config --global https.postBuffer 5242880000
之前安装过程中出现:“emote: Enumerating objects……”,检索方法为更改缓存,防患未然,提前设置。
解决“ygit-lfs is required to work with apollo”问题需要安装ygit-lfs。解决方法:Installing on Linux using packagecloud:
$ curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | sudo bash
$ sudo apt-get install git-lfs
成功标志:
…………………………………………
正在解包 git-lfs (2.12.1) ...
正在处理用于 man-db (2.6.7.1-1ubuntu1) 的触发器 ...
正在设置 git-lfs (2.12.1) ...
Git LFS initialized.
Dreamview需要配置浏览器,参考CSDN_Rilakkuma博客:Firefox支持WebGL的操作参考。
CHrome浏览器及Chromium、Chrome、Firefox安装Flash播放器插件参考,Ubuntu16.04版本CSDN_lxlong89940101:Ubuntu16.04 安装chrome浏览器,Ubuntu14.04版本:CSDN_weixin_40521032:Ubuntu14.04安装谷歌Chrome浏览器
由于Github安装速度时快慢,提供两种安装源选择。至于版本,根据自己需要。安装git,下一步克隆Apollo(克隆只是复制网址内容到本地硬盘,非安装):
方法1-Github安装最新版本:
$ sudo apt-get install git
$ git clone https://github.com/ApolloAuto/apollo
方法2-Gitee-安装3.5.0版本:
$ sudo apt-get install git
$ git clone --branch v3.5.0 https://gitee.com/ApolloAuto/apollo
有关百度智能驾驶视频课程,资料介绍使用ROS。ROS是V3.0,个人初次接触是V3.5,最新现在是V6.0。
可直接运行以下脚本:
$ sudo passwd
$ su root
$ cd apollo
//clean the ./cache document
$ bash docker/scripts/dev_start.sh
$ bash docker/scripts/dev_into.sh
$ bash apollo.sh clean
$ sudo bash apollo.sh build_cpu
//waiting about 30mins for running of scripts
$ bash scripts/bootstrap.sh
$ bash scripts/bootstrap.sh stop
$ bash scripts/bootstrap.sh
解决Apollo_Build过程中出现的权限问题。
morven@morven-Laptop:~$ sudo passwd
[sudo] morven 的密码:
输入新的 UNIX 密码:
重新输入新的 UNIX 密码:
passwd:已成功更新密码
morven@morven-Laptop:~$ su root
密码:
root@morven-Laptop:/home/morven#
出现问题展示:
INFO: Reading 'startup' options from /apollo/tools/bazel.rc: --batch_cpu_scheduling --host_jvm_args=-XX:-UseParallelGC
Error: mkdir('/home/morven/.cache/bazel/_bazel_root'): (error: 13): Permission denied
处理方法留意1:Root权限调整。
处理方法留意2:删除该文件夹内容:home/morven/.cache-所有文件都删除。
处理方法留意3:运行Clean脚本。
# bash apollo.sh clean //重新运行Build前需要清理
# sudo bash apollo.sh build_cpu
进入Applo所在文件夹,在Docker内加载运行dev_start脚本拉取镜像:
$ cd apollo
$ bash docker/scripts/dev_start.sh -C
留意官方提供的代码增加 -C,见站B_Apollo无人驾驶 - 百度技术学院:https://www.bilibili.com/video/BV1M4411g7g3?p=47
安装成功标志:
morven@Morven-ThinkPad:~/apollo$ bash docker/scripts/dev_start.sh
fetch: Fetching reference HEAD
batch response: Currently only supports
**************************************
The home directory `/home/morven' already exists. Not copying from `/etc/skel'.
[ OK ] Finished setting up Apollo docker environment. Now you can enter with:
bash docker/scripts/dev_into.sh
[ OK ] Enjoy!
morven@Morven-ThinkPad:~/apollo$
加载dev_into.sh脚本进入Docker容器。
$ bash docker/scripts/dev_into.sh
参考CSDN_ok_kakaka博客_百度Apollo6.0(5.5)安装,电脑无GPU,切换为CPU编译,整个时时长约31min:
$ cd apollo
$ bash apollo.sh clean //重新编译时需要运行
$ sudo bash apollo.sh build_cpu
运行结束:
……………………………………………………
[ OK ] Build passed!
[INFO] Took 1810 seconds
============================
root@in_dev_docker:/apollo# bash scripts/bootstrap.sh
关于以下展示出现的问题:“Failed to start Dreamview. Please check /apollo/data/log or /apollo/data/core for more information”。
root@in_dev_docker:/apollo# bash scripts/bootstrap.sh
……………………………………………………
Failed to start Dreamview. Please check /apollo/data/log or /apollo/data/core for more information
root@in_dev_docker:/apollo# bash scripts/bootstrap.sh stop
…………………………………………
Successfully stopped module monitor.
root@in_dev_docker:/apollo# bash scripts/bootstrap.sh
…………………………………………
Dreamview is running at http://localhost:8888
$ root@morven-Laptop:/apollo# cp -r /apollo/bazel-bin/modules/monitor /apollo/modules/monitor
$ root@morven-Laptop:/apollo# cp -r /apollo/bazel-bin/modules/dreamview
打开Chrome,输入http://localhost:8888, 进入仿真窗口。界面如下:
morven@morven-Laptop:~$ cd apollo
morven@morven-Laptop:~/apollo$
morven@morven-Laptop:~/apollo$ git lfs fetch
fetch: Fetching reference HEAD
morven@morven-Laptop:~/apollo$ git lfs checkout
Checking out LFS objects: 100% (717/717), 744 MB | 28 MB/s, done.
运行Dreamview脚本:
$ sudo python docs/demo_guide/rosbag_helper.py demo_2.0.bag
//bash: rosbag: command not found
$ source /apollo/bazel-apollo/external/ros/setup.bash
$ rosbag play demo_2.0.bag --loop
有关rosbag: command not found解决方法参考Apollo_Issues: zezhou commented on 24 Aug 2017。
Dreamiew中按钮:
有关Docker安装:
sudo apt-get dist-upgrade
有关百度智能驾驶视频课程,资料介绍使用ROS,了解初始程序的思路,安装历史版本(V3是ROS,但是网上教程多是V3.5,现在已经V6.0),软件安装方面,最新版本和历史版本差别:
git clone https://………………
git clone --branch v3.5.0 https://………………
Apollo安装曾经出过的问题:Failed to connect to 127.0.0.1 port 45077: Connection refused,处理方法:CSDN:RedKeyer_git报错 failed: The TLS connection was non-properly terminated。
方法见官网_docker save:https://docs.docker.com/engine/reference/commandline/save/。Load(恢复)暂未研究,可参见官网,也可参考简书辰飔_Docker镜像和容器的导入与导出。
方法:docker save -o <备份路径/备份文件名>
morven@Morven-ThinkPad:~$ docker images
***************************************
docker save -o /home/morven/文档/map_volume-sunnyvale_big_loop-latest_BackUp_202103.tar apolloauto/apollo:map_volume-sunnyvale_big_loop-latest
docker save -o /home/morven/文档/map_volume-sunnyvale_with_two_offices-latest_BackUp_202103.tar apolloauto/apollo:map_volume-sunnyvale_with_two_offices-latest
docker save -o /home/morven/文档/localization_volume-x86_64-latest_BackUp_202103.tar apolloauto/apollo:localization_volume-x86_64-latest
docker save -o /home/morven/文档/dev-x86_64-20181210_1500_BackUp_202103.tar apolloauto/apollo:dev-x86_64-20181210_1500
docker save -o /home/morven/文档/yolo3d_volume-x86_64-latest_BackUp_202103.tar apolloauto/apollo:yolo3d_volume-x86_64-latest
docker save -o /home/morven/文档/map_volume-sunnyvale_loop-latest_BackUp_202103.tar apolloauto/apollo:map_volume-sunnyvale_loop-latest
重新安装系统原因,可使用直接导入Docker文件的方法,解决网络下载速度慢的问题:
morven@morven-ThinkPad:~$ docker load --input /home/morven/文档/yolo3d_volume-x86_64-latest_BackUp_202103.tar
cd7100a72410: Loading layer 4.403MB/4.403MB
351605c89ce3: Loading layer 117.7MB/117.7MB
15b82b1377b8: Loading layer 86.61MB/86.61MB
4b602bcb6d7b: Loading layer 66.5MB/66.5MB
Loaded image: apolloauto/apollo:yolo3d_volume-x86_64-latest
morven@morven-ThinkPad:~$
升级后出现host问题:
Error response from daemon: Get https://registry-1.docker.io/v2/: dial tcp: lookup registry-1.docker.io: no such host
直接更改resolv.conf文件提示权限问题。参考HANFAN文章,在终端中修改。
$ sudo passwd
$ su root
$ vi /etc/resolv.conf
//添加nameserver 8.8.8.8
/按下esc,之后输入
$ :wq!
Apollo由版本V3.5升级到最新V6.0(Ubuntu18.04)。
$ sudo passwd
$ su root
$ cd apollo
//clean the ./cache document
$ bash docker/scripts/dev_start.sh
$ bash docker/scripts/dev_into.sh
$ bash apollo.sh clean
$ sudo bash apollo.sh build_cpu
//waiting about 30mins for running of scripts
$ bash scripts/bootstrap.sh
$ bash scripts/bootstrap.sh stop
$ bash scripts/bootstrap.sh
$ python docs/demo_guide/record_helper.py demo_3.5.record
bash: cyber_record: command not found
//$ source cyber/setup.bash
$ cyber_recorder play -f docs/demo_guide/demo_3.5.record -l
>> 更多相关内容,点击Morven_Xie博客概览