欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

从零开始学Apollo自动驾驶:跑起来第一个Demo

程序员文章站 2022-04-15 14:44:45
...

围绕着百度开源的Apollo自动驾驶项目展开,重点分析整个项目的框架,核心的计算机视觉感知模块。

  • 下载项目代码

项目主页:https://github.com/ApolloAuto/apollo

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

或者直接Download Zip 然后再解压,这样会快一点。

  • Demo

我们没有实际的硬件,只能跑模拟,
参考下面的手册
https://github.com/ApolloAuto/apollo/tree/master/docs/demo_guide

首先要保证大家的机器上已经成功的安装的docker相关的工具。

具体步骤如下:

  • Start the docker release environment 
bash docker/scripts/dev_start.sh

这一步会首先下载docker 镜像,非常耗费时间,而且还不支持断点续传,timeout中断了,之前的下载就没有了,还得重新下,博主搞了一天才下载成功。估计也跟大家的网速有关。
过程如下:

dev-x86_64-20180830_2013: Pulling from apolloauto/apollo
8284e13a281d: Pulling fs layer 
26e1916a9297: Pulling fs layer 
4102fc66d4ab: Pulling fs layer 
1cf2b01777b2: Waiting 
7f7a2d5e04ed: Waiting 
4485a4546668: Waiting 
f2dedab118af: Waiting 
00b281226c49: Waiting 
bc0c7226b8c9: Pulling fs layer 
420c13db0d6e: Waiting 
611bf0d7fdcd: Pulling fs layer 
e7ede7815bfa: Waiting 
ec6bc81a3ae3: Pulling fs layer 
1b7ca71086fe: Pulling fs layer 
a84b136e0420: Waiting 
9776f2f2c600: Waiting 
1f7d71d6db20: Waiting 
2b7341fa9271: Waiting 
98bb19ed3b9e: Waiting 
678810c01101: Waiting 
046a32619f11: Waiting 
16a4ab4986c3: Waiting 
b66091f7d4e0: Waiting 
6664b38a18b0: Pulling fs layer 
5fb13f702c51: Waiting 
40458a51cf99: Waiting 
13c3bf762416: Waiting 
9c6e6397a99f: Waiting 
dfab65a5e83e: Waiting 
de3dc9874976: Pulling fs layer 
a3eabc0e4e9b: Waiting 
05a645a29c64: Waiting 
a9618d6f75fd: Waiting 
28d5e23561a3: Waiting 
11446b750f54: Pulling fs layer 
a16df225cf4c: Waiting 
c2a2a76c4640: Waiting 
438384cd8f58: Pulling fs layer 
1853decde09b: Waiting 
357f26991e99: Pulling fs layer 
1bbc865bf1bf: Waiting 
1020899a3cd3: Waiting 
d2c4df1eb7df: Waiting 
0861f117c914: Pulling fs layer 
ab803ba43537: Waiting 
32f09862d356: Waiting 
25ada1f7a5d6: Waiting 
0c8804d36113: Waiting 
a5c29467e795: Waiting 
4a60fa819100: Pulling fs layer 
79bb7f3c9506: Waiting 
856674461db7: Waiting 
7bcf048c04b0: Waiting 
d60759c45819: Waiting 
0c3fecf85985: Waiting 
8284e13a281d: Downloading [=======>                                           ]  9.641MB/67.13MB
698b8ad5c1c0: Waiting 
075a67385b8c: Waiting 
8470ee4790d1: Waiting 
c6ea292867aa: Waiting 
5ad590b0dae3: Waiting 
c5fc9aff58c5: Waiting 
5bc88c8d017e: Pulling fs layer 
4091b316cd7d: Waiting 
f36affe90df2: Pulling fs layer 
09aef22d490c: Waiting 
829af1cc2608: Pulling fs layer 
fb0431ed1abe: Waiting 
5c20ca2836e4: Waiting 
7bb1c6c76de7: Waiting 
b4f28c4d6daa: Waiting 
50b700cb32cb: Waiting 
499fece8b42f: Pulling fs layer 
e76c9579e5e1: Waiting 
e229dc37631a: Waiting 
030389befc20: Waiting 
a46505c8fdc1: Waiting 
fcde79242efc: Waiting 
ad1a337fdd17: Waiting 
639ea2ef6100: Waiting 
e0a524a2bd8c: Waiting 
78bfbaeb3cc0: Waiting 
32f179c6f0b0: Waiting 
b504af63cce8: Waiting 
b0c8847b48c0: Waiting 
2e6c8af4b7ca: Pulling fs layer 
2e0af7e1089d: Waiting 
5f47d652f117: Waiting 
bce0151e9ea7: Waiting 
165e31452c4b: Pulling fs layer 
7de1132beb2d: Waiting 
1e4a75d8aa52: Waiting 
5492a8455e49: Pulling fs layer 
40125f250958: Pulling fs layer 
b95e84b65ef1: Waiting 
035583ef139f: Pulling fs layer 
a8b2ff565076: Pulling fs layer 
b294beb81f19: Waiting 
6caa1b2bee2d: Waiting 
4cb527115954: Waiting 
bf4a53a46841: Pulling fs layer 
e25b244b2c11: Waiting

完成之后,会提示下一步如何继续。

从零开始学Apollo自动驾驶:跑起来第一个Demo

  •  Enter the docker release environment
bash docker/scripts/dev_into.sh
  • Build Apollo in the Container:
bash apollo.sh build

    Note: If you do not have a GPU, you can use the following script instead   

bash apollo.sh build_cpu
  •    Bootstrap to start ros call and Monitor module and Dreamview
bash scripts/bootstrap.sh
  • play the rosbag
    sudo python docs/demo_guide/rosbag_helper.py demo_2.0.bag #download rosbag
    rosbag play demo_2.0.bag --loop  #The --loop option enables rosbag to keep playing the bag in a loop playback mode.

博主在启动rosbag时遇到的rosbag命令找不到问题(rosbag: command not found)

解决方法:

source /apollo/bazel-apollo/external/ros/setup.bash
https://github.com/ApolloAuto/apollo/issues/80

正常跑起来之后效果如下:

从零开始学Apollo自动驾驶:跑起来第一个Demo

  • Open Chrome and go to localhost:8888 to access Apollo Dreamview, which opens the screen below

网页上一直提示:Please send car initial position and map data

解决方法:

不使用远程连接,博主刚开始使用另外一台机器上的浏览器打开的demo网页,有问题。直接使用host上的chrome,不建议使用其他浏览器,需要装的插件太多,不方便。

run起来之后,效果如下: 

从零开始学Apollo自动驾驶:跑起来第一个Demo

总体感觉还是很方便的,这都得归功于docker技术的发展啊。

相关标签: 自动驾驶