Skip to content

Commit bf574bf

Browse files
committed
initial commit
1 parent 0dbed45 commit bf574bf

Some content is hidden

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

47 files changed

+4017
-0
lines changed

.bazelrc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
test --test_output=errors --action_env="GTEST_COLOR=1"
2+
3+
# Force bazel output to use colors (good for jenkins) and print useful errors.
4+
common --color=yes
5+
6+
build --cxxopt='-std=c++17' --define planner_rules_mcts=true --define ltl_rules=true

.github/workflows/CI.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
schedule:
6+
- cron: "0 2 * * *"
7+
8+
jobs:
9+
build:
10+
11+
runs-on: ubuntu-latest
12+
container:
13+
image: docker://barksim/bark:latest
14+
steps:
15+
- uses: actions/checkout@v1
16+
- name: Setting up virtual environment
17+
run: virtualenv -p python3 ./tools/python/venv --system-site-packages
18+
- name: Getting into venv
19+
run: . ./tools/python/venv/bin/activate
20+
- name: Runing merging_test_specific
21+
run: bazel test //src/run:merging_test_specific

README.md

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# Example Benchmark
2+
3+
Repository showing how to use BARK for research, e.g., conducting reproducible experiments. The core of this example repository is to run a benchmark of a single agent Monte Carlo Tree Search and compare it with MCTS variants, that incorporate penalties for violating traffic rules to their reward function. The study focuses on merging -- an arbitrary number of scenarios can be generated, where the initial positions and velocities of the vehicles are sampled randomly from a normal distribution.
4+
5+
## Getting started:
6+
If you are not familar with BARK yet, check out our BARK paper [paper](https://arxiv.org/abs/2003.02604) and the code documentation [documentation](https://bark-simulator.readthedocs.io/en/latest/).
7+
This repository uses a virtual environment just as BARK does (install via `bash tools/python/setup_venv.sh` and then source it via `source tools/python/into_venv.sh`)
8+
9+
## What is in there:
10+
There are three targets ready for execution
11+
* `merging_test_random`: runs N scenarios and sample the initial states randomly
12+
* `merging_test_specific`: runs a specific scenario (you can tune them)
13+
* `run_benchmark`: runs a full benchmark
14+
* `scenario_tuning`: runs a lightweight benchmark with visualization to find suitable scenario generation parameters
15+
16+
## Benchmark
17+
First, execute `bazel run //src/run:run_benchmark`. The results of the benchmark will be saved at
18+
`example_benchmark/bazel-bin/src/run/run_benchmark.runfiles/example_benchmark`. Copy the file to `results/benchmark`. The result file consists of a pandas dataframe, that represents the outcome of each benchmark simulation run. To visualize that, we have prepared an ipython notebook. You can start the notebook server via `bazel run //src/create_figures:run_notebooks` and then select the `plot_benchmark_results` notebook. The code will generate the following figure:
19+
20+
![Benchmark Results](benchmark_results.png)
21+
22+
### Changing Parameters:
23+
Parametrization in BARK is done via the `ParameterServer`, which reads json-files. You can tweak the existing ones:
24+
* for the viewer in `viewer_config/params/`
25+
* for the behavior models in `mcts_config/params/`
26+
27+
Of course, those json-files are quite nested, so we provide scripts to generate them with default values.
28+
* for the viewer: `src/viewer_config/viewer_config_test.py`
29+
* for the behavior models: `src/mcts_config/mcts_config_test.py`
30+
The concept for creating parameter files can be transferred to any other object.
31+
32+
### Evaluators:
33+
Evaluators can be used as a metric to analyze the benchmark, but also as a termination criterion for a simulation run. You can choose from any Evaluator in https://github.com/bark-simulator/bark/tree/master/bark/world/evaluation. Using EvaluatorLTL for example allows you to use a wide range of traffic rules.
34+
35+
### Scenarios:
36+
The scenarios are generated based on the config files in `src/database/scenario_sets`.
37+
38+
## Dependency Management using Bazel
39+
As you can see in the [bark-simulator Github Group](https://github.com/bark-simulator/), the BARK ecosystem is split over multiple Github repositories. One reason for this was to keep the core functionalities light-weight and reasonably fast to build. Specifically, a lot of planning modules are placed in seperate repositories. Using Bazel as our build environment enables the reproducibility of our experiments, as dependency versions of the repositories can be tracked easily.
40+
41+
For example, have a look to `tools/deps.bzl`, where the specific dependencies and either their commit hashs or a specific branch can be selected. In order to try two different versions of your planner (located in another repo), you do not build or install them manually, you just need to change the commit hash.
42+
43+
## Cite us
44+
45+
This repository contains work from multiple publications:
46+
* Traffic Rules as Evaluators: [Formalizing Traffic Rules for Machine Interpretability](https://arxiv.org/abs/2007.00330)
47+
* MCTS with Traffic Rules: [Modeling and Testing Multi-Agent Traffic Rules within Interactive Behavior Planning](https://arxiv.org/abs/2009.14186)
48+
49+
If you use them, please cite them.
50+
51+
For everything else, please cite us using the following [paper](https://arxiv.org/abs/2003.02604):
52+
53+
```
54+
@inproceedings{Bernhard2020,
55+
title = {BARK: Open Behavior Benchmarking in Multi-Agent Environments},
56+
author = {Bernhard, Julian and Esterle, Klemens and Hart, Patrick and Kessler, Tobias},
57+
booktitle = {2020 IEEE/RSJ International Conference on Intelligent Robots and Systems (IROS)},
58+
url = {https://arxiv.org/pdf/2003.02604.pdf},
59+
year = {2020}
60+
}
61+
```

WORKSPACE

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
workspace(name = "example_benchmark")
2+
3+
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive", "http_file")
4+
load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")
5+
load("//tools:deps.bzl", "example_benchmark_dependencies")
6+
7+
example_benchmark_dependencies()
8+
9+
load("@bark_project//tools:deps.bzl", "bark_dependencies")
10+
bark_dependencies()
11+
12+
load("@com_github_nelhage_rules_boost//:boost/boost.bzl", "boost_deps")
13+
boost_deps()
14+
15+
# -------- Benchmark Database -----------------------
16+
git_repository(
17+
name = "benchmark_database",
18+
commit = "422b0ddd316ab46ac79dcd72a45645e197cf7da1",
19+
remote = "https://github.com/bark-simulator/benchmark-database",
20+
)
21+
22+
load("@benchmark_database//util:deps.bzl", "benchmark_database_dependencies")
23+
benchmark_database_dependencies()
24+
25+
load("@benchmark_database//load:load.bzl", "benchmark_database_release")
26+
benchmark_database_release()
27+
28+
load("@rule_monitor_project//util:deps.bzl", "rule_monitor_dependencies")
29+
rule_monitor_dependencies()
30+
31+
load("@planner_rules_mcts//util:deps.bzl", "planner_rules_mcts_dependencies")
32+
planner_rules_mcts_dependencies()
33+
34+
load("@pybind11_bazel//:python_configure.bzl", "python_configure")
35+
python_configure(name = "local_config_python")

benchmark_results.png

13.2 KB
Loading

results/BUILD

Whitespace-only changes.

results/benchmark/BUILD

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
filegroup(
2+
name="benchmark_results",
3+
srcs=glob(["*.zip"]),
4+
visibility = ["//visibility:public"],
5+
)
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
version https://git-lfs.github.com/spec/v1
2+
oid sha256:c8934a9c77d8b59c40a22a4dcb40a7c2680a36fa3c736639e49631bb174f318b
3+
size 2063700

src/BUILD

Whitespace-only changes.

src/common/BUILD

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
py_library(
2+
name = "custom_lane_corridor_config",
3+
srcs = ["custom_lane_corridor_config.py"],
4+
data = ["@bark_project//bark/python_wrapper:core.so"],
5+
visibility = ["//visibility:public"],
6+
)

0 commit comments

Comments
 (0)