Skip to content

Commit b5d81a0

Browse files
Merge pull request #139 from motional/nuplan-devkit-v1.0
nuplan-devkit-v1.0
2 parents d1d654e + c09d028 commit b5d81a0

File tree

306 files changed

+16316
-4615
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

306 files changed

+16316
-4615
lines changed

.bazelrc

Lines changed: 28 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,33 @@
1+
# NOTE:
2+
# If you are adding something under `test`, check if it exists as a command under `build` instead:
3+
# https://bazel.build/reference/command-line-reference
4+
# If it does, add it to `build` as all test options inherit from `build`. Same for `run`.
5+
# This prevents invalidation of the analysis cache when switching between bazel build/test/run. Example warning:
6+
# INFO: Build options --action_env and --test_env have changed, discarding analysis cache.
17
build --remote_cache=http://bazel-cache.ci.motional.com:80
28
build --remote_upload_local_results=false
9+
build --sandbox_tmpfs_path=/dev/shm
10+
build --incompatible_strict_action_env
11+
12+
build --action_env=PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin
13+
build --action_env=CC=gcc # force Cython to use gcc
14+
build --action_env=CACHE=/tmp/pyxbld
15+
16+
# make sure you have defined all environment veriables listed below
17+
build --action_env=AWS_ACCESS_KEY_ID
18+
build --action_env=AWS_SECRET_ACCESS_KEY
19+
build --action_env=NUPLAN_DATA_ROOT
20+
build --action_env=NUPLAN_MAPS_ROOT
21+
build --action_env=NUPLAN_EXP_ROOT
22+
build --action_env=NUPLAN_DATA_STORE
23+
build --action_env=NUPLAN_S3_PROFILE
24+
build --action_env=NUPLAN_CACHE_FROM_S3
25+
build --action_env=NUPLAN_DATA_ROOT_S3_URL
26+
build --action_env=NUPLAN_MAPS_ROOT_S3_URL
27+
build --action_env=NUPLAN_DB_FILES
28+
build --action_env=NUPLAN_MAP_VERSION
29+
build --action_env=NUPLAN_HYDRA_CONFIG_PATH
330

431
test --test_output=errors
532
test --test_timeout=2400
6-
test --test_output=all
7-
test --test_env=WORKSPACE
8-
test --test_env=CACHE=/tmp/pyxbld
9-
test --test_env=PYTHONPATH
10-
test --test_env=AWS_ACCESS_KEY_ID
11-
test --test_env=AWS_SECRET_ACCESS_KEY
12-
13-
test --test_env=NUPLAN_DATA_ROOT
14-
test --test_env=NUPLAN_MAPS_ROOT
15-
test --test_env=NUPLAN_EXP_ROOT
16-
test --test_env=NUPLAN_DATA_STORE
17-
test --test_env=NUPLAN_S3_PROFILE
18-
test --test_env=NUPLAN_CACHE_FROM_S3
19-
test --test_env=NUPLAN_DATA_ROOT_S3_URL
20-
test --test_env=NUPLAN_MAPS_ROOT_S3_URL
21-
test --test_env=NUPLAN_DB_FILES
22-
test --test_env=NUPLAN_MAP_VERSION
23-
test --test_env=NUPLAN_HYDRA_CONFIG_PATH
33+
test --incompatible_exclusive_test_sandboxed=true

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ _ext
1919
*.o
2020
*.out
2121
*.pdf
22-
*.png
2322
.project
2423
*.pth.tar
2524
*.pyc

BUILD

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,31 @@
11
load("@com_github_bazelbuild_buildtools//buildifier:def.bzl", "buildifier")
2+
load("@rules_python//python:pip.bzl", "compile_pip_requirements")
3+
load("@bazel_skylib//rules:common_settings.bzl", "string_flag")
24

35
package(default_visibility = ["//visibility:public"])
46

7+
buildifier(
8+
name = "buildifier_nuplan",
9+
lint_mode = "fix",
10+
lint_warnings = ["+native-py"],
11+
)
12+
13+
string_flag(
14+
name = "ubuntu_distro",
15+
build_setting_default = "focal",
16+
values = [
17+
"bionic",
18+
"focal",
19+
],
20+
)
21+
22+
config_setting(
23+
name = "focal",
24+
flag_values = {
25+
":ubuntu_distro": "focal",
26+
},
27+
)
28+
529
filegroup(
630
name = "requirements",
731
data = [
@@ -16,3 +40,34 @@ buildifier(
1640
lint_warnings = ["+native-py"],
1741
mode = "check",
1842
)
43+
44+
# See the 'pip_deps' pip_parse() in WORKSPACE for further details
45+
# Validate: bazel test <targetname>_update
46+
# Generate: bazel run <targetname>.update
47+
compile_pip_requirements(
48+
name = "pip_nuplan_devkit_deps",
49+
timeout = "moderate", # Increase timeout for underlying py_tests
50+
extra_args = [
51+
"--allow-unsafe",
52+
"--index-url=https://pypi.org/simple",
53+
],
54+
requirements_in = "requirements.txt",
55+
requirements_txt = "requirements_lock.txt",
56+
tags = [
57+
"nuplan_devkit_local",
58+
],
59+
)
60+
61+
compile_pip_requirements(
62+
name = "pip_deps_torch",
63+
timeout = "moderate", # Increase timeout for underlying py_tests
64+
extra_args = [
65+
"--allow-unsafe",
66+
"--index-url=https://pypi.org/simple",
67+
],
68+
requirements_in = "requirements_torch.txt",
69+
requirements_txt = "requirements_torch_lock.txt",
70+
tags = [
71+
"nuplan_devkit_local",
72+
],
73+
)

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ ARG NUPLAN_DATA_STORE
6060

6161
ENV NUPLAN_DATA_ROOT $NUPLAN_DATA_ROOT
6262
ENV NUPLAN_MAPS_ROOT $NUPLAN_MAPS_ROOT
63-
ENV NUPLAN_DB_FILES /data/sets/nuplan/nuplan-v1.0/mini
63+
ENV NUPLAN_DB_FILES /data/sets/nuplan/nuplan-v1.1/mini
6464
ENV NUPLAN_MAP_VERSION "nuplan-maps-v1.0"
6565
ENV NUPLAN_DATA_STORE $NUPLAN_DATA_STORE
6666
ENV NUPLAN_S3_PROFILE "default"

Dockerfile.result_processor

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,14 @@ FROM 300189864575.dkr.ecr.us-east-1.amazonaws.com/nuplan-evalservice-client
22

33
ARG EVALAI_CHALLENGE_PK
44
ARG EVALAI_PERSONAL_AUTH_TOKEN
5+
ARG NUSCENES_SERVER_AWS_ACCESS_KEY_ID
6+
ARG NUSCENES_SERVER_AWS_SECRET_ACCESS_KEY
7+
ARG NUSCENES_SERVER_S3_ROOT_URL
58

69
ENV EVALAI_CHALLENGE_PK $EVALAI_CHALLENGE_PK
710
ENV EVALAI_PERSONAL_AUTH_TOKEN $EVALAI_PERSONAL_AUTH_TOKEN
11+
ENV NUSCENES_SERVER_AWS_ACCESS_KEY_ID $NUSCENES_SERVER_AWS_ACCESS_KEY_ID
12+
ENV NUSCENES_SERVER_AWS_SECRET_ACCESS_KEY $NUSCENES_SERVER_AWS_SECRET_ACCESS_KEY
13+
ENV NUSCENES_SERVER_S3_ROOT_URL $NUSCENES_SERVER_S3_ROOT_URL
814

915
CMD ["/nuplan_devkit/nuplan/entrypoint_result_processor.sh"]

Jenkinsfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ pipeline{
4040
BAZEL_OPTS = "--local_cpu_resources=8 --jobs=8 --remote_cache=http://bazel-cache.ci.motional.com:80 --remote_upload_local_results=true"
4141

4242
NUPLAN_DATA_ROOT = "/data/sets/nuplan"
43-
NUPLAN_DB_FILES = "/data/sets/nuplan/nuplan-v1.0/mini"
43+
NUPLAN_DB_FILES = "/data/sets/nuplan/nuplan-v1.1/mini"
4444
NUPLAN_MAPS_ROOT = "/data/sets/nuplan/maps"
4545
NUPLAN_MAP_VERSION = "nuplan-maps-v1.0"
4646
NUPLAN_EXP_ROOT = "/tmp/exp/nuplan"

WORKSPACE

Lines changed: 79 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,27 @@ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
44

55
http_archive(
66
name = "rules_python",
7-
sha256 = "895fa3b03898d7708eb50ed34dcfb71c07866433df6912a6ff4f4fb473048f99",
8-
strip_prefix = "rules_python-2b1d6beb4d5d8f59d629597e30e9aa519182d9a9",
7+
sha256 = "9fcf91dbcc31fde6d1edb15f117246d912c33c36f44cf681976bd886538deba6",
8+
strip_prefix = "rules_python-0.8.0",
99
urls = [
10-
"https://github.com/bazelbuild/rules_python/archive/2b1d6beb4d5d8f59d629597e30e9aa519182d9a9.tar.gz",
10+
"https://github.com/bazelbuild/rules_python/archive/refs/tags/0.8.0.tar.gz",
1111
],
1212
)
1313

1414
load("@rules_python//python/pip_install:repositories.bzl", "pip_install_dependencies")
1515

1616
pip_install_dependencies()
1717

18+
load("@rules_python//python:repositories.bzl", "python_register_toolchains")
19+
20+
python_register_toolchains(
21+
name = "python3_9",
22+
python_version = "3.9",
23+
)
24+
25+
load("@python3_9//:defs.bzl", PYTHON_INTERPRETER_TARGET = "interpreter")
26+
load("@rules_python//python:pip.bzl", "pip_parse")
27+
1828
http_archive(
1929
name = "com_github_bazelbuild_buildtools",
2030
sha256 = "932160d5694e688cb7a05ac38efba4b9a90470c75f39716d85fb1d2f95eec96d",
@@ -61,3 +71,69 @@ http_archive(
6171
load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps")
6272

6373
protobuf_deps()
74+
75+
# pip_parse() is used instead of pip_install() so that we can move pip installation to the build stage
76+
# instead of prior to the Bazel analysis phase (which is the case for pip_install()). This change will
77+
# help to speed up the overall build time and only download the dependencies as and when needed.
78+
#
79+
# pip_parse() also requires us to specify a fully resolved lock file for our Python dependencies. The
80+
# advantage to this is that it enforces fully deterministic builds. Without fully locked dependencies,
81+
# we cannot guarantee that two builds on the same commit use the same package versions.
82+
#
83+
# See:
84+
# - https://github.com/bazelbuild/rules_python#fetch-pip-dependencies-lazily
85+
# - https://github.com/bazelbuild/rules_python/blob/main/docs/pip.md#pip_parse
86+
# - https://github.com/bazelbuild/rules_python/blob/main/docs/pip.md#compile_pip_requirements
87+
#
88+
# The helper compile_pip_requirements() is used for regenerating the locked requirements.txt files.
89+
# Steps:
90+
# 1) Add/remove/modify package in requirements.txt.
91+
# 2) Validate locked requirements.txt can be generated:
92+
# bazel test //path/to/package_deps:package_deps_test
93+
# 3) Update requirements_lock.txt:
94+
# bazel run //path/to/package_deps.update
95+
# 4) Commit updated requirements_lock.txt
96+
97+
PIP_INSTALL_TIMEOUT_SECONDS = 3600 # 60 minutes
98+
99+
# "--only-binary=:all:" parameter below is to enforce pip to use prebuilt whl only,
100+
# to reduce external package preparation time.
101+
# For all packages with missing prebuilt binary, wheels are created manually and uploaded to Artifactory.
102+
# All such packages have `+av` suffix, just in case.
103+
# The project https://github.com/pypa/manylinux has been used - `quay.io/pypa/manylinux_2_24_x86_64` image
104+
#
105+
# To create and upload package, using `quay.io/pypa/manylinux_2_24_x86_64` docker image:
106+
# - download tarball from https://pypi.org/project/
107+
# - update `setup.py` and add `+av` suffix to version variable
108+
# - run `python setup.py sdist bdist_wheel upload -r nutonomypip`
109+
# Please refer to https://packaging.python.org/en/latest/tutorials/packaging-projects/ for further details
110+
111+
PIP_EXTRA_ARGS = [
112+
"--require-hashes",
113+
"--index-url=https://pypi.org/simple",
114+
]
115+
116+
# Base Python pip dependencies
117+
pip_parse(
118+
name = "pip_nuplan_devkit_deps",
119+
timeout = PIP_INSTALL_TIMEOUT_SECONDS,
120+
extra_pip_args = PIP_EXTRA_ARGS,
121+
python_interpreter_target = PYTHON_INTERPRETER_TARGET,
122+
requirements_lock = "//:requirements_lock.txt",
123+
)
124+
125+
load("@pip_nuplan_devkit_deps//:requirements.bzl", install_pip_deps = "install_deps")
126+
127+
install_pip_deps()
128+
129+
pip_parse(
130+
name = "pip_torch_deps",
131+
timeout = PIP_INSTALL_TIMEOUT_SECONDS,
132+
extra_pip_args = PIP_EXTRA_ARGS,
133+
python_interpreter_target = PYTHON_INTERPRETER_TARGET,
134+
requirements_lock = "//:requirements_torch_lock.txt",
135+
)
136+
137+
load("@pip_torch_deps//:requirements.bzl", install_pip_torch_deps = "install_deps")
138+
139+
install_pip_torch_deps()

docs/README.md

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,11 @@ ______________________________________________________________________
1010
<a href="https://www.nuscenes.org/nuplan#download">Download</a> •
1111
<a href="#citation">Citation</a><br>
1212
<a href="#changelog">Changelog</a> •
13-
<a href="#devkit-structure">Structure</a><br>
14-
<a href="https://github.com/motional/nuplan-devkit/blob/master/docs/installation.md">Setup</a> •
15-
<a href="https://github.com/motional/nuplan-devkit/blob/master/tutorials/nuplan_framework.ipynb">Tutorial</a>
13+
<a href="#devkit-structure">Structure</a> •
14+
<a href="https://github.com/motional/nuplan-devkit/blob/master/docs/installation.md">Setup</a> <br>
15+
<a href="https://github.com/motional/nuplan-devkit/blob/master/tutorials/nuplan_framework.ipynb">Tutorial</a> •
16+
<a href="https://nuplan-devkit.readthedocs.io/en/latest/">Documentation</a> •
17+
<a href="https://eval.ai/web/challenges/challenge-page/1856/overview">Competition</a>
1618
</p>
1719

1820
[![python](https://img.shields.io/badge/python-%20%203.9-blue.svg)]()
@@ -28,13 +30,17 @@ ______________________________________________________________________
2830
</div>
2931

3032
______________________________________________________________________
31-
## nuPlan Planning Challenge is live!
32-
The nuPlan Planning Challenge is now live! The warm-up stage has begun. Please check our competition landing [page](https://nuplan-devkit.readthedocs.io/en/latest/).
33+
## Planning challenges
34+
#### The nuPlan Planning Competition has been postponed to January 2023.
35+
#### The nuPlan Dataset v1.1 has been released. Please download the latest dataset from the nuPlan [page](https://www.nuscenes.org/nuplan#download).
3336
______________________________________________________________________
3437

3538
## Changelog
39+
- Oct 13th 2022
40+
* v1.1 Dataset: Full nuPlan dataset - improved route plan, traffic light status, mission goal and more!
41+
* v1.0 Devkit: Update to nuplan-v1.1 dataset, metrics improvements, route plan fixes, documentation, IDMPlanner
3642
- Sep 09 2022
37-
* v0.6 Devkit: COMPETITION WARM-UP PHASE RELEASE - smart agents optimizations, nuBoard improvements, metrics improvements, submission pipeline deployment and documentation.
43+
* v0.6 Devkit: Smart agents optimizations, nuBoard improvements, metrics improvements, submission pipeline deployment and documentation.
3844
- Aug 26 2022
3945
* v0.5 Devkit: New map features, simulation improvements, open-loop detections with smart agents, iLQR tracker, metrics improvements and documentation.
4046
- Aug 05 2022
@@ -54,9 +60,9 @@ ______________________________________________________________________
5460
______________________________________________________________________
5561

5662
## Devkit and dataset setup
57-
Please refer to the [installation page](https://github.com/motional/nuplan-devkit/blob/master/docs/installation.md) for detailed instructions on how to setup the devkit.
63+
Please refer to the [installation page](https://nuplan-devkit.readthedocs.io/en/latest/installation.html) for detailed instructions on how to setup the devkit.
5864

59-
Please refer to the [dataset page](https://github.com/motional/nuplan-devkit/blob/master/docs/dataset_setup.md) for detailed instructions on how to download and setup the dataset.
65+
Please refer to the [dataset page](https://nuplan-devkit.readthedocs.io/en/latest/dataset_setup.html) for detailed instructions on how to download and setup the dataset.
6066

6167
______________________________________________________________________
6268

@@ -83,6 +89,11 @@ Please follow these steps to make yourself familiar with the nuPlan dataset:
8389

8490
______________________________________________________________________
8591

92+
## Performance tuning guide
93+
Training configurations are important to ensure your expected system performance, for example preprocessing cost, training speed, and numerical stability. If you encounter problems related to aforementioned aspects, please refer to [performance tuning guide](https://github.com/motional/nuplan-devkit/blob/master/docs/performance_tuning_guide.md) to find potential solutions.
94+
95+
______________________________________________________________________
96+
8697
## Devkit structure
8798
Our code is organized in these directories:
8899

@@ -93,12 +104,14 @@ nuplan_devkit
93104
├── nuplan - The main source folder.
94105
│ ├── common - Code shared by "database" and "planning".
95106
│ ├── database - The core devkit used to load and render nuPlan dataset and maps.
96-
│ └── planning - The stand-alone planning framework for simulation, training and evaluation.
107+
│ ├── planning - The stand-alone planning framework for simulation, training and evaluation.
108+
│ ├── submission - The submission engine used for the planning challenge.
97109
│ └── cli - Command line interface tools for the nuPlan database.
98110
└── tutorials - Interactive tutorials, see "Getting started".
99111
```
100112
______________________________________________________________________
101113

114+
102115
## Citation
103116
Please use the following citation when referencing [nuPlan](https://arxiv.org/abs/2106.11810):
104117
```

docs/baselines.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Baselines
2+
3+
We provide several baselines within the devkit. These baselines are standard comparison points in which to compare new
4+
planners. Moreover, the baselines serve as a starting point for users to prototype their planner or simply tinker with it.
5+
6+
## SimplePlanner
7+
The SimplePlanner, as the name suggests, has little planning capability. The planner plans a straight line at a constant
8+
speed. The only logic of this planner is to decelerate if the current velocity exceeds the `max_velocity`.
9+
10+
Link to the [code](https://github.com/motional/nuplan-devkit/blob/master/nuplan/planning/simulation/planner/simple_planner.py)
11+
12+
## IDMPlanner
13+
The Intelligent Driver Model Planner (IDMPlanner) consists of two parts:
14+
15+
1. Path planning
16+
2. Longitudinal control (IDM policy)
17+
18+
### Path planning
19+
The path planning is a breadth-first search algorithm. It finds a path towards the mission goal.
20+
The path consists of a serie of lane and lane connectors that leads to the roadblock containing the mission goal.
21+
The baseline is then extracted from the found path and is used as the reference path for the planner.
22+
23+
### IDM Policy
24+
Now that the planner has a reference path, it must then decide how fast to go along this path. For this, it follows
25+
the [IDM policy](https://en.wikipedia.org/wiki/Intelligent_driver_model). The policy describes how fast the planner should
26+
go based on the distance between itself and a given agent. Of course, it is wise to choose the closest agent in the path of the planner.
27+
28+
Hence, the IDMPlanner uses breadth-first search to find the path towards the mission goal, and the IDM policy describes how far along that path the planner should be.
29+
30+
Link to the [code](https://github.com/motional/nuplan-devkit/blob/master/nuplan/planning/simulation/planner/idm_planner.py)

0 commit comments

Comments
 (0)