1. 程式人生 > >從零開始學Apollo自動駕駛:跑起來第一個Demo

從零開始學Apollo自動駕駛:跑起來第一個Demo

圍繞著百度開源的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

完成之後,會提示下一步如何繼續。

  •  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

正常跑起來之後效果如下:

  • 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起來之後,效果如下: 

總體感覺還是很方便的,這都得歸功於docker技術的發展啊。