Apollo自动驾驶框架试玩

时间:2021-09-27 23:30:52

  2017年7月5日,百度举行了AI开发者大会,在会上发布了Apollo项目,并进行了演示,该项目在Github上已经能够被访问。出于一个程序员的好奇,昨天试玩了一把,确实不错。

  http://apollo.auto/,这个是阿波罗的首页,感兴趣的可以注册成为开发者。https://github.com/ApolloAuto/apollo这个时候github的地址。装了个ubuntu,然后建一个目录。git clone https://github.com/ApolloAuto/apollo.git 克隆下来以后运行下面几个命令。

bash docker/scripts/install_docker.sh
bash docker/scripts/dev_start.sh
bash docker/scripts/dev_into.sh

  第一个命令是安装docker,注意不要使用sudo,也不建议使用root账号。

  第二个命令是开始部署开发环境,就是一堆的docker pull,这个时候需要等很久,如果你有一个好点的网络环境可能会快很多,我是运行了大半天。

  运行好是下面的界面。

hackcat@hackcat-VirtualBox:~/source/apollo$ bash docker/scripts/dev_start.sh
dev-latest: Pulling from apolloauto/apollo
Digest: sha256:4119d0e023d773a5e47a68f31da41ee26a2173a84ae485bf65d39714736c710b
Status: Image is up to date for apolloauto/apollo:dev-latest
apollo_dev
apollo_dev
[sudo] hackcat 的密码:
/home/hackcat/source/apollo/data/core/core_%e.%p
[WARNING] Failed to find device with pattern "ttyUSB*" ...
[ OK ] Found device: /dev/ttyS31.
[ OK ] Found device: /dev/ttyS30.
[ OK ] Found device: /dev/ttyS29.
[ OK ] Found device: /dev/ttyS28.
[ OK ] Found device: /dev/ttyS27.
[ OK ] Found device: /dev/ttyS26.
[ OK ] Found device: /dev/ttyS25.
[ OK ] Found device: /dev/ttyS24.
[ OK ] Found device: /dev/ttyS23.
[ OK ] Found device: /dev/ttyS22.
[ OK ] Found device: /dev/ttyS21.
[ OK ] Found device: /dev/ttyS20.
[ OK ] Found device: /dev/ttyS19.
[ OK ] Found device: /dev/ttyS18.
[ OK ] Found device: /dev/ttyS17.
[ OK ] Found device: /dev/ttyS16.
[ OK ] Found device: /dev/ttyS15.
[ OK ] Found device: /dev/ttyS14.
[ OK ] Found device: /dev/ttyS13.
[ OK ] Found device: /dev/ttyS12.
[ OK ] Found device: /dev/ttyS11.
[ OK ] Found device: /dev/ttyS10.
[ OK ] Found device: /dev/ttyS9.
[ OK ] Found device: /dev/ttyS8.
[ OK ] Found device: /dev/ttyS7.
[ OK ] Found device: /dev/ttyS6.
[ OK ] Found device: /dev/ttyS5.
[ OK ] Found device: /dev/ttyS4.
[ OK ] Found device: /dev/ttyS3.
[ OK ] Found device: /dev/ttyS2.
[ OK ] Found device: /dev/ttyS1.
[ OK ] Found device: /dev/ttyS0.
[ OK ] Found device: /dev/can0.
[WARNING] Failed to find device with pattern "ram*" ...
[ OK ] Found device: /dev/loop7.
[ OK ] Found device: /dev/loop6.
[ OK ] Found device: /dev/loop5.
[ OK ] Found device: /dev/loop4.
[ OK ] Found device: /dev/loop3.
[ OK ] Found device: /dev/loop2.
[ OK ] Found device: /dev/loop1.
[ OK ] Found device: /dev/loop0.
[ OK ] Found device: /dev/loop-control.
4ffca0c5dc8efb214a3a41a63d395330c12736bd5a43247e78c60e638fa0357a
Adding user `hackcat' ...
Adding new group `hackcat' (1000) ...
Adding new user `hackcat' (1000) with group `hackcat' ...
The home directory `/home/hackcat' already exists. Not copying from `/etc/skel'.

  第三个命令是进入到docker容器中。

  进到容器中了。

hackcat@in_dev_docker:/apollo$ 

  

  至此,整个docker就搞完了,接下来就需要编译阿波罗了。

  进入到容器后,运行以下命令进行编译。

  

bash apollo.sh build

  漫长的等待啊,电脑性能要好点,我是等了一晚上,不知道几点搞好的,因为是虚拟机,分配的CPU内存都不多。至少40G硬盘吧。

  编译好以后就可以在里面运行阿波罗了。

  

bash scripts/hmi.sh

  打开人机交互界面。注意,不编译也能得到下面的结果,但网页打不开,看了下log是缺少各种文件。

  

hackcat@in_dev_docker:/apollo$ bash scripts/hmi.sh
Start roscore...
HMI ros node service running at localhost:
HMI running at http://localhost:8887
hackcat@in_dev_docker:/apollo$

  用谷歌浏览器访问。 http://localhost:8887

  Apollo自动驾驶框架试玩

  打开以后是这样子的。左边的setup做两部操作,第一确定目前软件模块都已正确加载,即Debug列表中的模块,GPS驱动,控制器,总线,定位,Dreamview,数据记录等,第二步是确定GPS模块和CAN总线模块(这些是硬件模块)都已经安装,并能正常通信。然后就可以进行Record了,Record应该就是驾驶员驾驶车辆在封闭道路进行行驶,阿波罗记录数据。开始行驶的时候点击Start,行驶完了点击Stop。下面的Quick Play是执行刚才录制的轨迹,进行自动驾驶。有点像电脑上的屏幕录像脚本。

  硬件相关信息百度也提供了文档,感兴趣的同学可以去购买一些来,据说三天就能打造出一辆自动驾驶汽车来。唯一苦恼的是,车辆需要有专业的总线技术服务公司来帮助我们进行对接,这个像我等屌丝去哪里找??

  https://github.com/ApolloAuto/apollo/blob/master/docs/quickstart/apollo_1_0_hardware_system_installation_guide.md#prerequisites,这个是硬件安装步骤。

  • The vehicle must be modified for “drive-by-wire” technology by a professional service company. Also, a CAN interface hookup must be provided in the trunk where the IPC will be mounted.