提交 dc0c898a 编写于 作者: S storypku 提交者: Xiangquan Xiao

Docs|Scripts: improved record downloader renamed from rosbag_helper.py

上级 5602ccf6
......@@ -14,48 +14,52 @@ Setup steps:
1. Start the docker release environment using the command:
```
bash docker/scripts/dev_start.sh
```
```
bash docker/scripts/dev_start.sh
```
2. Enter the docker release environment:
```
bash docker/scripts/dev_into.sh
```
```
bash docker/scripts/dev_into.sh
```
3. 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
```
```
bash apollo.sh build
```
`Note:` If you do not have a GPU, you can use the following script instead
```
bash apollo.sh build_cpu
```
4. Bootstrap to start ros call and Monitor module and Dreamview
```
bash scripts/bootstrap.sh
```
```
bash scripts/bootstrap.sh
```
5. Download demo record:
```
cd docs/demo_guide/
python rosbag_helper.py demo_3.5.record
```
```
cd docs/demo_guide/
python record_helper.py demo_3.5.record
```
6. Now you can play the record:
```
cyber_recorder play -f docs/demo_guide/demo_3.5.record --loop
```
```
cyber_recorder play -f docs/demo_guide/demo_3.5.record --loop
```
The `--loop` option enables record to keep playing the bag in a loop playback mode.
The `--loop` option enables record to keep playing the bag in a loop playback
mode.
7. Open Chrome and go to **localhost:8888** to access Apollo Dreamview, which
opens the screen below.
![](images/dv_trajectory.png)
The car in Dreamview is happy to move around!
opens the screen below. ![](images/dv_trajectory.png) The car in Dreamview is
happy to move around!
Congratulations!
# 运行线下演示
如果你没有车辆及车载硬件, Apollo还提供了一个计算机模拟环境,可用于演示和代码调试。
如果你没有车辆及车载硬件, Apollo 还提供了一个计算机模拟环境,可用于演示和代码调
试。
线下演示首先要Fork并且Clone Apollo在GitHub的代码,然后需要设置docker的release环境,请参照 [how_to_build_and_release](https://github.com/ApolloAuto/apollo/blob/master/docs/howto/how_to_build_and_release.md)文档中的[Install docker](https://github.com/ApolloAuto/apollo/blob/master/docs/howto/how_to_build_and_release.md#docker)章节。
线下演示首先要 Fork 并且 Clone Apollo 在 GitHub 的代码,然后需要设置 docker 的
release 环境,请参照
[how_to_build_and_release](https://github.com/ApolloAuto/apollo/blob/master/docs/howto/how_to_build_and_release.md)
档中
[Install docker](https://github.com/ApolloAuto/apollo/blob/master/docs/howto/how_to_build_and_release.md#docker)
节。
Apollo演示的安装步骤:
Apollo 演示的安装步骤:
1. 运行如下命令启动docker的release环境:
1. 运行如下命令启动 docker 的 release 环境:
```
bash docker/scripts/dev_start.sh
```
```
bash docker/scripts/dev_start.sh
```
2. 运行如下命令进入docker的release环境:
2. 运行如下命令进入 docker 的 release 环境:
```
bash docker/scripts/dev_into.sh
```
```
bash docker/scripts/dev_into.sh
```
3. 在Docker中编译Apollo:
```
bash apollo.sh build
```
`Note:` 如果没有GPU,请使用下面的命令
3. 在 Docker 中编译 Apollo:
```
bash apollo.sh build_cpu
```
```
bash apollo.sh build
```
4. 启动DreamView
```
bash scripts/bootstrap.sh
```
`Note:` 如果没有 GPU,请使用下面的命令
5. 下载demo record:
```
cd docs/demo_guide/
python rosbag_helper.py demo_3.5.record
```
```
bash apollo.sh build_cpu
```
6. 运行如下命令回放record:
4. 启动 DreamView
```
cyber_recorder play -f docs/demo_guide/demo_3.5.record --loop
```
```
bash scripts/bootstrap.sh
```
选项 `--loop` 用于设置循环回放模式.
5. 下载 demo record:
7. 打开Chrome浏览器,在地址栏输入**localhost:8888**即可访问Apollo Dreamview,如下图所示:
![](images/dv_trajectory.png)
现在你能看到有一辆汽车在模拟器里移动!
```
cd docs/demo_guide/
python record_helper.py demo_3.5.record
```
恭喜你完成了Apollo的演示步骤!
6. 运行如下命令回放 record:
```
cyber_recorder play -f docs/demo_guide/demo_3.5.record --loop
```
选项 `--loop` 用于设置循环回放模式.
7. 打开 Chrome 浏览器,在地址栏输入**localhost:8888**即可访问 Apollo Dreamview,
如下图所示: ![](images/dv_trajectory.png) 现在你能看到有一辆汽车在模拟器里移
动!
恭喜你完成了 Apollo 的演示步骤!
......@@ -15,52 +15,65 @@
# See the License for the specific language governing permissions and
# limitations under the License.
###############################################################################
"""
A script for downloading Apollo record files
"""
import os
import sys
import argparse
import subprocess
import urllib.request
import urllib.parse
import urllib.error
DOWNLOAD_LINK_PREFIX = "https://github.com/ApolloAuto/apollo/releases/download"
URL_LIST = [
"https://github.com/ApolloAuto/apollo/releases/download/v1.5.0/demo_1.5.bag",
"https://github.com/ApolloAuto/apollo/releases/download/v2.0.0/demo_2.0.bag",
"https://github.com/ApolloAuto/apollo/releases/download/v2.0.0/apollo_2.0_camera_sample.bag",
"https://github.com/ApolloAuto/apollo/releases/download/v2.5.0/demo_2.5.bag",
"https://github.com/ApolloAuto/apollo/releases/download/v1.0.0/demo_1.0.bag",
"https://github.com/ApolloAuto/apollo/releases/download/v3.5.0/demo_3.5.record",
URL_LISTING = [
"v1.0.0/demo_1.0.bag",
"v1.5.0/demo_1.5.bag",
"v2.0.0/demo_2.0.bag",
"v2.0.0/apollo_2.0_camera_sample.bag",
"v2.5.0/demo_2.5.bag",
"v3.5.0/demo_3.5.record",
]
URL_DICT = {}
for link in URL_LIST:
name = link.split("/")[-1]
URL_DICT[name] = link
def build_urls():
urls = {}
for u in URL_LISTING:
urls[os.path.basename(u)] = "{}/{}".format(DOWNLOAD_LINK_PREFIX, u)
return urls
def retrieve_rosbag(bagname):
if bagname not in URL_DICT:
def download_record(record_name, urls):
"""
Match and download record from urls, and save it locally
"""
if record_name not in urls:
print(
"bag[%s] is unknown, use one of the following rosbag names:\n%s" %
(bagname, ", ".join([name for name in URL_DICT.keys()])))
"Unknown record: {}. Type \"{} --help\" on available records.".format(
record_name,
sys.argv[0]))
return False
url = URL_DICT[bagname]
print("Downloading from %s" % url)
ret = os.system('wget %s -O %s' % (url, bagname))
return ret == 0
url = urls[record_name]
print("Downloading {}".format(url))
result = subprocess.run(["wget", url, "-O", record_name])
return result.returncode == 0
if __name__ == "__main__":
import argparse
urls = build_urls()
name_desc = "record name. Available records: {}".format(
", ".join(u for u in urls))
parser = argparse.ArgumentParser(
description='retrieve demo rosbag file from remote')
description="A script for downloading Apollo demo records")
parser.add_argument(
'name',
"name",
type=str,
help='rosbag names. You can choose one of [%s]' % ", ".join(
[name for name in URL_DICT.keys()]))
help=name_desc)
args = parser.parse_args()
if retrieve_rosbag(args.name):
print("Download %s success" % args.name)
requested_record = args.name
success = download_record(requested_record, urls)
if success:
print("Successfully downloaded {}".format(requested_record))
else:
print("Download %s failed" % args.name)
print("Bad luck, failed to download {}".format(requested_record))
......@@ -59,7 +59,7 @@ To see if the system works, use the demo 'record' to "feed" the system.
```
# You need to download the demo record using the following commands
cd docs/demo_guide/
python3 rosbag_helper.py demo_3.5.record
python3 record_helper.py demo_3.5.record
# You can now replay this demo "record" in a loop with the '-l' flag
cyber_recorder play -f docs/demo_guide/demo_3.5.record -l
......
......@@ -533,7 +533,7 @@ c.回放数据包
在终端输入以下命令下载数据包:
```
python docs/demo_guide/rosbag_helper.py demo_3.5.record
python3 docs/demo_guide/record_helper.py demo_3.5.record
```
输入以下命令可以回放数据包,在浏览器DreamView中应该可以看到回放画面。
......@@ -606,4 +606,4 @@ function check_esd_files() {
fi
}
```
不同的apollo版本可能对检查的库文件名称的要求不同,可根据实际情况建立软连接。
\ No newline at end of file
不同的apollo版本可能对检查的库文件名称的要求不同,可根据实际情况建立软连接。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册