Upload 385 files
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- .gitattributes +2 -0
- gpudrive-main/.dockerignore +6 -0
- gpudrive-main/.env.template +13 -0
- gpudrive-main/.github/workflows/ci.yml +42 -0
- gpudrive-main/.gitignore +258 -0
- gpudrive-main/.gitmodules +6 -0
- gpudrive-main/.pre-commit-config.yaml +18 -0
- gpudrive-main/.python-version +1 -0
- gpudrive-main/CMakeLists.txt +17 -0
- gpudrive-main/Dockerfile +52 -0
- gpudrive-main/LICENSE +21 -0
- gpudrive-main/README.md +383 -0
- gpudrive-main/README_SHOW.md +700 -0
- gpudrive-main/assets/GPUDrive_eval_with_humans_control_6.gif +3 -0
- gpudrive-main/assets/Lidar120.gif +3 -0
- gpudrive-main/assets/Lidar360.gif +3 -0
- gpudrive-main/assets/agent_collision.obj +212 -0
- gpudrive-main/assets/agent_collision_simplified.obj +18 -0
- gpudrive-main/assets/agent_render.obj +0 -0
- gpudrive-main/assets/cube_collision.obj +18 -0
- gpudrive-main/assets/cube_render.obj +44 -0
- gpudrive-main/assets/cylinder_collision.obj +54 -0
- gpudrive-main/assets/cylinder_render.obj +180 -0
- gpudrive-main/assets/distribution.png +3 -0
- gpudrive-main/assets/elongated_collision.obj +18 -0
- gpudrive-main/assets/elongated_render.obj +44 -0
- gpudrive-main/assets/example_scene.gif +3 -0
- gpudrive-main/assets/gpudrive_gif_collage.gif +3 -0
- gpudrive-main/assets/green_agent.svg +104 -0
- gpudrive-main/assets/green_grid.png +3 -0
- gpudrive-main/assets/multi_actors_demo_control_3_different.gif +3 -0
- gpudrive-main/assets/multi_actors_demo_control_multiple.gif +3 -0
- gpudrive-main/assets/navigation.png +3 -0
- gpudrive-main/assets/obs_video_0_10.gif +3 -0
- gpudrive-main/assets/obs_video_7.gif +3 -0
- gpudrive-main/assets/obs_video_clear_example.gif +3 -0
- gpudrive-main/assets/pink_agent.svg +108 -0
- gpudrive-main/assets/plane.obj +15 -0
- gpudrive-main/assets/ramp_collision.obj +15 -0
- gpudrive-main/assets/ramp_render.obj +36 -0
- gpudrive-main/assets/sim_video_0_10.gif +3 -0
- gpudrive-main/assets/sim_video_7.gif +3 -0
- gpudrive-main/assets/sim_video_clear_example.gif +3 -0
- gpudrive-main/assets/smile.png +3 -0
- gpudrive-main/assets/wall_collision.obj +18 -0
- gpudrive-main/assets/wall_render.obj +44 -0
- gpudrive-main/assets/yellow_agent.svg +108 -0
- gpudrive-main/baselines/__init__.py +0 -0
- gpudrive-main/baselines/imitation_data_generation.py +279 -0
- gpudrive-main/baselines/ppo/README.md +106 -0
.gitattributes
CHANGED
|
@@ -58,3 +58,5 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 58 |
# Video files - compressed
|
| 59 |
*.mp4 filter=lfs diff=lfs merge=lfs -text
|
| 60 |
*.webm filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
| 58 |
# Video files - compressed
|
| 59 |
*.mp4 filter=lfs diff=lfs merge=lfs -text
|
| 60 |
*.webm filter=lfs diff=lfs merge=lfs -text
|
| 61 |
+
gpudrive-main/papers/LLM评估场景.pdf filter=lfs diff=lfs merge=lfs -text
|
| 62 |
+
gpudrive-main/server_resource/event_traces.jsonl filter=lfs diff=lfs merge=lfs -text
|
gpudrive-main/.dockerignore
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Dockerfile
|
| 2 |
+
.*
|
| 3 |
+
!.git
|
| 4 |
+
!.gitignore
|
| 5 |
+
!.gitmodules
|
| 6 |
+
!.python-version
|
gpudrive-main/.env.template
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# .env template
|
| 2 |
+
|
| 3 |
+
# Path for logs
|
| 4 |
+
LOG_FOLDER=
|
| 5 |
+
|
| 6 |
+
# Your HPC account code
|
| 7 |
+
NYU_HPC_ACCOUNT=
|
| 8 |
+
|
| 9 |
+
# NYU ID
|
| 10 |
+
USERNAME=
|
| 11 |
+
|
| 12 |
+
SINGULARITY_IMAGE=
|
| 13 |
+
OVERLAY_FILE=
|
gpudrive-main/.github/workflows/ci.yml
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
name: Continuous Integration
|
| 2 |
+
|
| 3 |
+
on:
|
| 4 |
+
push:
|
| 5 |
+
branches: [main]
|
| 6 |
+
pull_request:
|
| 7 |
+
|
| 8 |
+
jobs:
|
| 9 |
+
build-and-smoketest:
|
| 10 |
+
runs-on: ubuntu-latest
|
| 11 |
+
|
| 12 |
+
steps:
|
| 13 |
+
- name: Checkout repository
|
| 14 |
+
uses: actions/checkout@v4
|
| 15 |
+
|
| 16 |
+
- name: Set up Docker Buildx
|
| 17 |
+
uses: docker/setup-buildx-action@v2
|
| 18 |
+
|
| 19 |
+
- name: Build Docker image
|
| 20 |
+
run: docker build --tag gpudrive:latest .
|
| 21 |
+
|
| 22 |
+
- name: Run smoke test inside Docker container (using a here document)
|
| 23 |
+
run: |
|
| 24 |
+
docker run --rm gpudrive:latest /bin/bash -c "$(cat << 'EOF'
|
| 25 |
+
#!/bin/bash
|
| 26 |
+
set -e
|
| 27 |
+
set -x
|
| 28 |
+
export DEBIAN_FRONTEND=noninteractive
|
| 29 |
+
echo 'Dummy cuda'
|
| 30 |
+
ln -s /usr/local/cuda/lib64/stubs/libcuda.so /usr/local/cuda/lib64/stubs/libcuda.so.1
|
| 31 |
+
export LD_LIBRARY_PATH=/usr/local/cuda/lib64/stubs/:$LD_LIBRARY_PATH
|
| 32 |
+
echo 'Modifications to run without extra data'
|
| 33 |
+
sed -i 's|train_path: \"data/processed/training\"|train_path: \"data/processed/examples\"|g' examples/experimental/config/visualization_config.yaml
|
| 34 |
+
sed -i '/# Load policy/{N;N;N;N;N;N;s|# Load policy\n policy = load_policy(\n path_to_cpt=config.cpt_path,\n model_name=config.cpt_name,\n device=config.device,\n env=env,\n )|from gpudrive.networks.late_fusion import NeuralNet\n policy = NeuralNet.from_pretrained(\"daphne-cornelisse/policy_S10_000_02_27\")|}' examples/experimental/viz_rollouts.py
|
| 35 |
+
echo 'Modifications to run without GPU'
|
| 36 |
+
sed -i 's/device=\"cuda\"/device=\"cpu\"/g' gpudrive/datatypes/observation.py
|
| 37 |
+
export PYTHONFAULTHANDLER=1
|
| 38 |
+
ulimit -c unlimited
|
| 39 |
+
echo 'Run smoketest'
|
| 40 |
+
/gpudrive/.venv/bin/python examples/experimental/viz_rollouts.py
|
| 41 |
+
EOF
|
| 42 |
+
)"
|
gpudrive-main/.gitignore
ADDED
|
@@ -0,0 +1,258 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/build
|
| 2 |
+
/out
|
| 3 |
+
/build-debug
|
| 4 |
+
/.vs
|
| 5 |
+
/CMakeSettings.json
|
| 6 |
+
/scripts/__pycache__
|
| 7 |
+
/train_src/madrona_escape_room_learn/__pycache__
|
| 8 |
+
.vscode/launch.json
|
| 9 |
+
.vscode/settings.json
|
| 10 |
+
.vscode/tasks.json
|
| 11 |
+
.uv_cache
|
| 12 |
+
|
| 13 |
+
/examples/benchmarks/results/
|
| 14 |
+
/baselines/ppo/logs/*
|
| 15 |
+
*.sif
|
| 16 |
+
/cloudpickle
|
| 17 |
+
/cloudpickle-3.0.0.dist-info
|
| 18 |
+
*madrona.diff
|
| 19 |
+
/bin
|
| 20 |
+
/zipp*
|
| 21 |
+
/google-cloud-sdk/*
|
| 22 |
+
*.gz
|
| 23 |
+
|
| 24 |
+
# Data
|
| 25 |
+
hpc/overlay*
|
| 26 |
+
data/raw/*
|
| 27 |
+
data/processed/validation/*
|
| 28 |
+
data/processed/training/*
|
| 29 |
+
data/processed/testing/*
|
| 30 |
+
data/processed/sampled/*
|
| 31 |
+
data/processed/hand_designed/*
|
| 32 |
+
analyze/figures/*
|
| 33 |
+
|
| 34 |
+
# Logging
|
| 35 |
+
/wandb
|
| 36 |
+
/wandb*
|
| 37 |
+
events.out.tfevents.*
|
| 38 |
+
/runs*
|
| 39 |
+
|
| 40 |
+
### C++ ###
|
| 41 |
+
# Prerequisites
|
| 42 |
+
*.d
|
| 43 |
+
|
| 44 |
+
# Compiled Object files
|
| 45 |
+
*.slo
|
| 46 |
+
*.lo
|
| 47 |
+
*.o
|
| 48 |
+
|
| 49 |
+
# Precompiled Headers
|
| 50 |
+
*.gch
|
| 51 |
+
*.pch
|
| 52 |
+
|
| 53 |
+
# Compiled Dynamic libraries
|
| 54 |
+
*.so
|
| 55 |
+
*.dylib
|
| 56 |
+
*.dll
|
| 57 |
+
|
| 58 |
+
# Fortran module files
|
| 59 |
+
*.mod
|
| 60 |
+
*.smod
|
| 61 |
+
|
| 62 |
+
# Compiled Static libraries
|
| 63 |
+
*.lai
|
| 64 |
+
*.la
|
| 65 |
+
*.a
|
| 66 |
+
*.lib
|
| 67 |
+
|
| 68 |
+
# Executables
|
| 69 |
+
*.exe
|
| 70 |
+
*.out
|
| 71 |
+
*.app
|
| 72 |
+
|
| 73 |
+
### Python ###
|
| 74 |
+
# Byte-compiled / optimized / DLL files
|
| 75 |
+
__pycache__/
|
| 76 |
+
*.py[cod]
|
| 77 |
+
*$py.class
|
| 78 |
+
|
| 79 |
+
# C extensions
|
| 80 |
+
|
| 81 |
+
# Distribution / packaging
|
| 82 |
+
.Python
|
| 83 |
+
build/
|
| 84 |
+
develop-eggs/
|
| 85 |
+
dist/
|
| 86 |
+
downloads/
|
| 87 |
+
eggs/
|
| 88 |
+
.eggs/
|
| 89 |
+
lib/
|
| 90 |
+
lib64/
|
| 91 |
+
parts/
|
| 92 |
+
sdist/
|
| 93 |
+
var/
|
| 94 |
+
wheels/
|
| 95 |
+
share/python-wheels/
|
| 96 |
+
*.egg-info/
|
| 97 |
+
.installed.cfg
|
| 98 |
+
*.egg
|
| 99 |
+
MANIFEST
|
| 100 |
+
*.csv
|
| 101 |
+
|
| 102 |
+
# PyInstaller
|
| 103 |
+
# Usually these files are written by a python script from a template
|
| 104 |
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
| 105 |
+
*.manifest
|
| 106 |
+
*.spec
|
| 107 |
+
|
| 108 |
+
# Installer logs
|
| 109 |
+
pip-log.txt
|
| 110 |
+
pip-delete-this-directory.txt
|
| 111 |
+
|
| 112 |
+
# Unit test / coverage reports
|
| 113 |
+
htmlcov/
|
| 114 |
+
.tox/
|
| 115 |
+
.nox/
|
| 116 |
+
.coverage
|
| 117 |
+
.coverage.*
|
| 118 |
+
.cache
|
| 119 |
+
nosetests.xml
|
| 120 |
+
coverage.xml
|
| 121 |
+
*.cover
|
| 122 |
+
*.py,cover
|
| 123 |
+
.hypothesis/
|
| 124 |
+
.pytest_cache/
|
| 125 |
+
cover/
|
| 126 |
+
|
| 127 |
+
# Translations
|
| 128 |
+
*.mo
|
| 129 |
+
*.pot
|
| 130 |
+
|
| 131 |
+
# Django stuff:
|
| 132 |
+
*.log
|
| 133 |
+
local_settings.py
|
| 134 |
+
db.sqlite3
|
| 135 |
+
db.sqlite3-journal
|
| 136 |
+
|
| 137 |
+
# Flask stuff:
|
| 138 |
+
instance/
|
| 139 |
+
.webassets-cache
|
| 140 |
+
|
| 141 |
+
# Scrapy stuff:
|
| 142 |
+
.scrapy
|
| 143 |
+
|
| 144 |
+
# Sphinx documentation
|
| 145 |
+
docs/_build/
|
| 146 |
+
|
| 147 |
+
# PyBuilder
|
| 148 |
+
.pybuilder/
|
| 149 |
+
target/
|
| 150 |
+
|
| 151 |
+
# Jupyter Notebook
|
| 152 |
+
.ipynb_checkpoints
|
| 153 |
+
|
| 154 |
+
# IPython
|
| 155 |
+
profile_default/
|
| 156 |
+
ipython_config.py
|
| 157 |
+
|
| 158 |
+
# pipenv
|
| 159 |
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
| 160 |
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
| 161 |
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
| 162 |
+
# install all needed dependencies.
|
| 163 |
+
Pipfile.lock
|
| 164 |
+
|
| 165 |
+
# poetry
|
| 166 |
+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
| 167 |
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
| 168 |
+
# commonly ignored for libraries.
|
| 169 |
+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
| 170 |
+
poetry.lock
|
| 171 |
+
|
| 172 |
+
# pdm
|
| 173 |
+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
| 174 |
+
pdm.lock
|
| 175 |
+
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
|
| 176 |
+
# in version control.
|
| 177 |
+
# https://pdm.fming.dev/#use-with-ide
|
| 178 |
+
.pdm.toml
|
| 179 |
+
|
| 180 |
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
| 181 |
+
__pypackages__/
|
| 182 |
+
|
| 183 |
+
# Celery stuff
|
| 184 |
+
celerybeat-schedule
|
| 185 |
+
celerybeat.pid
|
| 186 |
+
|
| 187 |
+
# SageMath parsed files
|
| 188 |
+
*.sage.py
|
| 189 |
+
|
| 190 |
+
# Environments
|
| 191 |
+
.venv
|
| 192 |
+
venv/
|
| 193 |
+
ENV/
|
| 194 |
+
env.bak/
|
| 195 |
+
venv.bak/
|
| 196 |
+
|
| 197 |
+
# Spyder project settings
|
| 198 |
+
.spyderproject
|
| 199 |
+
.spyproject
|
| 200 |
+
|
| 201 |
+
# Rope project settings
|
| 202 |
+
.ropeproject
|
| 203 |
+
|
| 204 |
+
# mkdocs documentation
|
| 205 |
+
/site
|
| 206 |
+
|
| 207 |
+
# mypy
|
| 208 |
+
.mypy_cache/
|
| 209 |
+
.dmypy.json
|
| 210 |
+
dmypy.json
|
| 211 |
+
|
| 212 |
+
# Pyre type checker
|
| 213 |
+
.pyre/
|
| 214 |
+
|
| 215 |
+
# pytype static type analyzer
|
| 216 |
+
.pytype/
|
| 217 |
+
|
| 218 |
+
# Cython debug symbols
|
| 219 |
+
cython_debug/
|
| 220 |
+
|
| 221 |
+
# PyCharm
|
| 222 |
+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
| 223 |
+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
| 224 |
+
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
| 225 |
+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
| 226 |
+
#.idea/
|
| 227 |
+
|
| 228 |
+
### Python Patch ###
|
| 229 |
+
# Poetry local configuration file - https://python-poetry.org/docs/configuration/#local-configuration
|
| 230 |
+
poetry.toml
|
| 231 |
+
|
| 232 |
+
# ruff
|
| 233 |
+
.ruff_cache/
|
| 234 |
+
|
| 235 |
+
# LSP config files
|
| 236 |
+
pyrightconfig.json
|
| 237 |
+
|
| 238 |
+
*~
|
| 239 |
+
|
| 240 |
+
# Environment variables
|
| 241 |
+
# To be manually created using .env.template
|
| 242 |
+
.env
|
| 243 |
+
|
| 244 |
+
# Logs
|
| 245 |
+
examples/experimental/logs/*
|
| 246 |
+
|
| 247 |
+
# Sbatch scripts
|
| 248 |
+
*.sh
|
| 249 |
+
|
| 250 |
+
# Videos
|
| 251 |
+
videos/
|
| 252 |
+
output_videos_larger_dataset/
|
| 253 |
+
output_videos_small_dataset/
|
| 254 |
+
|
| 255 |
+
# Trained models
|
| 256 |
+
models/
|
| 257 |
+
|
| 258 |
+
# End of https://www.toptal.com/developers/gitignore/api/python,c++
|
gpudrive-main/.gitmodules
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
[submodule "external/madrona"]
|
| 2 |
+
path = external/madrona
|
| 3 |
+
url = https://github.com/m-naumann/madrona.git
|
| 4 |
+
[submodule "external/json"]
|
| 5 |
+
path = external/json
|
| 6 |
+
url = https://github.com/nlohmann/json.git
|
gpudrive-main/.pre-commit-config.yaml
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
repos:
|
| 2 |
+
- repo: https://github.com/pre-commit/pre-commit-hooks
|
| 3 |
+
rev: v4.0.1 # Use the latest version
|
| 4 |
+
hooks:
|
| 5 |
+
- id: trailing-whitespace
|
| 6 |
+
- id: end-of-file-fixer
|
| 7 |
+
- id: check-yaml
|
| 8 |
+
- id: check-added-large-files
|
| 9 |
+
|
| 10 |
+
- repo: https://github.com/pycqa/flake8
|
| 11 |
+
rev: 3.9.2 # Use the latest version
|
| 12 |
+
hooks:
|
| 13 |
+
- id: flake8
|
| 14 |
+
- repo: https://github.com/psf/black
|
| 15 |
+
rev: 22.3.0 # Use the latest version
|
| 16 |
+
hooks:
|
| 17 |
+
- id: black
|
| 18 |
+
args: [--line-length, "79"]
|
gpudrive-main/.python-version
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
3.11
|
gpudrive-main/CMakeLists.txt
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
cmake_minimum_required(VERSION 3.24 FATAL_ERROR) # for madrona
|
| 2 |
+
|
| 3 |
+
include("${CMAKE_CURRENT_SOURCE_DIR}/external/madrona/cmake/madrona_init.cmake")
|
| 4 |
+
|
| 5 |
+
project(Madrona3DExample LANGUAGES C CXX)
|
| 6 |
+
|
| 7 |
+
include(setup)
|
| 8 |
+
include(dependencies)
|
| 9 |
+
|
| 10 |
+
add_subdirectory(external)
|
| 11 |
+
option(GPUDRIVE_BUILD_TESTS "Build GPUDrive C++ tests" ON)
|
| 12 |
+
|
| 13 |
+
add_subdirectory(src)
|
| 14 |
+
if (GPUDRIVE_BUILD_TESTS)
|
| 15 |
+
enable_testing()
|
| 16 |
+
add_subdirectory(tests)
|
| 17 |
+
endif()
|
gpudrive-main/Dockerfile
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Base image with CUDA and cuDNN support
|
| 2 |
+
FROM nvidia/cuda:12.4.1-cudnn-devel-ubuntu22.04
|
| 3 |
+
|
| 4 |
+
ARG DEBIAN_FRONTEND=noninteractive
|
| 5 |
+
|
| 6 |
+
# Install essential packages
|
| 7 |
+
RUN apt-get update && apt-get install -y -q --no-install-recommends \
|
| 8 |
+
software-properties-common \
|
| 9 |
+
build-essential \
|
| 10 |
+
cmake \
|
| 11 |
+
git \
|
| 12 |
+
curl \
|
| 13 |
+
vim \
|
| 14 |
+
ca-certificates \
|
| 15 |
+
libjpeg-dev \
|
| 16 |
+
libpng-dev \
|
| 17 |
+
wget \
|
| 18 |
+
libx11-dev \
|
| 19 |
+
libxrandr-dev \
|
| 20 |
+
libxinerama-dev \
|
| 21 |
+
libxcursor-dev \
|
| 22 |
+
libxi-dev \
|
| 23 |
+
mesa-common-dev \
|
| 24 |
+
libc++1 \
|
| 25 |
+
openssh-client \
|
| 26 |
+
ffmpeg \
|
| 27 |
+
&& apt-get clean \
|
| 28 |
+
&& rm -rf /var/lib/apt/lists/*
|
| 29 |
+
|
| 30 |
+
# Install uv
|
| 31 |
+
RUN curl -LsSf https://astral.sh/uv/install.sh | env UV_INSTALL_DIR="/usr/bin" sh
|
| 32 |
+
|
| 33 |
+
# Copy the gpudrive repository
|
| 34 |
+
COPY . /gpudrive
|
| 35 |
+
WORKDIR /gpudrive
|
| 36 |
+
RUN git submodule update --init --recursive
|
| 37 |
+
|
| 38 |
+
# Install python part using uv
|
| 39 |
+
RUN uv sync --frozen
|
| 40 |
+
|
| 41 |
+
ENV MADRONA_MWGPU_KERNEL_CACHE=./gpudrive_cache
|
| 42 |
+
|
| 43 |
+
RUN mkdir build
|
| 44 |
+
WORKDIR /gpudrive/build
|
| 45 |
+
RUN uv run cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_POLICY_VERSION_MINIMUM=3.5 && find external -type f -name "*.tar" -delete
|
| 46 |
+
RUN ln -s /usr/local/cuda/lib64/stubs/libcuda.so /usr/local/cuda/lib64/stubs/libcuda.so.1
|
| 47 |
+
RUN LD_LIBRARY_PATH=/usr/local/cuda/lib64/stubs/:$LD_LIBRARY_PATH uv run make -j
|
| 48 |
+
RUN rm /usr/local/cuda/lib64/stubs/libcuda.so.1
|
| 49 |
+
WORKDIR /gpudrive
|
| 50 |
+
|
| 51 |
+
CMD ["/bin/bash"]
|
| 52 |
+
LABEL org.opencontainers.image.source=https://github.com/Emerge-Lab/gpudrive
|
gpudrive-main/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
MIT License
|
| 2 |
+
|
| 3 |
+
Copyright (c) 2024 Saman Kazemkhani, Aarav Pandya, Daphne Cornelisse, Brennan Shacklett, Eugene Vinitsky
|
| 4 |
+
|
| 5 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
| 6 |
+
of this software and associated documentation files (the "Software"), to deal
|
| 7 |
+
in the Software without restriction, including without limitation the rights
|
| 8 |
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
| 9 |
+
copies of the Software, and to permit persons to whom the Software is
|
| 10 |
+
furnished to do so, subject to the following conditions:
|
| 11 |
+
|
| 12 |
+
The above copyright notice and this permission notice shall be included in all
|
| 13 |
+
copies or substantial portions of the Software.
|
| 14 |
+
|
| 15 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
| 16 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
| 17 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
| 18 |
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
| 19 |
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
| 20 |
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
| 21 |
+
SOFTWARE.
|
gpudrive-main/README.md
ADDED
|
@@ -0,0 +1,383 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
GPUDrive
|
| 2 |
+
========
|
| 3 |
+
|
| 4 |
+
[](https://arxiv.org/abs/2408.01584)
|
| 5 |
+
[](https://github.com/Emerge-Lab/gpudrive/actions/workflows/ci.yml)
|
| 6 |
+
[](LICENSE)
|
| 7 |
+

|
| 8 |
+
|
| 9 |
+
An extremely fast, data-driven driving simulator written in C++.
|
| 10 |
+
|
| 11 |
+
## Highlights
|
| 12 |
+
|
| 13 |
+
- ⚡️ Fast simulation for agent development and evaluation at 1 million FPS through the [Madrona engine](https://madrona-engine.github.io/).
|
| 14 |
+
- 🐍 Provides Python bindings and `gymnasium` wrappers in `torch` and `jax`.
|
| 15 |
+
- 🏃➡️ Compatible with the [Waymo Open Motion Dataset](https://github.com/waymo-research/waymo-open-dataset), featuring over 100K scenarios with human demonstrations.
|
| 16 |
+
- 📜 Readily available PPO implementations via [SB3](https://github.com/DLR-RM/stable-baselines3) and [CleanRL](https://github.com/vwxyzjn/cleanrl) / [Pufferlib](https://puffer.ai/).
|
| 17 |
+
- 👀 Easily configure the simulator and agent views.
|
| 18 |
+
- 🎨 Diverse agent types: Vehicles, cyclists and pedestrians.
|
| 19 |
+
|
| 20 |
+
<div align="center">
|
| 21 |
+
|
| 22 |
+
| Simulator state | Agent observation |
|
| 23 |
+
| ---------------------------------------------------------------- | ---------------------------------------------------------------- |
|
| 24 |
+
| <img src="assets/sim_video_7.gif" width="320px"> | <img src="assets/obs_video_7.gif" width="320px"> |
|
| 25 |
+
| <img src="assets/sim_video_0_10.gif" width="320px"> | <img src="assets/obs_video_0_10.gif" width="320px"> |
|
| 26 |
+
|
| 27 |
+
</div>
|
| 28 |
+
|
| 29 |
+
For details, see our [paper](https://arxiv.org/abs/2408.01584) and the [introduction tutorials](https://github.com/Emerge-Lab/gpudrive/tree/main/examples/tutorials), which guide you through the basic usage.
|
| 30 |
+
|
| 31 |
+
## Installation
|
| 32 |
+
|
| 33 |
+
To build GPUDrive, ensure you have all the required dependencies listed [here](https://github.com/shacklettbp/madrona#dependencies) including CMake, Python, and the CUDA Toolkit. See the details below.
|
| 34 |
+
|
| 35 |
+
<details> <summary>Dependencies</summary>
|
| 36 |
+
|
| 37 |
+
- CMake >= 3.24
|
| 38 |
+
- Python >= 3.11
|
| 39 |
+
- CUDA Toolkit >= 12.2 and <= 12.4 (We do not support CUDA versions 12.5+ at this time. Verify your CUDA version using nvcc --version.)
|
| 40 |
+
- On macOS and Windows, install the required dependencies for XCode and Visual Studio C++ tools, respectively.
|
| 41 |
+
|
| 42 |
+
</details>
|
| 43 |
+
|
| 44 |
+
After installing the necessary dependencies, clone the repository (don't forget the --recursive flag!):
|
| 45 |
+
|
| 46 |
+
```bash
|
| 47 |
+
git clone --recursive https://github.com/Emerge-Lab/gpudrive.git
|
| 48 |
+
cd gpudrive
|
| 49 |
+
```
|
| 50 |
+
|
| 51 |
+
Then, there are two options for building the simulator:
|
| 52 |
+
|
| 53 |
+
---
|
| 54 |
+
|
| 55 |
+
<details>
|
| 56 |
+
<summary>🔧 Option 1. Manual install </summary>
|
| 57 |
+
|
| 58 |
+
For Linux and macOS, use the following commands:
|
| 59 |
+
|
| 60 |
+
```bash
|
| 61 |
+
mkdir build
|
| 62 |
+
cd build
|
| 63 |
+
cmake .. -DCMAKE_BUILD_TYPE=Release
|
| 64 |
+
make -j # cores to build with, e.g. 32
|
| 65 |
+
cd ..
|
| 66 |
+
```
|
| 67 |
+
|
| 68 |
+
For Windows, open the cloned repository in Visual Studio and build the project using the integrated `cmake` functionality.
|
| 69 |
+
|
| 70 |
+
Next, set up a Python environment
|
| 71 |
+
|
| 72 |
+
#### With uv (Recommended)
|
| 73 |
+
|
| 74 |
+
Create a virtual environment and install the Python components of the repository:
|
| 75 |
+
|
| 76 |
+
```bash
|
| 77 |
+
uv sync --frozen
|
| 78 |
+
```
|
| 79 |
+
|
| 80 |
+
#### With pyenv
|
| 81 |
+
|
| 82 |
+
Create a virtual environment:
|
| 83 |
+
|
| 84 |
+
```bash
|
| 85 |
+
pyenv virtualenv 3.11 gpudrive
|
| 86 |
+
pyenv activate gpudrive
|
| 87 |
+
```
|
| 88 |
+
|
| 89 |
+
Set it for the current project directory (optional):
|
| 90 |
+
|
| 91 |
+
```bash
|
| 92 |
+
pyenv local gpudrive
|
| 93 |
+
```
|
| 94 |
+
|
| 95 |
+
#### With conda
|
| 96 |
+
|
| 97 |
+
```bash
|
| 98 |
+
conda env create -f ./environment.yml
|
| 99 |
+
conda activate gpudrive
|
| 100 |
+
```
|
| 101 |
+
|
| 102 |
+
### Install Python package
|
| 103 |
+
|
| 104 |
+
Finally, install the Python components of the repository using pip (this step is not required for the `uv` installation):
|
| 105 |
+
|
| 106 |
+
```bash
|
| 107 |
+
# macOS and Linux.
|
| 108 |
+
pip install -e .
|
| 109 |
+
```
|
| 110 |
+
|
| 111 |
+
Dependency-groups include `pufferlib`, `sb3`, `vbd`, and `tests`.
|
| 112 |
+
|
| 113 |
+
```bash
|
| 114 |
+
# On Windows.
|
| 115 |
+
pip install -e . -Cpackages.madrona_escape_room.ext-out-dir=<PATH_TO_YOUR_BUILD_DIR on Windows>
|
| 116 |
+
```
|
| 117 |
+
|
| 118 |
+
</details>
|
| 119 |
+
|
| 120 |
+
---
|
| 121 |
+
|
| 122 |
+
---
|
| 123 |
+
|
| 124 |
+
<details>
|
| 125 |
+
<summary> 🐳 Option 2. Docker </summary>
|
| 126 |
+
|
| 127 |
+
To get started quickly, we provide a Dockerfile in the root directory.
|
| 128 |
+
|
| 129 |
+
### Prerequisites
|
| 130 |
+
Ensure you have the following installed:
|
| 131 |
+
- [Docker](https://docs.docker.com/get-docker/)
|
| 132 |
+
- [NVIDIA Container Toolkit](https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/latest/install-guide.html)
|
| 133 |
+
|
| 134 |
+
### Building the Docker mage
|
| 135 |
+
Once installed, you can build the container with:
|
| 136 |
+
|
| 137 |
+
```bash
|
| 138 |
+
DOCKER_BUILDKIT=1 docker build --build-arg USE_CUDA=true --tag gpudrive:latest --progress=plain .
|
| 139 |
+
```
|
| 140 |
+
|
| 141 |
+
### Running the Container
|
| 142 |
+
To run the container with GPU support and shared memory:
|
| 143 |
+
|
| 144 |
+
```bash
|
| 145 |
+
docker run --gpus all -it --rm --shm-size=20G -v ${PWD}:/workspace gpudrive:latest /bin/bash
|
| 146 |
+
```
|
| 147 |
+
|
| 148 |
+
</details>
|
| 149 |
+
|
| 150 |
+
---
|
| 151 |
+
|
| 152 |
+
Test whether the installation was successful by importing the simulator:
|
| 153 |
+
|
| 154 |
+
```Python
|
| 155 |
+
import madrona_gpudrive
|
| 156 |
+
```
|
| 157 |
+
|
| 158 |
+
To avoid compiling on GPU mode everytime, the following environment variable can be set with any custom path. For example, you can store the compiled program in a cache called `gpudrive_cache`:
|
| 159 |
+
|
| 160 |
+
```bash
|
| 161 |
+
export MADRONA_MWGPU_KERNEL_CACHE=./gpudrive_cache
|
| 162 |
+
```
|
| 163 |
+
|
| 164 |
+
Please remember that if you make any changes in C++, you need to delete the cache and recompile.
|
| 165 |
+
|
| 166 |
+
---
|
| 167 |
+
|
| 168 |
+
<details>
|
| 169 |
+
<summary>Optional: If you want to use the Madrona viewer in C++</summary>
|
| 170 |
+
|
| 171 |
+
#### Extra dependencies to use Madrona viewer
|
| 172 |
+
|
| 173 |
+
To build the simulator with visualization support on Linux (`build/viewer`), you will need to install X11 and OpenGL development libraries. Equivalent dependencies are already installed by Xcode on macOS. For example, on Ubuntu:
|
| 174 |
+
|
| 175 |
+
```bash
|
| 176 |
+
sudo apt install libx11-dev libxrandr-dev libxinerama-dev libxcursor-dev libxi-dev mesa-common-dev libc++1
|
| 177 |
+
```
|
| 178 |
+
|
| 179 |
+
</details>
|
| 180 |
+
|
| 181 |
+
---
|
| 182 |
+
|
| 183 |
+
## Integrations
|
| 184 |
+
|
| 185 |
+
|
| 186 |
+
| What | Info | Run | Training SPS |
|
| 187 |
+
| ------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------- | ------------------------------ |
|
| 188 |
+
| **IPPO** implementation [SB3](https://github.com/DLR-RM/stable-baselines3/tree/master) | [IPPO](https://proceedings.neurips.cc/paper_files/paper/2022/file/9c1535a02f0ce079433344e14d910597-Paper-Datasets_and_Benchmarks.pdf), [PufferLib](https://arxiv.org/pdf/2406.12905), [Implementation](https://github.com/Emerge-Lab/gpudrive/blob/main/integrations/ppo/puffer) | `python baselines/ppo/ppo_sb3.py` | 25 - 50K |
|
| 189 |
+
| **IPPO** implementation [PufferLib](https://github.com/PufferAI/PufferLib) 🐡 | [PPO](https://arxiv.org/pdf/2406.12905) | `python baselines/ppo/ppo_pufferlib.py` | 100 - 300K |
|
| 190 |
+
|
| 191 |
+
|
| 192 |
+
## Getting started
|
| 193 |
+
|
| 194 |
+
To get started, see these entry points:
|
| 195 |
+
|
| 196 |
+
- Our [intro tutorials](https://github.com/Emerge-Lab/gpudrive/tree/main/examples/tutorials). These tutorials take approximately 30-60 minutes to complete and will guide you through the dataset, simulator, and how to populate the simulator with different types of actors.
|
| 197 |
+
- The [environment docs](https://github.com/Emerge-Lab/gpudrive/tree/main/gpudrive/env) provide detailed info on environment settings and supported features.
|
| 198 |
+
|
| 199 |
+
<!-- <p align="center">
|
| 200 |
+
<img src="assets/GPUDrive_docs_flow.png" width="1300" title="Getting started">
|
| 201 |
+
</p> -->
|
| 202 |
+
|
| 203 |
+
<!-- ## 📈 Tests
|
| 204 |
+
|
| 205 |
+
To further test the setup, you can run the pytests in the root directory:
|
| 206 |
+
|
| 207 |
+
```bash
|
| 208 |
+
pytest
|
| 209 |
+
```
|
| 210 |
+
|
| 211 |
+
To test if the simulator compiled correctly (and python lib did not), try running the headless program from the build directory.
|
| 212 |
+
|
| 213 |
+
```bash
|
| 214 |
+
cd build
|
| 215 |
+
./headless CPU 1 # Run on CPU, 1 step
|
| 216 |
+
``` -->
|
| 217 |
+
|
| 218 |
+
## Pre-trained policies
|
| 219 |
+
|
| 220 |
+
Several pre-trained policies are available via the `PyTorchModelHubMixin` class on 🤗 huggingface_hub.
|
| 221 |
+
|
| 222 |
+
- **Best Policy (10,000 Scenarios).** The best policy from [Building reliable sim driving agents by scaling self-play](https://arxiv.org/abs/2502.14706) is available here [here](https://huggingface.co/daphne-cornelisse/policy_S10_000_02_27). This policy was trained on 10,000 randomly sampled scenarios from the WOMD training dataset.
|
| 223 |
+
|
| 224 |
+
- **Alternative Policy (1,000 Scenarios).** A policy trained on 1,000 scenarios can be found [here](https://huggingface.co/daphne-cornelisse/policy_S1000_02_27)
|
| 225 |
+
|
| 226 |
+
---
|
| 227 |
+
|
| 228 |
+
> Note: These models were trained with the environment configurations defined in `examples/experimental/config/reliable_agents_params.yaml`, changing environment/observation configurations will affect performance.
|
| 229 |
+
|
| 230 |
+
---
|
| 231 |
+
|
| 232 |
+
### Usage
|
| 233 |
+
|
| 234 |
+
To load a pre-trained policy, use the following:
|
| 235 |
+
```Python
|
| 236 |
+
from gpudrive.networks.late_fusion import NeuralNet
|
| 237 |
+
|
| 238 |
+
# Load pre-trained model via huggingface_hub
|
| 239 |
+
agent = NeuralNet.from_pretrained("daphne-cornelisse/policy_S10_000_02_27")
|
| 240 |
+
```
|
| 241 |
+
|
| 242 |
+
See [tutorial 04](https://github.com/Emerge-Lab/gpudrive/tree/main/examples/tutorials/04_use_pretrained_sim_agent.ipynb) for all the details.
|
| 243 |
+
|
| 244 |
+
## Dataset
|
| 245 |
+
|
| 246 |
+
### Download the dataset
|
| 247 |
+
|
| 248 |
+
- Two versions of the dataset are available, a [mini version](https://huggingface.co/datasets/EMERGE-lab/GPUDrive_mini) with a 1000 training files and 300 test/validation files, and a [large dataset](https://huggingface.co/datasets/EMERGE-lab/GPUDrive) with 100k unique scenes.
|
| 249 |
+
- Replace 'GPUDrive_mini' with 'GPUDrive' below if you wish to download the full dataset.
|
| 250 |
+
|
| 251 |
+
<details>
|
| 252 |
+
<summary>Download the dataset</summary>
|
| 253 |
+
|
| 254 |
+
To download the dataset you need the huggingface_hub library
|
| 255 |
+
|
| 256 |
+
```bash
|
| 257 |
+
pip install huggingface_hub
|
| 258 |
+
```
|
| 259 |
+
|
| 260 |
+
Then you can download the dataset using python or just `huggingface-cli`.
|
| 261 |
+
|
| 262 |
+
- **Option 1**: Using Python
|
| 263 |
+
|
| 264 |
+
```python
|
| 265 |
+
>>> from huggingface_hub import snapshot_download
|
| 266 |
+
>>> snapshot_download(repo_id="EMERGE-lab/GPUDrive_mini", repo_type="dataset", local_dir="data/processed")
|
| 267 |
+
```
|
| 268 |
+
|
| 269 |
+
- **Option 2**: Use the huggingface-cli
|
| 270 |
+
|
| 271 |
+
1. Log in to your Hugging Face account:
|
| 272 |
+
|
| 273 |
+
```bash
|
| 274 |
+
huggingface-cli login
|
| 275 |
+
```
|
| 276 |
+
|
| 277 |
+
2. Download the dataset:
|
| 278 |
+
|
| 279 |
+
```bash
|
| 280 |
+
huggingface-cli download EMERGE-lab/GPUDrive_mini --local-dir data/processed --repo-type "dataset"
|
| 281 |
+
```
|
| 282 |
+
|
| 283 |
+
- **Option 3**: Manual Download
|
| 284 |
+
|
| 285 |
+
1. Visit https://huggingface.co/datasets/EMERGE-lab/GPUDrive_mini
|
| 286 |
+
2. Navigate to the Files and versions tab.
|
| 287 |
+
3. Download the desired files/directories.
|
| 288 |
+
|
| 289 |
+
_NOTE_: If you downloaded the full-sized dataset, it is grouped to subdirectories of 10k files each (according to hugging face constraints). In order for the path to work with GPUDrive, you need to run
|
| 290 |
+
|
| 291 |
+
```python
|
| 292 |
+
python data_utils/post_processing.py #use --help if you've used a custom download path
|
| 293 |
+
```
|
| 294 |
+
|
| 295 |
+
</details>
|
| 296 |
+
|
| 297 |
+
### Re-build the dataset
|
| 298 |
+
|
| 299 |
+
If you wish to manually generate the dataset, GPUDrive is compatible with the complete [Waymo Open Motion Dataset](https://github.com/waymo-research/waymo-open-dataset), which contains well over 100,000 scenarios. To download new files and create scenarios for the simulator, follow the steps below.
|
| 300 |
+
|
| 301 |
+
<details>
|
| 302 |
+
<summary>Re-build the dataset in 3 steps</summary>
|
| 303 |
+
|
| 304 |
+
1. First, head to [https://waymo.com/open/](https://waymo.com/open/) and click on the "download" button a the top. After registering, click on the files from `v1.2.1 March 2024`, the newest version of the dataset at the time of wrting (10/2024). This will lead you a Google Cloud page. From here, you should see a folder structure like this:
|
| 305 |
+
|
| 306 |
+
```
|
| 307 |
+
waymo_open_dataset_motion_v_1_2_1/
|
| 308 |
+
│
|
| 309 |
+
├── uncompressed/
|
| 310 |
+
│ ├── lidar_and_camera/
|
| 311 |
+
│ ├── scenario/
|
| 312 |
+
│ │ ├── testing_interactive/
|
| 313 |
+
│ │ ├── testing/
|
| 314 |
+
│ │ ├── training_20s/
|
| 315 |
+
│ │ ├── training/
|
| 316 |
+
│ │ ├── validation_interactive/
|
| 317 |
+
│ │ └── validation/
|
| 318 |
+
│ └── tf_example/
|
| 319 |
+
```
|
| 320 |
+
|
| 321 |
+
2. Now, download files from testing, training and/or validation in the **`scenario`** folder. An easy way to do this is through `gsutil`. First register using:
|
| 322 |
+
|
| 323 |
+
```bash
|
| 324 |
+
gcloud auth login
|
| 325 |
+
```
|
| 326 |
+
|
| 327 |
+
...then run the command below to download the dataset you prefer. For example, to download the validation dataset:
|
| 328 |
+
|
| 329 |
+
```bash
|
| 330 |
+
gsutil -m cp -r gs://waymo_open_dataset_motion_v_1_2_1/uncompressed/scenario/validation/ data/raw
|
| 331 |
+
```
|
| 332 |
+
|
| 333 |
+
where `data/raw` is your local storage folder. Note that this can take a while, depending on the size of the dataset you're downloading.
|
| 334 |
+
|
| 335 |
+
3. The last thing we need to do is convert the raw data to a format that is compatible with the simulator using:
|
| 336 |
+
|
| 337 |
+
```bash
|
| 338 |
+
python data_utils/process_waymo_files.py '<raw-data-path>' '<storage-path>' '<dataset>'
|
| 339 |
+
```
|
| 340 |
+
|
| 341 |
+
Note: Due to an open [issue](https://github.com/waymo-research/waymo-open-dataset/issues/868), installation of `waymo-open-dataset-tf-2.12.0` fails for Python 3.11. To use the script, in a separate Python 3.10 environment, run
|
| 342 |
+
|
| 343 |
+
```bash
|
| 344 |
+
pip install waymo-open-dataset-tf-2-12-0 trimesh[easy] python-fcl
|
| 345 |
+
```
|
| 346 |
+
|
| 347 |
+
Then for example, if you want to process the validation data, run:
|
| 348 |
+
|
| 349 |
+
```bash
|
| 350 |
+
python data_utils/process_waymo_files.py 'data/raw/' 'data/processed/' 'validation'
|
| 351 |
+
>>>
|
| 352 |
+
Processing Waymo files: 100%|████████████████████████████████████████████████████████████████| 150/150 [00:05<00:00, 28.18it/s]
|
| 353 |
+
INFO:root:Done!
|
| 354 |
+
```
|
| 355 |
+
|
| 356 |
+
and that's it!
|
| 357 |
+
|
| 358 |
+
> **🧐 Caveat**: A single Waymo tfrecord file contains approximately 500 traffic scenarios. Processing speed is about 250 scenes/min on a 16 core CPU. Trying to process the entire validation set for example (150 tfrecords) is a LOT of time.
|
| 359 |
+
|
| 360 |
+
</details>
|
| 361 |
+
|
| 362 |
+
### Post-processing
|
| 363 |
+
- Running `python data_utils/postprocessing.py` filters out corrupted files and undoes hugging face directory grouping.
|
| 364 |
+
|
| 365 |
+
## 📜 Citing GPUDrive
|
| 366 |
+
|
| 367 |
+
If you use GPUDrive in your research, please cite our ICLR 2025 paper
|
| 368 |
+
```bibtex
|
| 369 |
+
@inproceedings{kazemkhani2025gpudrive,
|
| 370 |
+
title={GPUDrive: Data-driven, multi-agent driving simulation at 1 million FPS},
|
| 371 |
+
author={Saman Kazemkhani and Aarav Pandya and Daphne Cornelisse and Brennan Shacklett and Eugene Vinitsky},
|
| 372 |
+
booktitle={Proceedings of the International Conference on Learning Representations (ICLR)},
|
| 373 |
+
year={2025},
|
| 374 |
+
url={https://arxiv.org/abs/2408.01584},
|
| 375 |
+
eprint={2408.01584},
|
| 376 |
+
archivePrefix={arXiv},
|
| 377 |
+
primaryClass={cs.AI},
|
| 378 |
+
}
|
| 379 |
+
```
|
| 380 |
+
|
| 381 |
+
## Contributing
|
| 382 |
+
|
| 383 |
+
If you encounter a bug, notice a missing feature, or want to contribute, feel free to create an issue or reach out! We'd be excited to have you involved in the project.
|
gpudrive-main/README_SHOW.md
ADDED
|
@@ -0,0 +1,700 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Long-Tail Scenario Generation 展示说明
|
| 2 |
+
|
| 3 |
+
本文档用于展示当前 GPUDrive 长尾场景生成系统的闭环流程、每个阶段的产物路径、文件内容结构,以及这些文件在系统中的作用。
|
| 4 |
+
|
| 5 |
+
## 1. 整体闭环
|
| 6 |
+
|
| 7 |
+
当前系统可以概括为四个阶段:
|
| 8 |
+
|
| 9 |
+
```text
|
| 10 |
+
Search Agent
|
| 11 |
+
-> 搜索并保存候选危险场景
|
| 12 |
+
|
| 13 |
+
Converter Agent
|
| 14 |
+
-> 将仿真轨迹转换成 LLM 可读案例
|
| 15 |
+
|
| 16 |
+
Evaluator Agent
|
| 17 |
+
-> 评估场景危险性、自然性、交互合理性和价值
|
| 18 |
+
|
| 19 |
+
Optimizer Agent
|
| 20 |
+
-> 根据评估结果推荐下一轮搜索参数
|
| 21 |
+
```
|
| 22 |
+
|
| 23 |
+
核心思想是:不是只追求“碰撞数量”,而是追求“自然、合理、危险、可解释、有价值”的长尾场景。
|
| 24 |
+
|
| 25 |
+
## 2. Search Agent 产物
|
| 26 |
+
|
| 27 |
+
### 文件路径
|
| 28 |
+
|
| 29 |
+
每一轮搜索会写入一个 round 目录,例如第二轮:
|
| 30 |
+
|
| 31 |
+
```text
|
| 32 |
+
search_outputs/round_002/search/
|
| 33 |
+
```
|
| 34 |
+
|
| 35 |
+
多卡并行时,每张 GPU 对应一个 shard:
|
| 36 |
+
|
| 37 |
+
```text
|
| 38 |
+
search_outputs/round_002/search/shard_000/
|
| 39 |
+
search_outputs/round_002/search/shard_001/
|
| 40 |
+
search_outputs/round_002/search/shard_002/
|
| 41 |
+
search_outputs/round_002/search/shard_003/
|
| 42 |
+
```
|
| 43 |
+
|
| 44 |
+
每个 shard 下的主要文件:
|
| 45 |
+
|
| 46 |
+
```text
|
| 47 |
+
events.jsonl
|
| 48 |
+
event_traces.jsonl
|
| 49 |
+
summary.json
|
| 50 |
+
```
|
| 51 |
+
|
| 52 |
+
### events.jsonl
|
| 53 |
+
|
| 54 |
+
`events.jsonl` 是轻量级事件索引,一行代表一个候选长尾场景。
|
| 55 |
+
|
| 56 |
+
典型结构:
|
| 57 |
+
|
| 58 |
+
```json
|
| 59 |
+
{
|
| 60 |
+
"shard_id": 0,
|
| 61 |
+
"batch_idx": 0,
|
| 62 |
+
"world_idx": 15,
|
| 63 |
+
"scenario_file": "tfrecord-00475-of-01000_425.json",
|
| 64 |
+
"controlled_agents": 5,
|
| 65 |
+
"risk_agents": [1, 4, 38],
|
| 66 |
+
"collision": true,
|
| 67 |
+
"near_miss": true,
|
| 68 |
+
"offroad": true,
|
| 69 |
+
"first_collision_step": 61,
|
| 70 |
+
"first_offroad_step": 38,
|
| 71 |
+
"min_distance_m": 1.3015,
|
| 72 |
+
"min_distance_step": 63,
|
| 73 |
+
"min_distance_risk_agent": 4,
|
| 74 |
+
"min_distance_partner_agent": 21,
|
| 75 |
+
"collided_agents": [4],
|
| 76 |
+
"offroad_agents": [4],
|
| 77 |
+
"goal_agents": 5
|
| 78 |
+
}
|
| 79 |
+
```
|
| 80 |
+
|
| 81 |
+
作用:
|
| 82 |
+
|
| 83 |
+
- 快速记录哪些 world 出现了 collision、near-miss、offroad 等事件。
|
| 84 |
+
- 快速统计搜索阶段产生了多少候选危险场景。
|
| 85 |
+
- 作为后续可视化和人工定位的索引。
|
| 86 |
+
|
| 87 |
+
它回答的是:“这一轮搜到了哪些候选事件?”
|
| 88 |
+
|
| 89 |
+
### event_traces.jsonl
|
| 90 |
+
|
| 91 |
+
`event_traces.jsonl` 是更完整的轨迹记录,一行代表一个候选事件。
|
| 92 |
+
|
| 93 |
+
主要内容包括:
|
| 94 |
+
|
| 95 |
+
```text
|
| 96 |
+
source:
|
| 97 |
+
shard_id, batch_idx, world_idx, scenario_file
|
| 98 |
+
|
| 99 |
+
outcome:
|
| 100 |
+
collision, near_miss, offroad
|
| 101 |
+
first_collision_step
|
| 102 |
+
first_offroad_step
|
| 103 |
+
min_distance_m
|
| 104 |
+
|
| 105 |
+
risk_agents:
|
| 106 |
+
当前 world 中被赋予 risk_taker 风格的车辆 id
|
| 107 |
+
|
| 108 |
+
agent_traces:
|
| 109 |
+
每个相关 agent 的逐帧状态
|
| 110 |
+
包括 x, y, heading, speed, valid, done 等
|
| 111 |
+
|
| 112 |
+
pairwise_trace:
|
| 113 |
+
关键车辆对之间的逐帧距离、相对速度、closing speed 等
|
| 114 |
+
|
| 115 |
+
map_context:
|
| 116 |
+
事件附近的道路元素、车道线、边界等
|
| 117 |
+
|
| 118 |
+
quality_metrics:
|
| 119 |
+
初步自然性和交互质量指标
|
| 120 |
+
```
|
| 121 |
+
|
| 122 |
+
作用:
|
| 123 |
+
|
| 124 |
+
- 保存真实评估所需的轨迹数据。
|
| 125 |
+
- 后续不依赖视频判断场景,而是基于轨迹和交互指标进行结构化评估。
|
| 126 |
+
- 为 Converter Agent 提供完整输入。
|
| 127 |
+
|
| 128 |
+
它回答的是:“这个候选事件具体是怎么发生的?”
|
| 129 |
+
|
| 130 |
+
### summary.json
|
| 131 |
+
|
| 132 |
+
`summary.json` 是当前 shard 的搜索统计。
|
| 133 |
+
|
| 134 |
+
常见内容:
|
| 135 |
+
|
| 136 |
+
```text
|
| 137 |
+
num_worlds
|
| 138 |
+
num_batches
|
| 139 |
+
num_events
|
| 140 |
+
collision_count
|
| 141 |
+
near_miss_count
|
| 142 |
+
offroad_count
|
| 143 |
+
event_rate
|
| 144 |
+
```
|
| 145 |
+
|
| 146 |
+
作用:
|
| 147 |
+
|
| 148 |
+
- 快速查看单个 shard 的搜索结果。
|
| 149 |
+
- 检查搜索任务是否正常完成。
|
| 150 |
+
- 粗略比较不同参数下候选事件数量。
|
| 151 |
+
|
| 152 |
+
它回答的是:“这一张卡跑出的总体情况如何?”
|
| 153 |
+
|
| 154 |
+
## 3. Converter Agent 产物
|
| 155 |
+
|
| 156 |
+
### 文件路径
|
| 157 |
+
|
| 158 |
+
Converter Agent 将 `event_traces.jsonl` 转换成 LLM 可读案例。
|
| 159 |
+
|
| 160 |
+
路径示例:
|
| 161 |
+
|
| 162 |
+
```text
|
| 163 |
+
search_outputs/round_002/llm_cases/shard_000/
|
| 164 |
+
search_outputs/round_002/llm_cases/shard_001/
|
| 165 |
+
search_outputs/round_002/llm_cases/shard_002/
|
| 166 |
+
search_outputs/round_002/llm_cases/shard_003/
|
| 167 |
+
```
|
| 168 |
+
|
| 169 |
+
主要文件:
|
| 170 |
+
|
| 171 |
+
```text
|
| 172 |
+
llm_cases.jsonl
|
| 173 |
+
case_cards/
|
| 174 |
+
summary.json
|
| 175 |
+
```
|
| 176 |
+
|
| 177 |
+
### llm_cases.jsonl
|
| 178 |
+
|
| 179 |
+
`llm_cases.jsonl` 是 Evaluator Agent 的主要输入,一行代表一个结构化场景案例。
|
| 180 |
+
|
| 181 |
+
主要结构:
|
| 182 |
+
|
| 183 |
+
```text
|
| 184 |
+
case_id:
|
| 185 |
+
唯一案例 id
|
| 186 |
+
|
| 187 |
+
source:
|
| 188 |
+
来自哪个 shard、batch、world、scenario_file
|
| 189 |
+
|
| 190 |
+
outcome:
|
| 191 |
+
是否 collision、near_miss、offroad
|
| 192 |
+
首次事件发生 step
|
| 193 |
+
|
| 194 |
+
primary_pair:
|
| 195 |
+
当前事件中最关键的一对车辆
|
| 196 |
+
包括 risk agent、partner agent、选择原因
|
| 197 |
+
|
| 198 |
+
primary_interaction_metrics:
|
| 199 |
+
min_clean_distance_m
|
| 200 |
+
min_ttc_s
|
| 201 |
+
time_ttc_below_1s
|
| 202 |
+
event_relative_speed_mps
|
| 203 |
+
event_closing_speed_mps
|
| 204 |
+
|
| 205 |
+
timeline:
|
| 206 |
+
事件前后若干关键时间点的车辆状态
|
| 207 |
+
|
| 208 |
+
context_agents:
|
| 209 |
+
周围车辆的简化状态
|
| 210 |
+
|
| 211 |
+
naturalness_checks:
|
| 212 |
+
max_speed_mps
|
| 213 |
+
max_accel_mps2
|
| 214 |
+
max_yaw_rate_radps
|
| 215 |
+
large_displacement_flags
|
| 216 |
+
|
| 217 |
+
map_context:
|
| 218 |
+
事件附近道路环境
|
| 219 |
+
```
|
| 220 |
+
|
| 221 |
+
作用:
|
| 222 |
+
|
| 223 |
+
- 将复杂的多车逐帧轨迹压缩成 LLM 和规则系统都能理解的结构化文本/JSON。
|
| 224 |
+
- 过滤 `done=true` 后的污染帧,并要求 `valid=true`,避免仿真结束后的无效位置��响评估。
|
| 225 |
+
- 自动选择 primary pair,让评估聚焦于最关键的交互车辆对。
|
| 226 |
+
|
| 227 |
+
它回答的是:“如何把仿真轨迹变成可评估的交通事件描述?”
|
| 228 |
+
|
| 229 |
+
### primary pair 的意义
|
| 230 |
+
|
| 231 |
+
一个 world 中可能有很多车,但真正决定场景价值的通常是一对关键交互车辆。
|
| 232 |
+
|
| 233 |
+
primary pair 的选择优先级:
|
| 234 |
+
|
| 235 |
+
```text
|
| 236 |
+
1. risk agent 直接参与碰撞的车辆对
|
| 237 |
+
2. 最小距离对应的 risk-agent 车辆对
|
| 238 |
+
3. 碰撞车辆对
|
| 239 |
+
4. 其他最接近的交互车辆对
|
| 240 |
+
```
|
| 241 |
+
|
| 242 |
+
作用:
|
| 243 |
+
|
| 244 |
+
- 让 Evaluator Agent 聚焦主要冲突对象。
|
| 245 |
+
- 避免被无关车辆干扰。
|
| 246 |
+
- 让 LLM 评估时更容易判断这个事件是否自然、合理、有价值。
|
| 247 |
+
|
| 248 |
+
### case_cards/
|
| 249 |
+
|
| 250 |
+
`case_cards/` 保存 Markdown 版案例卡。
|
| 251 |
+
|
| 252 |
+
示例路径:
|
| 253 |
+
|
| 254 |
+
```text
|
| 255 |
+
search_outputs/round_002/llm_cases/shard_000/case_cards/
|
| 256 |
+
```
|
| 257 |
+
|
| 258 |
+
作用:
|
| 259 |
+
|
| 260 |
+
- 给人快速浏览。
|
| 261 |
+
- 展示单个事件的关键指标、时间线、车辆关系。
|
| 262 |
+
- 可用于人工抽查 Evaluator Agent 的判断是否合理。
|
| 263 |
+
|
| 264 |
+
### summary.json
|
| 265 |
+
|
| 266 |
+
记录转换统计,例如:
|
| 267 |
+
|
| 268 |
+
```text
|
| 269 |
+
input_events
|
| 270 |
+
converted_cases
|
| 271 |
+
written_cards
|
| 272 |
+
skipped_cases
|
| 273 |
+
```
|
| 274 |
+
|
| 275 |
+
作用:
|
| 276 |
+
|
| 277 |
+
- 检查转换是否完整。
|
| 278 |
+
- 对比 Search Agent 产出的事件数量和最终可评估 case 数量。
|
| 279 |
+
|
| 280 |
+
## 4. Evaluator Agent 产物
|
| 281 |
+
|
| 282 |
+
### 文件路径
|
| 283 |
+
|
| 284 |
+
Evaluator Agent 对 `llm_cases.jsonl` 进行规则评估和 LLM 评估。
|
| 285 |
+
|
| 286 |
+
路径示例:
|
| 287 |
+
|
| 288 |
+
```text
|
| 289 |
+
search_outputs/round_002/evaluator_agent/shard_000/
|
| 290 |
+
search_outputs/round_002/evaluator_agent/shard_001/
|
| 291 |
+
search_outputs/round_002/evaluator_agent/shard_002/
|
| 292 |
+
search_outputs/round_002/evaluator_agent/shard_003/
|
| 293 |
+
```
|
| 294 |
+
|
| 295 |
+
主要文件:
|
| 296 |
+
|
| 297 |
+
```text
|
| 298 |
+
all_evaluations.jsonl
|
| 299 |
+
accepted_cases.jsonl
|
| 300 |
+
rejected_cases.jsonl
|
| 301 |
+
summary.json
|
| 302 |
+
optimizer_metrics.json
|
| 303 |
+
raw_responses/
|
| 304 |
+
```
|
| 305 |
+
|
| 306 |
+
### all_evaluations.jsonl
|
| 307 |
+
|
| 308 |
+
`all_evaluations.jsonl` 保存所有案例的完整评估结果。
|
| 309 |
+
|
| 310 |
+
主要结构:
|
| 311 |
+
|
| 312 |
+
```text
|
| 313 |
+
case:
|
| 314 |
+
原始 llm case
|
| 315 |
+
|
| 316 |
+
local_eval:
|
| 317 |
+
本地规则评估结果
|
| 318 |
+
|
| 319 |
+
llm_eval:
|
| 320 |
+
DeepSeek / LLM 返回的评估结果
|
| 321 |
+
|
| 322 |
+
final_eval:
|
| 323 |
+
融合后的最终评估结果
|
| 324 |
+
```
|
| 325 |
+
|
| 326 |
+
`final_eval` 中的重要字段:
|
| 327 |
+
|
| 328 |
+
```text
|
| 329 |
+
accepted:
|
| 330 |
+
是否接受该场景
|
| 331 |
+
|
| 332 |
+
high_value:
|
| 333 |
+
是否为高价值场景
|
| 334 |
+
|
| 335 |
+
criticality_score:
|
| 336 |
+
危险程度
|
| 337 |
+
|
| 338 |
+
naturalness_score:
|
| 339 |
+
运动自然性
|
| 340 |
+
|
| 341 |
+
interaction_score:
|
| 342 |
+
交互合理性
|
| 343 |
+
|
| 344 |
+
scenario_value_score:
|
| 345 |
+
场景价值
|
| 346 |
+
|
| 347 |
+
danger_level:
|
| 348 |
+
危险等级
|
| 349 |
+
|
| 350 |
+
scenario_type:
|
| 351 |
+
场景类型
|
| 352 |
+
|
| 353 |
+
artifact_flags:
|
| 354 |
+
伪影标记
|
| 355 |
+
|
| 356 |
+
rejection_reasons:
|
| 357 |
+
拒绝原因
|
| 358 |
+
|
| 359 |
+
optimization_feedback:
|
| 360 |
+
给 Optimizer Agent 的反馈信号
|
| 361 |
+
```
|
| 362 |
+
|
| 363 |
+
作用:
|
| 364 |
+
|
| 365 |
+
- 给每个场景一个结构化评估结果。
|
| 366 |
+
- 判断场景是否真正危险、自然、合理。
|
| 367 |
+
- 为后续筛选和优化提供数据。
|
| 368 |
+
|
| 369 |
+
它回答的是:“这个场景到底有没有价值?”
|
| 370 |
+
|
| 371 |
+
### accepted_cases.jsonl
|
| 372 |
+
|
| 373 |
+
保存通过评估的案例。
|
| 374 |
+
|
| 375 |
+
通过条件不是简单的“发生碰撞”,而是综合考虑:
|
| 376 |
+
|
| 377 |
+
```text
|
| 378 |
+
危险性
|
| 379 |
+
运动自然性
|
| 380 |
+
交互合理性
|
| 381 |
+
risk agent 是否真正参与
|
| 382 |
+
是否存在明显伪影
|
| 383 |
+
场景是否有分析价值
|
| 384 |
+
```
|
| 385 |
+
|
| 386 |
+
作用:
|
| 387 |
+
|
| 388 |
+
- 作为最终可展示、可保存、可进一步分析的高质量候选集。
|
| 389 |
+
- 用于后续可视化或构建长尾数据集。
|
| 390 |
+
|
| 391 |
+
### rejected_cases.jsonl
|
| 392 |
+
|
| 393 |
+
保存被拒绝的案例。
|
| 394 |
+
|
| 395 |
+
常见拒绝原因:
|
| 396 |
+
|
| 397 |
+
```text
|
| 398 |
+
车辆运动不自然
|
| 399 |
+
速度或加速度异常
|
| 400 |
+
车辆轨迹有跳变
|
| 401 |
+
risk agent 没有真正参与冲突
|
| 402 |
+
offroad 早于 collision,场景价值较低
|
| 403 |
+
done 后状态污染
|
| 404 |
+
碰撞缺少交互因果
|
| 405 |
+
```
|
| 406 |
+
|
| 407 |
+
作用:
|
| 408 |
+
|
| 409 |
+
- 帮助分析当前搜索策略的缺陷。
|
| 410 |
+
- 给 Optimizer Agent 提供负反馈。
|
| 411 |
+
- 避免系统只追求碰撞数量而产生大量低质量事件。
|
| 412 |
+
|
| 413 |
+
### optimizer_metrics.json
|
| 414 |
+
|
| 415 |
+
这是 Evaluator Agent 输出给 Optimizer Agent 的核心文件。
|
| 416 |
+
|
| 417 |
+
路径示例:
|
| 418 |
+
|
| 419 |
+
```text
|
| 420 |
+
search_outputs/round_002/evaluator_agent/shard_000/optimizer_metrics.json
|
| 421 |
+
```
|
| 422 |
+
|
| 423 |
+
核心结构:
|
| 424 |
+
|
| 425 |
+
```text
|
| 426 |
+
current_search_parameters:
|
| 427 |
+
risk_collision_weight
|
| 428 |
+
risk_goal_weight
|
| 429 |
+
risk_offroad_weight
|
| 430 |
+
risk_agents_per_world
|
| 431 |
+
normal_mode
|
| 432 |
+
deterministic
|
| 433 |
+
|
| 434 |
+
objective_metrics:
|
| 435 |
+
total_evaluated
|
| 436 |
+
accepted_count
|
| 437 |
+
rejected_count
|
| 438 |
+
high_value_count
|
| 439 |
+
accepted_rate
|
| 440 |
+
high_value_rate
|
| 441 |
+
natural_critical_rate
|
| 442 |
+
risk_direct_involved_rate
|
| 443 |
+
risk_direct_accept_rate
|
| 444 |
+
hard_artifact_record_rate
|
| 445 |
+
semantic_diversity_entropy
|
| 446 |
+
composite_objective
|
| 447 |
+
|
| 448 |
+
score_stats:
|
| 449 |
+
criticality_score
|
| 450 |
+
naturalness_score
|
| 451 |
+
interaction_score
|
| 452 |
+
scenario_value_score
|
| 453 |
+
|
| 454 |
+
metric_stats:
|
| 455 |
+
clean_min_distance_m
|
| 456 |
+
min_ttc_s
|
| 457 |
+
event_relative_speed_mps
|
| 458 |
+
event_closing_speed_mps
|
| 459 |
+
max_speed_mps
|
| 460 |
+
max_accel_mps2
|
| 461 |
+
max_yaw_rate_radps
|
| 462 |
+
|
| 463 |
+
counts:
|
| 464 |
+
scenario_type
|
| 465 |
+
artifact_flags
|
| 466 |
+
rejection_reasons
|
| 467 |
+
optimization_feedback
|
| 468 |
+
|
| 469 |
+
optimizer_ready_records:
|
| 470 |
+
top cases used as compact feedback examples
|
| 471 |
+
```
|
| 472 |
+
|
| 473 |
+
作用:
|
| 474 |
+
|
| 475 |
+
- 汇总一个 shard 的整体质量。
|
| 476 |
+
- 作为 Optimizer Agent 的训练样本。
|
| 477 |
+
- 衡量一轮搜索是否比上一轮更好。
|
| 478 |
+
|
| 479 |
+
它回答的是:“当前这组搜索参数整体表现怎么样?”
|
| 480 |
+
|
| 481 |
+
## 5. Optimizer Agent 产物
|
| 482 |
+
|
| 483 |
+
### 文件路径
|
| 484 |
+
|
| 485 |
+
Optimizer Agent 读取一轮或多轮的 `optimizer_metrics.json`,学习参数到质量指标的映射,并推荐下一轮搜索参数。
|
| 486 |
+
|
| 487 |
+
路径示例:
|
| 488 |
+
|
| 489 |
+
```text
|
| 490 |
+
search_outputs/round_002/optimizer_agent/mlp_next/
|
| 491 |
+
```
|
| 492 |
+
|
| 493 |
+
主要文件:
|
| 494 |
+
|
| 495 |
+
```text
|
| 496 |
+
optimizer_plan.json
|
| 497 |
+
candidate_predictions.jsonl
|
| 498 |
+
best_recommendation.env
|
| 499 |
+
recommended_search_commands.sh
|
| 500 |
+
```
|
| 501 |
+
|
| 502 |
+
### optimizer_plan.json
|
| 503 |
+
|
| 504 |
+
完整优化计划。
|
| 505 |
+
|
| 506 |
+
主要内容:
|
| 507 |
+
|
| 508 |
+
```text
|
| 509 |
+
metrics_paths:
|
| 510 |
+
使用了哪些 optimizer_metrics.json
|
| 511 |
+
|
| 512 |
+
history_samples:
|
| 513 |
+
历史搜索参数和对应质量指标
|
| 514 |
+
|
| 515 |
+
candidate_grid:
|
| 516 |
+
当前可搜索的参数空间
|
| 517 |
+
|
| 518 |
+
training:
|
| 519 |
+
MLP surrogate model 的训练状态
|
| 520 |
+
|
| 521 |
+
recommendations:
|
| 522 |
+
推荐的下一轮参数
|
| 523 |
+
```
|
| 524 |
+
|
| 525 |
+
作用:
|
| 526 |
+
|
| 527 |
+
- 记录 Optimizer Agent 的完整决策过程。
|
| 528 |
+
- 可解释为什么推荐下一组参数。
|
| 529 |
+
- 支持复盘每一轮闭环优化。
|
| 530 |
+
|
| 531 |
+
### candidate_predictions.jsonl
|
| 532 |
+
|
| 533 |
+
保存每个候选参数组合的预测结果。
|
| 534 |
+
|
| 535 |
+
典型字段:
|
| 536 |
+
|
| 537 |
+
```text
|
| 538 |
+
risk_collision_weight
|
| 539 |
+
risk_goal_weight
|
| 540 |
+
risk_offroad_weight
|
| 541 |
+
risk_agents_per_world
|
| 542 |
+
normal_mode
|
| 543 |
+
deterministic
|
| 544 |
+
predicted_composite_objective
|
| 545 |
+
predicted_accepted_rate
|
| 546 |
+
predicted_high_value_rate
|
| 547 |
+
predicted_hard_artifact_rate
|
| 548 |
+
```
|
| 549 |
+
|
| 550 |
+
作用:
|
| 551 |
+
|
| 552 |
+
- 查看 MLP surrogate model 对不同参数组合的预测。
|
| 553 |
+
- 分析哪些参数更可能生成高质量长尾场景。
|
| 554 |
+
- 支持 top-k 推荐和 exploration。
|
| 555 |
+
|
| 556 |
+
### best_recommendation.env
|
| 557 |
+
|
| 558 |
+
下一轮搜索可直接加载的参数文件。
|
| 559 |
+
|
| 560 |
+
示例:
|
| 561 |
+
|
| 562 |
+
```bash
|
| 563 |
+
RISK_COLLISION_WEIGHT=-0.2
|
| 564 |
+
RISK_GOAL_WEIGHT=1.6
|
| 565 |
+
RISK_OFFROAD_WEIGHT=-0.8
|
| 566 |
+
RISK_AGENTS_PER_WORLD=1
|
| 567 |
+
NORMAL_MODE=expert
|
| 568 |
+
DETERMINISTIC=0
|
| 569 |
+
```
|
| 570 |
+
|
| 571 |
+
作用:
|
| 572 |
+
|
| 573 |
+
- 直接用于下一轮 Search Agent。
|
| 574 |
+
- 闭环系统中最直接的优化输出。
|
| 575 |
+
|
| 576 |
+
### recommended_search_commands.sh
|
| 577 |
+
|
| 578 |
+
自动生成的搜索命令。
|
| 579 |
+
|
| 580 |
+
作用:
|
| 581 |
+
|
| 582 |
+
- 方便直接提交下一轮实验。
|
| 583 |
+
- 避免手工复制参数出错。
|
| 584 |
+
|
| 585 |
+
## 6. 每轮之间如何比较是否变好
|
| 586 |
+
|
| 587 |
+
不要只看碰撞数量。碰撞数量变多只说明候选池变大,不代表场景质量一定更好。
|
| 588 |
+
|
| 589 |
+
核心比较文件:
|
| 590 |
+
|
| 591 |
+
```text
|
| 592 |
+
search_outputs/round_001/evaluator_agent/shard_*/optimizer_metrics.json
|
| 593 |
+
search_outputs/round_002/evaluator_agent/shard_*/optimizer_metrics.json
|
| 594 |
+
```
|
| 595 |
+
|
| 596 |
+
推荐展示指标:
|
| 597 |
+
|
| 598 |
+
```text
|
| 599 |
+
composite_objective
|
| 600 |
+
主指标,越高越好
|
| 601 |
+
|
| 602 |
+
accepted_rate
|
| 603 |
+
Evaluator Agent 接受比例,越高越好
|
| 604 |
+
|
| 605 |
+
high_value_rate
|
| 606 |
+
高价值场景比例,越高越好
|
| 607 |
+
|
| 608 |
+
natural_critical_rate
|
| 609 |
+
同时危险且自然的场景比例,越高越好
|
| 610 |
+
|
| 611 |
+
risk_direct_accept_rate
|
| 612 |
+
risk agent 直接参与并被接受的比例,越高越好
|
| 613 |
+
|
| 614 |
+
hard_artifact_record_rate
|
| 615 |
+
明显伪影比例,越低越好
|
| 616 |
+
|
| 617 |
+
semantic_diversity_entropy
|
| 618 |
+
场景类型多样性,过低说明模式坍塌
|
| 619 |
+
```
|
| 620 |
+
|
| 621 |
+
如果第二轮出现:
|
| 622 |
+
|
| 623 |
+
```text
|
| 624 |
+
LLM case 数量增加
|
| 625 |
+
accepted_rate 不下降或上升
|
| 626 |
+
high_value_rate 上升
|
| 627 |
+
natural_critical_rate 上升
|
| 628 |
+
hard_artifact_record_rate 不上升或下降
|
| 629 |
+
composite_objective 上升
|
| 630 |
+
```
|
| 631 |
+
|
| 632 |
+
则可以说明闭环优化在产生更高质量的长尾场景。
|
| 633 |
+
|
| 634 |
+
## 7. 展示时推荐讲法
|
| 635 |
+
|
| 636 |
+
可以这样概括:
|
| 637 |
+
|
| 638 |
+
```text
|
| 639 |
+
我们首先基于 GPUDrive 并行运行大量世界,并使用 reward-conditioned policy
|
| 640 |
+
给车辆赋予不同驾驶风格。Search Agent 会搜索 collision、near-miss、
|
| 641 |
+
offroad 等候选长尾事件,并保存轻量事件索引 events.jsonl 和完整轨迹
|
| 642 |
+
event_traces.jsonl。
|
| 643 |
+
|
| 644 |
+
随后,Converter Agent 将复杂的多车逐帧轨迹转换为 LLM 可读的结构化案例
|
| 645 |
+
llm_cases.jsonl。转换过程中会清理 done 后的无效帧,并自动选择最关键的
|
| 646 |
+
primary pair。
|
| 647 |
+
|
| 648 |
+
Evaluator Agent 进一步从危险性、运动自然性、交互合理性、场景价值和伪影率
|
| 649 |
+
等维度评估每个案例,输出 accepted/rejected cases 和 optimizer_metrics.json。
|
| 650 |
+
|
| 651 |
+
最后,Optimizer Agent 使用这些评估指标训练一个 MLP surrogate model,
|
| 652 |
+
预测不同 reward-condition 参数的效果,并推荐下一轮搜索参数。这样系统形成
|
| 653 |
+
自动生成、自动评估、自动优化的闭环多 Agent 长尾数据生成流程。
|
| 654 |
+
```
|
| 655 |
+
|
| 656 |
+
一句话总结:
|
| 657 |
+
|
| 658 |
+
```text
|
| 659 |
+
我们的目标不是生成更多碰撞,而是自动生成更多自然、合理、危险且有价值的长尾交互场景。
|
| 660 |
+
```
|
| 661 |
+
|
| 662 |
+
## 8. 各文件一句话速查
|
| 663 |
+
|
| 664 |
+
```text
|
| 665 |
+
events.jsonl
|
| 666 |
+
轻量事件索引,记录搜到了哪些候选危险事件。
|
| 667 |
+
|
| 668 |
+
event_traces.jsonl
|
| 669 |
+
完整轨迹记录,保存评估所需的多车状态和交互数据。
|
| 670 |
+
|
| 671 |
+
llm_cases.jsonl
|
| 672 |
+
LLM 可读案例,将复杂轨迹压缩成结构化交通事件。
|
| 673 |
+
|
| 674 |
+
case_cards/
|
| 675 |
+
Markdown 案例卡,方便人工快速浏览。
|
| 676 |
+
|
| 677 |
+
all_evaluations.jsonl
|
| 678 |
+
所有案例的完整评估结果。
|
| 679 |
+
|
| 680 |
+
accepted_cases.jsonl
|
| 681 |
+
通过评估的高质量候选场景。
|
| 682 |
+
|
| 683 |
+
rejected_cases.jsonl
|
| 684 |
+
被拒绝的低质量或伪影场景。
|
| 685 |
+
|
| 686 |
+
optimizer_metrics.json
|
| 687 |
+
当前搜索参数的质量汇总,是 Optimizer Agent 的输入。
|
| 688 |
+
|
| 689 |
+
optimizer_plan.json
|
| 690 |
+
Optimizer Agent 的完整优化计划。
|
| 691 |
+
|
| 692 |
+
candidate_predictions.jsonl
|
| 693 |
+
每个候选参数组合的预测效果。
|
| 694 |
+
|
| 695 |
+
best_recommendation.env
|
| 696 |
+
下一轮搜索直接加载的推荐参数。
|
| 697 |
+
|
| 698 |
+
recommended_search_commands.sh
|
| 699 |
+
下一轮可直接提交的搜索命令。
|
| 700 |
+
```
|
gpudrive-main/assets/GPUDrive_eval_with_humans_control_6.gif
ADDED
|
Git LFS Details
|
gpudrive-main/assets/Lidar120.gif
ADDED
|
Git LFS Details
|
gpudrive-main/assets/Lidar360.gif
ADDED
|
Git LFS Details
|
gpudrive-main/assets/agent_collision.obj
ADDED
|
@@ -0,0 +1,212 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Blender 3.6.0
|
| 2 |
+
# www.blender.org
|
| 3 |
+
o Sphere
|
| 4 |
+
v 0.000000 0.450000 1.698761
|
| 5 |
+
v 0.000000 0.779423 1.369338
|
| 6 |
+
v 0.000000 0.900000 0.919338
|
| 7 |
+
v 0.000000 0.779423 0.469338
|
| 8 |
+
v 0.000000 0.450000 0.139915
|
| 9 |
+
v 0.389711 0.225000 1.698761
|
| 10 |
+
v 0.675000 0.389711 1.369338
|
| 11 |
+
v 0.779423 0.450000 0.919338
|
| 12 |
+
v 0.675000 0.389711 0.469338
|
| 13 |
+
v 0.389711 0.225000 0.139915
|
| 14 |
+
v 0.389711 -0.225000 1.698761
|
| 15 |
+
v 0.675000 -0.389711 1.369338
|
| 16 |
+
v 0.779423 -0.450000 0.919338
|
| 17 |
+
v 0.675000 -0.389711 0.469338
|
| 18 |
+
v 0.389711 -0.225000 0.139915
|
| 19 |
+
v -0.000000 -0.450000 1.698761
|
| 20 |
+
v -0.000000 -0.779423 1.369338
|
| 21 |
+
v -0.000000 -0.900000 0.919338
|
| 22 |
+
v -0.000000 -0.779423 0.469338
|
| 23 |
+
v -0.000000 -0.450000 0.139915
|
| 24 |
+
v 0.000000 0.000000 1.819338
|
| 25 |
+
v -0.389711 -0.225000 1.698761
|
| 26 |
+
v -0.675000 -0.389711 1.369338
|
| 27 |
+
v -0.779423 -0.450000 0.919338
|
| 28 |
+
v -0.675000 -0.389711 0.469338
|
| 29 |
+
v -0.389711 -0.225000 0.139915
|
| 30 |
+
v -0.389711 0.225000 1.698761
|
| 31 |
+
v -0.675000 0.389712 1.369338
|
| 32 |
+
v -0.779423 0.450000 0.919338
|
| 33 |
+
v -0.675000 0.389712 0.469338
|
| 34 |
+
v -0.389711 0.225000 0.139915
|
| 35 |
+
v 0.000000 0.000000 0.019338
|
| 36 |
+
s 0
|
| 37 |
+
f 5 4 9 10
|
| 38 |
+
f 3 2 7 8
|
| 39 |
+
f 1 21 6
|
| 40 |
+
f 32 5 10
|
| 41 |
+
f 4 3 8 9
|
| 42 |
+
f 2 1 6 7
|
| 43 |
+
f 32 10 15
|
| 44 |
+
f 9 8 13 14
|
| 45 |
+
f 7 6 11 12
|
| 46 |
+
f 10 9 14 15
|
| 47 |
+
f 8 7 12 13
|
| 48 |
+
f 6 21 11
|
| 49 |
+
f 32 15 20
|
| 50 |
+
f 14 13 18 19
|
| 51 |
+
f 12 11 16 17
|
| 52 |
+
f 15 14 19 20
|
| 53 |
+
f 13 12 17 18
|
| 54 |
+
f 11 21 16
|
| 55 |
+
f 32 20 26
|
| 56 |
+
f 19 18 24 25
|
| 57 |
+
f 17 16 22 23
|
| 58 |
+
f 20 19 25 26
|
| 59 |
+
f 18 17 23 24
|
| 60 |
+
f 16 21 22
|
| 61 |
+
f 25 24 29 30
|
| 62 |
+
f 23 22 27 28
|
| 63 |
+
f 26 25 30 31
|
| 64 |
+
f 24 23 28 29
|
| 65 |
+
f 22 21 27
|
| 66 |
+
f 32 26 31
|
| 67 |
+
f 28 27 1 2
|
| 68 |
+
f 31 30 4 5
|
| 69 |
+
f 29 28 2 3
|
| 70 |
+
f 27 21 1
|
| 71 |
+
f 32 31 5
|
| 72 |
+
f 30 29 3 4
|
| 73 |
+
o Sphere.001
|
| 74 |
+
v -0.859505 0.778871 0.910019
|
| 75 |
+
v -0.859505 0.877698 0.811193
|
| 76 |
+
v -0.859505 0.913871 0.676193
|
| 77 |
+
v -0.859505 0.877698 0.541193
|
| 78 |
+
v -0.859505 0.778871 0.442366
|
| 79 |
+
v -0.742592 0.711371 0.910019
|
| 80 |
+
v -0.657005 0.760784 0.811193
|
| 81 |
+
v -0.625678 0.778871 0.676193
|
| 82 |
+
v -0.657005 0.760784 0.541193
|
| 83 |
+
v -0.742592 0.711371 0.442366
|
| 84 |
+
v -0.742592 0.576371 0.910019
|
| 85 |
+
v -0.657005 0.526958 0.811193
|
| 86 |
+
v -0.625678 0.508871 0.676193
|
| 87 |
+
v -0.657005 0.526958 0.541193
|
| 88 |
+
v -0.742592 0.576371 0.442366
|
| 89 |
+
v -0.859505 0.508871 0.910019
|
| 90 |
+
v -0.859505 0.410044 0.811193
|
| 91 |
+
v -0.859505 0.373871 0.676193
|
| 92 |
+
v -0.859505 0.410044 0.541193
|
| 93 |
+
v -0.859505 0.508871 0.442366
|
| 94 |
+
v -0.859505 0.643871 0.946193
|
| 95 |
+
v -0.976418 0.576371 0.910019
|
| 96 |
+
v -1.062005 0.526958 0.811193
|
| 97 |
+
v -1.093332 0.508871 0.676193
|
| 98 |
+
v -1.062005 0.526958 0.541193
|
| 99 |
+
v -0.976418 0.576371 0.442366
|
| 100 |
+
v -0.976418 0.711371 0.910019
|
| 101 |
+
v -1.062005 0.760785 0.811193
|
| 102 |
+
v -1.093332 0.778871 0.676193
|
| 103 |
+
v -1.062005 0.760785 0.541193
|
| 104 |
+
v -0.976418 0.711371 0.442366
|
| 105 |
+
v -0.859505 0.643871 0.406193
|
| 106 |
+
s 0
|
| 107 |
+
f 37 36 41 42
|
| 108 |
+
f 35 34 39 40
|
| 109 |
+
f 33 53 38
|
| 110 |
+
f 64 37 42
|
| 111 |
+
f 36 35 40 41
|
| 112 |
+
f 34 33 38 39
|
| 113 |
+
f 64 42 47
|
| 114 |
+
f 41 40 45 46
|
| 115 |
+
f 39 38 43 44
|
| 116 |
+
f 42 41 46 47
|
| 117 |
+
f 40 39 44 45
|
| 118 |
+
f 38 53 43
|
| 119 |
+
f 64 47 52
|
| 120 |
+
f 46 45 50 51
|
| 121 |
+
f 44 43 48 49
|
| 122 |
+
f 47 46 51 52
|
| 123 |
+
f 45 44 49 50
|
| 124 |
+
f 43 53 48
|
| 125 |
+
f 64 52 58
|
| 126 |
+
f 51 50 56 57
|
| 127 |
+
f 49 48 54 55
|
| 128 |
+
f 52 51 57 58
|
| 129 |
+
f 50 49 55 56
|
| 130 |
+
f 48 53 54
|
| 131 |
+
f 57 56 61 62
|
| 132 |
+
f 55 54 59 60
|
| 133 |
+
f 58 57 62 63
|
| 134 |
+
f 56 55 60 61
|
| 135 |
+
f 54 53 59
|
| 136 |
+
f 64 58 63
|
| 137 |
+
f 60 59 33 34
|
| 138 |
+
f 63 62 36 37
|
| 139 |
+
f 61 60 34 35
|
| 140 |
+
f 59 53 33
|
| 141 |
+
f 64 63 37
|
| 142 |
+
f 62 61 35 36
|
| 143 |
+
o Sphere.002
|
| 144 |
+
v 0.859505 0.778871 0.910019
|
| 145 |
+
v 0.859505 0.877698 0.811193
|
| 146 |
+
v 0.859505 0.913871 0.676193
|
| 147 |
+
v 0.859505 0.877698 0.541193
|
| 148 |
+
v 0.859505 0.778871 0.442366
|
| 149 |
+
v 0.976418 0.711371 0.910019
|
| 150 |
+
v 1.062005 0.760784 0.811193
|
| 151 |
+
v 1.093332 0.778871 0.676193
|
| 152 |
+
v 1.062005 0.760784 0.541193
|
| 153 |
+
v 0.976418 0.711371 0.442366
|
| 154 |
+
v 0.976418 0.576371 0.910019
|
| 155 |
+
v 1.062005 0.526958 0.811193
|
| 156 |
+
v 1.093332 0.508871 0.676193
|
| 157 |
+
v 1.062005 0.526958 0.541193
|
| 158 |
+
v 0.976418 0.576371 0.442366
|
| 159 |
+
v 0.859505 0.508871 0.910019
|
| 160 |
+
v 0.859505 0.410044 0.811193
|
| 161 |
+
v 0.859505 0.373871 0.676193
|
| 162 |
+
v 0.859505 0.410044 0.541193
|
| 163 |
+
v 0.859505 0.508871 0.442366
|
| 164 |
+
v 0.859505 0.643871 0.946193
|
| 165 |
+
v 0.742592 0.576371 0.910019
|
| 166 |
+
v 0.657005 0.526958 0.811193
|
| 167 |
+
v 0.625678 0.508871 0.676193
|
| 168 |
+
v 0.657005 0.526958 0.541193
|
| 169 |
+
v 0.742592 0.576371 0.442366
|
| 170 |
+
v 0.742592 0.711371 0.910019
|
| 171 |
+
v 0.657005 0.760785 0.811193
|
| 172 |
+
v 0.625678 0.778871 0.676193
|
| 173 |
+
v 0.657005 0.760785 0.541193
|
| 174 |
+
v 0.742592 0.711371 0.442366
|
| 175 |
+
v 0.859505 0.643871 0.406193
|
| 176 |
+
s 0
|
| 177 |
+
f 69 68 73 74
|
| 178 |
+
f 67 66 71 72
|
| 179 |
+
f 65 85 70
|
| 180 |
+
f 96 69 74
|
| 181 |
+
f 68 67 72 73
|
| 182 |
+
f 66 65 70 71
|
| 183 |
+
f 96 74 79
|
| 184 |
+
f 73 72 77 78
|
| 185 |
+
f 71 70 75 76
|
| 186 |
+
f 74 73 78 79
|
| 187 |
+
f 72 71 76 77
|
| 188 |
+
f 70 85 75
|
| 189 |
+
f 96 79 84
|
| 190 |
+
f 78 77 82 83
|
| 191 |
+
f 76 75 80 81
|
| 192 |
+
f 79 78 83 84
|
| 193 |
+
f 77 76 81 82
|
| 194 |
+
f 75 85 80
|
| 195 |
+
f 96 84 90
|
| 196 |
+
f 83 82 88 89
|
| 197 |
+
f 81 80 86 87
|
| 198 |
+
f 84 83 89 90
|
| 199 |
+
f 82 81 87 88
|
| 200 |
+
f 80 85 86
|
| 201 |
+
f 89 88 93 94
|
| 202 |
+
f 87 86 91 92
|
| 203 |
+
f 90 89 94 95
|
| 204 |
+
f 88 87 92 93
|
| 205 |
+
f 86 85 91
|
| 206 |
+
f 96 90 95
|
| 207 |
+
f 92 91 65 66
|
| 208 |
+
f 95 94 68 69
|
| 209 |
+
f 93 92 66 67
|
| 210 |
+
f 91 85 65
|
| 211 |
+
f 96 95 69
|
| 212 |
+
f 94 93 67 68
|
gpudrive-main/assets/agent_collision_simplified.obj
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Blender 3.4.1
|
| 2 |
+
# www.blender.org
|
| 3 |
+
o Cube
|
| 4 |
+
v -1.000000 -1.000000 0.000000
|
| 5 |
+
v -1.000000 -1.000000 2.000000
|
| 6 |
+
v -1.000000 1.000000 0.000000
|
| 7 |
+
v -1.000000 1.000000 2.000000
|
| 8 |
+
v 1.000000 -1.000000 0.000000
|
| 9 |
+
v 1.000000 -1.000000 2.000000
|
| 10 |
+
v 1.000000 1.000000 0.000000
|
| 11 |
+
v 1.000000 1.000000 2.000000
|
| 12 |
+
s 0
|
| 13 |
+
f 1 2 4 3
|
| 14 |
+
f 3 4 8 7
|
| 15 |
+
f 7 8 6 5
|
| 16 |
+
f 5 6 2 1
|
| 17 |
+
f 3 7 5 1
|
| 18 |
+
f 8 4 2 6
|
gpudrive-main/assets/agent_render.obj
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
gpudrive-main/assets/cube_collision.obj
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Blender 3.3.1
|
| 2 |
+
# www.blender.org
|
| 3 |
+
o Cube
|
| 4 |
+
v 1.000000 1.000000 1.000000
|
| 5 |
+
v 1.000000 1.000000 -1.000000
|
| 6 |
+
v 1.000000 -1.000000 1.000000
|
| 7 |
+
v 1.000000 -1.000000 -1.000000
|
| 8 |
+
v -1.000000 1.000000 1.000000
|
| 9 |
+
v -1.000000 1.000000 -1.000000
|
| 10 |
+
v -1.000000 -1.000000 1.000000
|
| 11 |
+
v -1.000000 -1.000000 -1.000000
|
| 12 |
+
s 0
|
| 13 |
+
f 1 5 7 3
|
| 14 |
+
f 4 3 7 8
|
| 15 |
+
f 8 7 5 6
|
| 16 |
+
f 6 2 4 8
|
| 17 |
+
f 2 1 3 4
|
| 18 |
+
f 6 5 1 2
|
gpudrive-main/assets/cube_render.obj
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Blender 3.3.1
|
| 2 |
+
# www.blender.org
|
| 3 |
+
o Cube
|
| 4 |
+
v 1.000000 1.000000 1.000000
|
| 5 |
+
v 1.000000 1.000000 -1.000000
|
| 6 |
+
v 1.000000 -1.000000 1.000000
|
| 7 |
+
v 1.000000 -1.000000 -1.000000
|
| 8 |
+
v -1.000000 1.000000 1.000000
|
| 9 |
+
v -1.000000 1.000000 -1.000000
|
| 10 |
+
v -1.000000 -1.000000 1.000000
|
| 11 |
+
v -1.000000 -1.000000 -1.000000
|
| 12 |
+
vn -0.0000 -0.0000 1.0000
|
| 13 |
+
vn -0.0000 -1.0000 -0.0000
|
| 14 |
+
vn -1.0000 -0.0000 -0.0000
|
| 15 |
+
vn -0.0000 -0.0000 -1.0000
|
| 16 |
+
vn 1.0000 -0.0000 -0.0000
|
| 17 |
+
vn -0.0000 1.0000 -0.0000
|
| 18 |
+
vt 0.625000 0.500000
|
| 19 |
+
vt 0.375000 0.500000
|
| 20 |
+
vt 0.625000 0.750000
|
| 21 |
+
vt 0.375000 0.750000
|
| 22 |
+
vt 0.875000 0.500000
|
| 23 |
+
vt 0.625000 0.250000
|
| 24 |
+
vt 0.125000 0.500000
|
| 25 |
+
vt 0.375000 0.250000
|
| 26 |
+
vt 0.875000 0.750000
|
| 27 |
+
vt 0.625000 1.000000
|
| 28 |
+
vt 0.625000 0.000000
|
| 29 |
+
vt 0.375000 0.000000
|
| 30 |
+
vt 0.375000 1.000000
|
| 31 |
+
vt 0.125000 0.750000
|
| 32 |
+
s 0
|
| 33 |
+
f 5/5/1 3/3/1 1/1/1
|
| 34 |
+
f 3/3/2 8/13/2 4/4/2
|
| 35 |
+
f 7/11/3 6/8/3 8/12/3
|
| 36 |
+
f 2/2/4 8/14/4 6/7/4
|
| 37 |
+
f 1/1/5 4/4/5 2/2/5
|
| 38 |
+
f 5/6/6 2/2/6 6/8/6
|
| 39 |
+
f 5/5/1 7/9/1 3/3/1
|
| 40 |
+
f 3/3/2 7/10/2 8/13/2
|
| 41 |
+
f 7/11/3 5/6/3 6/8/3
|
| 42 |
+
f 2/2/4 4/4/4 8/14/4
|
| 43 |
+
f 1/1/5 3/3/5 4/4/5
|
| 44 |
+
f 5/6/6 1/1/6 2/2/6
|
gpudrive-main/assets/cylinder_collision.obj
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Blender 3.3.1
|
| 2 |
+
# www.blender.org
|
| 3 |
+
o Cylinder
|
| 4 |
+
v 0.000000 1.000000 -1.500000
|
| 5 |
+
v 0.000000 1.000000 1.500000
|
| 6 |
+
v 0.382683 0.923880 -1.500000
|
| 7 |
+
v 0.382683 0.923880 1.500000
|
| 8 |
+
v 0.707107 0.707107 -1.500000
|
| 9 |
+
v 0.707107 0.707107 1.500000
|
| 10 |
+
v 0.923880 0.382683 -1.500000
|
| 11 |
+
v 0.923880 0.382683 1.500000
|
| 12 |
+
v 1.000000 0.000000 -1.500000
|
| 13 |
+
v 1.000000 0.000000 1.500000
|
| 14 |
+
v 0.923880 -0.382683 -1.500000
|
| 15 |
+
v 0.923880 -0.382683 1.500000
|
| 16 |
+
v 0.707107 -0.707107 -1.500000
|
| 17 |
+
v 0.707107 -0.707107 1.500000
|
| 18 |
+
v 0.382683 -0.923880 -1.500000
|
| 19 |
+
v 0.382683 -0.923880 1.500000
|
| 20 |
+
v 0.000000 -1.000000 -1.500000
|
| 21 |
+
v 0.000000 -1.000000 1.500000
|
| 22 |
+
v -0.382683 -0.923880 -1.500000
|
| 23 |
+
v -0.382683 -0.923880 1.500000
|
| 24 |
+
v -0.707107 -0.707107 -1.500000
|
| 25 |
+
v -0.707107 -0.707107 1.500000
|
| 26 |
+
v -0.923880 -0.382683 -1.500000
|
| 27 |
+
v -0.923880 -0.382683 1.500000
|
| 28 |
+
v -1.000000 0.000000 -1.500000
|
| 29 |
+
v -1.000000 0.000000 1.500000
|
| 30 |
+
v -0.923880 0.382683 -1.500000
|
| 31 |
+
v -0.923880 0.382683 1.500000
|
| 32 |
+
v -0.707107 0.707107 -1.500000
|
| 33 |
+
v -0.707107 0.707107 1.500000
|
| 34 |
+
v -0.382683 0.923880 -1.500000
|
| 35 |
+
v -0.382683 0.923880 1.500000
|
| 36 |
+
s 0
|
| 37 |
+
f 1 2 4 3
|
| 38 |
+
f 3 4 6 5
|
| 39 |
+
f 5 6 8 7
|
| 40 |
+
f 7 8 10 9
|
| 41 |
+
f 9 10 12 11
|
| 42 |
+
f 11 12 14 13
|
| 43 |
+
f 13 14 16 15
|
| 44 |
+
f 15 16 18 17
|
| 45 |
+
f 17 18 20 19
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Blender 3.3.1
|
| 2 |
+
# www.blender.org
|
| 3 |
+
o Cylinder
|
| 4 |
+
v 0.000000 1.000000 -1.500000
|
| 5 |
+
v 0.000000 1.000000 1.500000
|
| 6 |
+
v 0.382683 0.923880 -1.500000
|
| 7 |
+
v 0.382683 0.923880 1.500000
|
| 8 |
+
v 0.707107 0.707107 -1.500000
|
| 9 |
+
v 0.707107 0.707107 1.500000
|
| 10 |
+
v 0.923880 0.382683 -1.500000
|
| 11 |
+
v 0.923880 0.382683 1.500000
|
| 12 |
+
v 1.000000 0.000000 -1.500000
|
| 13 |
+
v 1.000000 0.000000 1.500000
|
| 14 |
+
v 0.923880 -0.382683 -1.500000
|
| 15 |
+
v 0.923880 -0.382683 1.500000
|
| 16 |
+
v 0.707107 -0.707107 -1.500000
|
| 17 |
+
v 0.707107 -0.707107 1.500000
|
| 18 |
+
v 0.382683 -0.923880 -1.500000
|
| 19 |
+
v 0.382683 -0.923880 1.500000
|
| 20 |
+
v 0.000000 -1.000000 -1.500000
|
| 21 |
+
v 0.000000 -1.000000 1.500000
|
| 22 |
+
v -0.382683 -0.923880 -1.500000
|
| 23 |
+
v -0.382683 -0.923880 1.500000
|
| 24 |
+
v -0.707107 -0.707107 -1.500000
|
| 25 |
+
v -0.707107 -0.707107 1.500000
|
| 26 |
+
v -0.923880 -0.382683 -1.500000
|
| 27 |
+
v -0.923880 -0.382683 1.500000
|
| 28 |
+
v -1.000000 0.000000 -1.500000
|
| 29 |
+
v -1.000000 0.000000 1.500000
|
| 30 |
+
v -0.923880 0.382683 -1.500000
|
| 31 |
+
v -0.923880 0.382683 1.500000
|
| 32 |
+
v -0.707107 0.707107 -1.500000
|
| 33 |
+
v -0.707107 0.707107 1.500000
|
| 34 |
+
v -0.382683 0.923880 -1.500000
|
| 35 |
+
v -0.382683 0.923880 1.500000
|
| 36 |
+
vn 0.1951 0.9808 -0.0000
|
| 37 |
+
vn 0.5556 0.8315 -0.0000
|
| 38 |
+
vn 0.8315 0.5556 -0.0000
|
| 39 |
+
vn 0.9808 0.1951 -0.0000
|
| 40 |
+
vn 0.9808 -0.1951 -0.0000
|
| 41 |
+
vn 0.8315 -0.5556 -0.0000
|
| 42 |
+
vn 0.5556 -0.8315 -0.0000
|
| 43 |
+
vn 0.1951 -0.9808 -0.0000
|
| 44 |
+
vn -0.1951 -0.9808 -0.0000
|
| 45 |
+
vn -0.5556 -0.8315 -0.0000
|
| 46 |
+
vn -0.8315 -0.5556 -0.0000
|
| 47 |
+
vn -0.9808 -0.1951 -0.0000
|
| 48 |
+
vn -0.9808 0.1951 -0.0000
|
| 49 |
+
vn -0.8315 0.5556 -0.0000
|
| 50 |
+
vn -0.0000 -0.0000 1.0000
|
| 51 |
+
vn -0.5556 0.8315 -0.0000
|
| 52 |
+
vn -0.1951 0.9808 -0.0000
|
| 53 |
+
vn -0.0000 -0.0000 -1.0000
|
| 54 |
+
vt 1.000000 0.500000
|
| 55 |
+
vt 0.000000 0.500000
|
| 56 |
+
vt 0.750000 0.490000
|
| 57 |
+
vt 1.000000 1.000000
|
| 58 |
+
vt 0.250000 0.490000
|
| 59 |
+
vt 0.000000 1.000000
|
| 60 |
+
vt 0.937500 0.500000
|
| 61 |
+
vt 0.841844 0.471731
|
| 62 |
+
vt 0.937500 1.000000
|
| 63 |
+
vt 0.341844 0.471731
|
| 64 |
+
vt 0.875000 0.500000
|
| 65 |
+
vt 0.919706 0.419706
|
| 66 |
+
vt 0.875000 1.000000
|
| 67 |
+
vt 0.419706 0.419706
|
| 68 |
+
vt 0.812500 0.500000
|
| 69 |
+
vt 0.971731 0.341844
|
| 70 |
+
vt 0.812500 1.000000
|
| 71 |
+
vt 0.471731 0.341844
|
| 72 |
+
vt 0.750000 0.500000
|
| 73 |
+
vt 0.990000 0.250000
|
| 74 |
+
vt 0.750000 1.000000
|
| 75 |
+
vt 0.490000 0.250000
|
| 76 |
+
vt 0.687500 0.500000
|
| 77 |
+
vt 0.971731 0.158156
|
| 78 |
+
vt 0.687500 1.000000
|
| 79 |
+
vt 0.471731 0.158156
|
| 80 |
+
vt 0.625000 0.500000
|
| 81 |
+
vt 0.919706 0.080294
|
| 82 |
+
vt 0.625000 1.000000
|
| 83 |
+
vt 0.419706 0.080294
|
| 84 |
+
vt 0.562500 0.500000
|
| 85 |
+
vt 0.841844 0.028269
|
| 86 |
+
vt 0.562500 1.000000
|
| 87 |
+
vt 0.341844 0.028269
|
| 88 |
+
vt 0.500000 0.500000
|
| 89 |
+
vt 0.750000 0.010000
|
| 90 |
+
vt 0.500000 1.000000
|
| 91 |
+
vt 0.250000 0.010000
|
| 92 |
+
vt 0.437500 0.500000
|
| 93 |
+
vt 0.658156 0.028269
|
| 94 |
+
vt 0.437500 1.000000
|
| 95 |
+
vt 0.158156 0.028269
|
| 96 |
+
vt 0.375000 0.500000
|
| 97 |
+
vt 0.580294 0.080294
|
| 98 |
+
vt 0.375000 1.000000
|
| 99 |
+
vt 0.080294 0.080294
|
| 100 |
+
vt 0.312500 0.500000
|
| 101 |
+
vt 0.528269 0.158156
|
| 102 |
+
vt 0.312500 1.000000
|
| 103 |
+
vt 0.028269 0.158156
|
| 104 |
+
vt 0.250000 0.500000
|
| 105 |
+
vt 0.510000 0.250000
|
| 106 |
+
vt 0.250000 1.000000
|
| 107 |
+
vt 0.010000 0.250000
|
| 108 |
+
vt 0.187500 0.500000
|
| 109 |
+
vt 0.528269 0.341844
|
| 110 |
+
vt 0.187500 1.000000
|
| 111 |
+
vt 0.028269 0.341844
|
| 112 |
+
vt 0.125000 0.500000
|
| 113 |
+
vt 0.580294 0.419706
|
| 114 |
+
vt 0.080294 0.419706
|
| 115 |
+
vt 0.125000 1.000000
|
| 116 |
+
vt 0.062500 0.500000
|
| 117 |
+
vt 0.658156 0.471731
|
| 118 |
+
vt 0.158156 0.471731
|
| 119 |
+
vt 0.062500 1.000000
|
| 120 |
+
s 0
|
| 121 |
+
f 2/4/1 3/7/1 1/1/1
|
| 122 |
+
f 4/9/2 5/11/2 3/7/2
|
| 123 |
+
f 6/13/3 7/15/3 5/11/3
|
| 124 |
+
f 8/17/4 9/19/4 7/15/4
|
| 125 |
+
f 10/21/5 11/23/5 9/19/5
|
| 126 |
+
f 12/25/6 13/27/6 11/23/6
|
| 127 |
+
f 14/29/7 15/31/7 13/27/7
|
| 128 |
+
f 16/33/8 17/35/8 15/31/8
|
| 129 |
+
f 18/37/9 19/39/9 17/35/9
|
| 130 |
+
f 20/41/10 21/43/10 19/39/10
|
| 131 |
+
f 22/45/11 23/47/11 21/43/11
|
| 132 |
+
f 24/49/12 25/51/12 23/47/12
|
| 133 |
+
f 26/53/13 27/55/13 25/51/13
|
| 134 |
+
f 28/57/14 29/59/14 27/55/14
|
| 135 |
+
f 22/46/15 14/30/15 6/14/15
|
| 136 |
+
f 30/62/16 31/63/16 29/59/16
|
| 137 |
+
f 32/66/17 1/2/17 31/63/17
|
| 138 |
+
f 15/32/18 23/48/18 31/64/18
|
| 139 |
+
f 2/4/1 4/9/1 3/7/1
|
| 140 |
+
f 4/9/2 6/13/2 5/11/2
|
| 141 |
+
f 6/13/3 8/17/3 7/15/3
|
| 142 |
+
f 8/17/4 10/21/4 9/19/4
|
| 143 |
+
f 10/21/5 12/25/5 11/23/5
|
| 144 |
+
f 12/25/6 14/29/6 13/27/6
|
| 145 |
+
f 14/29/7 16/33/7 15/31/7
|
| 146 |
+
f 16/33/8 18/37/8 17/35/8
|
| 147 |
+
f 18/37/9 20/41/9 19/39/9
|
| 148 |
+
f 20/41/10 22/45/10 21/43/10
|
| 149 |
+
f 22/45/11 24/49/11 23/47/11
|
| 150 |
+
f 24/49/12 26/53/12 25/51/12
|
| 151 |
+
f 26/53/13 28/57/13 27/55/13
|
| 152 |
+
f 28/57/14 30/62/14 29/59/14
|
| 153 |
+
f 6/14/15 4/10/15 2/5/15
|
| 154 |
+
f 2/5/15 32/65/15 30/61/15
|
| 155 |
+
f 30/61/15 28/58/15 26/54/15
|
| 156 |
+
f 26/54/15 24/50/15 22/46/15
|
| 157 |
+
f 22/46/15 20/42/15 18/38/15
|
| 158 |
+
f 18/38/15 16/34/15 14/30/15
|
| 159 |
+
f 14/30/15 12/26/15 10/22/15
|
| 160 |
+
f 10/22/15 8/18/15 6/14/15
|
| 161 |
+
f 6/14/15 2/5/15 30/61/15
|
| 162 |
+
f 30/61/15 26/54/15 22/46/15
|
| 163 |
+
f 22/46/15 18/38/15 14/30/15
|
| 164 |
+
f 14/30/15 10/22/15 6/14/15
|
| 165 |
+
f 6/14/15 30/61/15 22/46/15
|
| 166 |
+
f 30/62/16 32/66/16 31/63/16
|
| 167 |
+
f 32/66/17 2/6/17 1/2/17
|
| 168 |
+
f 31/64/18 1/3/18 3/8/18
|
| 169 |
+
f 3/8/18 5/12/18 7/16/18
|
| 170 |
+
f 7/16/18 9/20/18 11/24/18
|
| 171 |
+
f 11/24/18 13/28/18 15/32/18
|
| 172 |
+
f 15/32/18 17/36/18 19/40/18
|
| 173 |
+
f 19/40/18 21/44/18 23/48/18
|
| 174 |
+
f 23/48/18 25/52/18 27/56/18
|
| 175 |
+
f 27/56/18 29/60/18 31/64/18
|
| 176 |
+
f 31/64/18 3/8/18 7/16/18
|
| 177 |
+
f 7/16/18 11/24/18 15/32/18
|
| 178 |
+
f 15/32/18 19/40/18 23/48/18
|
| 179 |
+
f 23/48/18 27/56/18 31/64/18
|
| 180 |
+
f 31/64/18 7/16/18 15/32/18
|
gpudrive-main/assets/distribution.png
ADDED
|
Git LFS Details
|
gpudrive-main/assets/elongated_collision.obj
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Blender 3.3.1
|
| 2 |
+
# www.blender.org
|
| 3 |
+
o Cube
|
| 4 |
+
v -4.000000 -0.750000 -1.000000
|
| 5 |
+
v -4.000000 -0.750000 1.000000
|
| 6 |
+
v -4.000000 0.750000 -1.000000
|
| 7 |
+
v -4.000000 0.750000 1.000000
|
| 8 |
+
v 4.000000 -0.750000 -1.000000
|
| 9 |
+
v 4.000000 -0.750000 1.000000
|
| 10 |
+
v 4.000000 0.750000 -1.000000
|
| 11 |
+
v 4.000000 0.750000 1.000000
|
| 12 |
+
s 0
|
| 13 |
+
f 1 2 4 3
|
| 14 |
+
f 3 4 8 7
|
| 15 |
+
f 7 8 6 5
|
| 16 |
+
f 5 6 2 1
|
| 17 |
+
f 3 7 5 1
|
| 18 |
+
f 8 4 2 6
|
gpudrive-main/assets/elongated_render.obj
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Blender 3.3.1
|
| 2 |
+
# www.blender.org
|
| 3 |
+
o Cube
|
| 4 |
+
v -4.000000 -0.750000 -1.000000
|
| 5 |
+
v -4.000000 -0.750000 1.000000
|
| 6 |
+
v -4.000000 0.750000 -1.000000
|
| 7 |
+
v -4.000000 0.750000 1.000000
|
| 8 |
+
v 4.000000 -0.750000 -1.000000
|
| 9 |
+
v 4.000000 -0.750000 1.000000
|
| 10 |
+
v 4.000000 0.750000 -1.000000
|
| 11 |
+
v 4.000000 0.750000 1.000000
|
| 12 |
+
vn -1.0000 -0.0000 -0.0000
|
| 13 |
+
vn -0.0000 1.0000 -0.0000
|
| 14 |
+
vn 1.0000 -0.0000 -0.0000
|
| 15 |
+
vn -0.0000 -1.0000 -0.0000
|
| 16 |
+
vn -0.0000 -0.0000 -1.0000
|
| 17 |
+
vn -0.0000 -0.0000 1.0000
|
| 18 |
+
vt 0.375000 0.000000
|
| 19 |
+
vt 0.375000 1.000000
|
| 20 |
+
vt 0.125000 0.750000
|
| 21 |
+
vt 0.625000 0.000000
|
| 22 |
+
vt 0.625000 1.000000
|
| 23 |
+
vt 0.875000 0.750000
|
| 24 |
+
vt 0.125000 0.500000
|
| 25 |
+
vt 0.375000 0.250000
|
| 26 |
+
vt 0.625000 0.250000
|
| 27 |
+
vt 0.875000 0.500000
|
| 28 |
+
vt 0.375000 0.750000
|
| 29 |
+
vt 0.625000 0.750000
|
| 30 |
+
vt 0.375000 0.500000
|
| 31 |
+
vt 0.625000 0.500000
|
| 32 |
+
s 0
|
| 33 |
+
f 2/4/1 3/8/1 1/1/1
|
| 34 |
+
f 4/9/2 7/13/2 3/8/2
|
| 35 |
+
f 8/14/3 5/11/3 7/13/3
|
| 36 |
+
f 6/12/4 1/2/4 5/11/4
|
| 37 |
+
f 7/13/5 1/3/5 3/7/5
|
| 38 |
+
f 4/10/6 6/12/6 8/14/6
|
| 39 |
+
f 2/4/1 4/9/1 3/8/1
|
| 40 |
+
f 4/9/2 8/14/2 7/13/2
|
| 41 |
+
f 8/14/3 6/12/3 5/11/3
|
| 42 |
+
f 6/12/4 2/5/4 1/2/4
|
| 43 |
+
f 7/13/5 5/11/5 1/3/5
|
| 44 |
+
f 4/10/6 2/6/6 6/12/6
|
gpudrive-main/assets/example_scene.gif
ADDED
|
Git LFS Details
|
gpudrive-main/assets/gpudrive_gif_collage.gif
ADDED
|
Git LFS Details
|
gpudrive-main/assets/green_agent.svg
ADDED
|
|
gpudrive-main/assets/green_grid.png
ADDED
|
Git LFS Details
|
gpudrive-main/assets/multi_actors_demo_control_3_different.gif
ADDED
|
Git LFS Details
|
gpudrive-main/assets/multi_actors_demo_control_multiple.gif
ADDED
|
Git LFS Details
|
gpudrive-main/assets/navigation.png
ADDED
|
Git LFS Details
|
gpudrive-main/assets/obs_video_0_10.gif
ADDED
|
Git LFS Details
|
gpudrive-main/assets/obs_video_7.gif
ADDED
|
Git LFS Details
|
gpudrive-main/assets/obs_video_clear_example.gif
ADDED
|
Git LFS Details
|
gpudrive-main/assets/pink_agent.svg
ADDED
|
|
gpudrive-main/assets/plane.obj
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Blender 3.3.1
|
| 2 |
+
# www.blender.org
|
| 3 |
+
o Plane
|
| 4 |
+
v -10000.0 -10000.0 0.000000
|
| 5 |
+
v 10000.0 -10000.0 0.000000
|
| 6 |
+
v -10000.0 10000.0 0.000000
|
| 7 |
+
v 10000.0 10000.0 0.000000
|
| 8 |
+
vn -0.0000 -0.0000 1.0000
|
| 9 |
+
vt 0.000000 0.000000
|
| 10 |
+
vt 1000.000000 0.000000
|
| 11 |
+
vt 0.000000 1000.000000
|
| 12 |
+
vt 1000.000000 1000.000000
|
| 13 |
+
s 0
|
| 14 |
+
f 2/2/1 3/3/1 1/1/1
|
| 15 |
+
f 2/2/1 4/4/1 3/3/1
|
gpudrive-main/assets/ramp_collision.obj
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Blender 3.3.1
|
| 2 |
+
# www.blender.org
|
| 3 |
+
o Cube
|
| 4 |
+
v 1.000000 1.000000 1.000000
|
| 5 |
+
v 1.000000 1.000000 -1.000000
|
| 6 |
+
v 1.000000 -2.000000 -1.000000
|
| 7 |
+
v -1.000000 1.000000 1.000000
|
| 8 |
+
v -1.000000 1.000000 -1.000000
|
| 9 |
+
v -1.000000 -2.000000 -1.000000
|
| 10 |
+
s 0
|
| 11 |
+
f 5 2 3 6
|
| 12 |
+
f 5 4 1 2
|
| 13 |
+
f 3 1 4 6
|
| 14 |
+
f 2 1 3
|
| 15 |
+
f 6 4 5
|
gpudrive-main/assets/ramp_render.obj
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Blender 3.3.1
|
| 2 |
+
# www.blender.org
|
| 3 |
+
o Cube
|
| 4 |
+
v 1.000000 1.000000 1.000000
|
| 5 |
+
v 1.000000 1.000000 -1.000000
|
| 6 |
+
v 1.000000 -2.000000 -1.000000
|
| 7 |
+
v -1.000000 1.000000 1.000000
|
| 8 |
+
v -1.000000 1.000000 -1.000000
|
| 9 |
+
v -1.000000 -2.000000 -1.000000
|
| 10 |
+
v 1.000000 1.000000 1.000000
|
| 11 |
+
v -1.000000 1.000000 1.000000
|
| 12 |
+
vn -0.0000 -0.0000 -1.0000
|
| 13 |
+
vn -0.0000 1.0000 -0.0000
|
| 14 |
+
vn -0.0000 -0.5547 0.8321
|
| 15 |
+
vn 1.0000 -0.0000 -0.0000
|
| 16 |
+
vn -1.0000 -0.0000 -0.0000
|
| 17 |
+
vt 0.625000 0.500000
|
| 18 |
+
vt 0.375000 0.500000
|
| 19 |
+
vt 0.375000 0.750000
|
| 20 |
+
vt 0.625000 0.250000
|
| 21 |
+
vt 0.375000 0.250000
|
| 22 |
+
vt 0.125000 0.500000
|
| 23 |
+
vt 0.125000 0.750000
|
| 24 |
+
vt 0.000000 0.000000
|
| 25 |
+
vt 0.000000 0.000000
|
| 26 |
+
s 0
|
| 27 |
+
f 2/2/1 6/7/1 5/6/1
|
| 28 |
+
f 4/4/2 2/2/2 5/5/2
|
| 29 |
+
f 7/8/3 6/7/3 3/3/3
|
| 30 |
+
f 2/2/4 7/8/4 3/3/4
|
| 31 |
+
f 6/7/5 8/9/5 5/6/5
|
| 32 |
+
f 2/2/1 3/3/1 6/7/1
|
| 33 |
+
f 4/4/2 1/1/2 2/2/2
|
| 34 |
+
f 7/8/3 8/9/3 6/7/3
|
| 35 |
+
l 1 7
|
| 36 |
+
l 4 8
|
gpudrive-main/assets/sim_video_0_10.gif
ADDED
|
Git LFS Details
|
gpudrive-main/assets/sim_video_7.gif
ADDED
|
Git LFS Details
|
gpudrive-main/assets/sim_video_clear_example.gif
ADDED
|
Git LFS Details
|
gpudrive-main/assets/smile.png
ADDED
|
Git LFS Details
|
gpudrive-main/assets/wall_collision.obj
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Blender 3.4.1
|
| 2 |
+
# www.blender.org
|
| 3 |
+
o Cube
|
| 4 |
+
v 0.500000 0.500000 2.500000
|
| 5 |
+
v 0.500000 0.500000 0.000000
|
| 6 |
+
v 0.500000 -0.500000 2.500000
|
| 7 |
+
v 0.500000 -0.500000 0.000000
|
| 8 |
+
v -0.500000 0.500000 2.500000
|
| 9 |
+
v -0.500000 0.500000 0.000000
|
| 10 |
+
v -0.500000 -0.500000 2.500000
|
| 11 |
+
v -0.500000 -0.500000 0.000000
|
| 12 |
+
s 0
|
| 13 |
+
f 1 5 7 3
|
| 14 |
+
f 4 3 7 8
|
| 15 |
+
f 8 7 5 6
|
| 16 |
+
f 6 2 4 8
|
| 17 |
+
f 2 1 3 4
|
| 18 |
+
f 6 5 1 2
|
gpudrive-main/assets/wall_render.obj
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Blender 3.4.1
|
| 2 |
+
# www.blender.org
|
| 3 |
+
o Cube
|
| 4 |
+
v 0.500000 0.500000 2.500000
|
| 5 |
+
v 0.500000 0.500000 0.000000
|
| 6 |
+
v 0.500000 -0.500000 2.500000
|
| 7 |
+
v 0.500000 -0.500000 0.000000
|
| 8 |
+
v -0.500000 0.500000 2.500000
|
| 9 |
+
v -0.500000 0.500000 0.000000
|
| 10 |
+
v -0.500000 -0.500000 2.500000
|
| 11 |
+
v -0.500000 -0.500000 0.000000
|
| 12 |
+
vn -0.0000 -0.0000 1.0000
|
| 13 |
+
vn -0.0000 -1.0000 -0.0000
|
| 14 |
+
vn -1.0000 -0.0000 -0.0000
|
| 15 |
+
vn -0.0000 -0.0000 -1.0000
|
| 16 |
+
vn 1.0000 -0.0000 -0.0000
|
| 17 |
+
vn -0.0000 1.0000 -0.0000
|
| 18 |
+
vt 0.625000 0.500000
|
| 19 |
+
vt 0.375000 0.500000
|
| 20 |
+
vt 0.625000 0.750000
|
| 21 |
+
vt 0.375000 0.750000
|
| 22 |
+
vt 0.875000 0.500000
|
| 23 |
+
vt 0.625000 0.250000
|
| 24 |
+
vt 0.125000 0.500000
|
| 25 |
+
vt 0.375000 0.250000
|
| 26 |
+
vt 0.875000 0.750000
|
| 27 |
+
vt 0.625000 1.000000
|
| 28 |
+
vt 0.625000 0.000000
|
| 29 |
+
vt 0.375000 0.000000
|
| 30 |
+
vt 0.375000 1.000000
|
| 31 |
+
vt 0.125000 0.750000
|
| 32 |
+
s 0
|
| 33 |
+
f 5/5/1 3/3/1 1/1/1
|
| 34 |
+
f 3/3/2 8/13/2 4/4/2
|
| 35 |
+
f 7/11/3 6/8/3 8/12/3
|
| 36 |
+
f 2/2/4 8/14/4 6/7/4
|
| 37 |
+
f 1/1/5 4/4/5 2/2/5
|
| 38 |
+
f 5/6/6 2/2/6 6/8/6
|
| 39 |
+
f 5/5/1 7/9/1 3/3/1
|
| 40 |
+
f 3/3/2 7/10/2 8/13/2
|
| 41 |
+
f 7/11/3 5/6/3 6/8/3
|
| 42 |
+
f 2/2/4 4/4/4 8/14/4
|
| 43 |
+
f 1/1/5 3/3/5 4/4/5
|
| 44 |
+
f 5/6/6 1/1/6 2/2/6
|
gpudrive-main/assets/yellow_agent.svg
ADDED
|
|
gpudrive-main/baselines/__init__.py
ADDED
|
File without changes
|
gpudrive-main/baselines/imitation_data_generation.py
ADDED
|
@@ -0,0 +1,279 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Extract expert states and actions from Waymo Open Dataset."""
|
| 2 |
+
import torch
|
| 3 |
+
import numpy as np
|
| 4 |
+
import imageio
|
| 5 |
+
import logging
|
| 6 |
+
import argparse
|
| 7 |
+
|
| 8 |
+
from pygpudrive.env.config import EnvConfig, RenderConfig, SceneConfig
|
| 9 |
+
from pygpudrive.env.env_torch import GPUDriveTorchEnv
|
| 10 |
+
|
| 11 |
+
logging.getLogger(__name__)
|
| 12 |
+
|
| 13 |
+
|
| 14 |
+
def parse_args():
|
| 15 |
+
parser = argparse.ArgumentParser("Select the dynamics model that you use")
|
| 16 |
+
parser.add_argument(
|
| 17 |
+
"--dynamics-model",
|
| 18 |
+
"-d",
|
| 19 |
+
type=str,
|
| 20 |
+
default="delta_local",
|
| 21 |
+
choices=["delta_local", "bicycle", "classic"],
|
| 22 |
+
)
|
| 23 |
+
args = parser.parse_args()
|
| 24 |
+
return args
|
| 25 |
+
|
| 26 |
+
|
| 27 |
+
def map_to_closest_discrete_value(grid, cont_actions):
|
| 28 |
+
"""
|
| 29 |
+
Find the nearest value in the action grid for a given expert action.
|
| 30 |
+
"""
|
| 31 |
+
# Calculate the absolute differences and find the indices of the minimum values
|
| 32 |
+
abs_diff = torch.abs(grid.unsqueeze(0) - cont_actions.unsqueeze(-1))
|
| 33 |
+
indx = torch.argmin(abs_diff, dim=-1)
|
| 34 |
+
|
| 35 |
+
# Gather the closest values based on the indices
|
| 36 |
+
closest_values = grid[indx]
|
| 37 |
+
|
| 38 |
+
return closest_values, indx
|
| 39 |
+
|
| 40 |
+
|
| 41 |
+
def generate_state_action_pairs(
|
| 42 |
+
env,
|
| 43 |
+
device,
|
| 44 |
+
action_space_type="discrete",
|
| 45 |
+
use_action_indices=False,
|
| 46 |
+
make_video=False,
|
| 47 |
+
render_index=[0],
|
| 48 |
+
save_path="output_video.mp4",
|
| 49 |
+
):
|
| 50 |
+
"""Generate pairs of states and actions from the Waymo Open Dataset.
|
| 51 |
+
|
| 52 |
+
Args:
|
| 53 |
+
env (GPUDriveTorchEnv): Initialized environment class.
|
| 54 |
+
device (str): Where to run the simulation (cpu or cuda).
|
| 55 |
+
action_space_type (str): discrete, multi-discrete, continuous
|
| 56 |
+
use_action_indices (bool): Whether to return action indices instead of action values.
|
| 57 |
+
make_video (bool): Whether to save a video of the expert trajectory.
|
| 58 |
+
render_index (int): Index of the world to render (must be <= num_worlds).
|
| 59 |
+
|
| 60 |
+
Returns:
|
| 61 |
+
expert_actions: Expert actions for the controlled agents. An action is a
|
| 62 |
+
tuple with (acceleration, steering, heading).
|
| 63 |
+
obs_tensor: Expert observations for the controlled agents.
|
| 64 |
+
"""
|
| 65 |
+
frames = [[] for _ in range(render_index[1] - render_index[0])]
|
| 66 |
+
|
| 67 |
+
logging.info(
|
| 68 |
+
f"Generating expert actions and observations for {env.num_worlds} worlds \n"
|
| 69 |
+
)
|
| 70 |
+
|
| 71 |
+
# Reset the environment
|
| 72 |
+
obs = env.reset()
|
| 73 |
+
|
| 74 |
+
# Get expert actions for full trajectory in all worlds
|
| 75 |
+
expert_actions, expert_speeds, expert_positions, expert_yaws = env.get_expert_actions()
|
| 76 |
+
if action_space_type == "discrete":
|
| 77 |
+
# Discretize the expert actions: map every value to the closest
|
| 78 |
+
# value in the action grid.
|
| 79 |
+
disc_expert_actions = expert_actions.clone()
|
| 80 |
+
if env.config.dynamics_model == "delta_local":
|
| 81 |
+
disc_expert_actions[:, :, :, 0], _ = map_to_closest_discrete_value(
|
| 82 |
+
grid=env.dx, cont_actions=expert_actions[:, :, :, 0]
|
| 83 |
+
)
|
| 84 |
+
disc_expert_actions[:, :, :, 1], _ = map_to_closest_discrete_value(
|
| 85 |
+
grid=env.dy, cont_actions=expert_actions[:, :, :, 1]
|
| 86 |
+
)
|
| 87 |
+
disc_expert_actions[:, :, :, 2], _ = map_to_closest_discrete_value(
|
| 88 |
+
grid=env.dyaw, cont_actions=expert_actions[:, :, :, 2]
|
| 89 |
+
)
|
| 90 |
+
else:
|
| 91 |
+
# Acceleration
|
| 92 |
+
disc_expert_actions[:, :, :, 0], _ = map_to_closest_discrete_value(
|
| 93 |
+
grid=env.accel_actions, cont_actions=expert_actions[:, :, :, 0]
|
| 94 |
+
)
|
| 95 |
+
# Steering
|
| 96 |
+
disc_expert_actions[:, :, :, 1], _ = map_to_closest_discrete_value(
|
| 97 |
+
grid=env.steer_actions, cont_actions=expert_actions[:, :, :, 1]
|
| 98 |
+
)
|
| 99 |
+
|
| 100 |
+
if use_action_indices: # Map action values to joint action index
|
| 101 |
+
logging.info("Mapping expert actions to joint action index... \n")
|
| 102 |
+
expert_action_indices = torch.zeros(
|
| 103 |
+
expert_actions.shape[0],
|
| 104 |
+
expert_actions.shape[1],
|
| 105 |
+
expert_actions.shape[2],
|
| 106 |
+
1,
|
| 107 |
+
dtype=torch.int32,
|
| 108 |
+
).to(device)
|
| 109 |
+
for world_idx in range(disc_expert_actions.shape[0]):
|
| 110 |
+
for agent_idx in range(disc_expert_actions.shape[1]):
|
| 111 |
+
for time_idx in range(disc_expert_actions.shape[2]):
|
| 112 |
+
action_val_tuple = tuple(
|
| 113 |
+
round(x, 3)
|
| 114 |
+
for x in disc_expert_actions[
|
| 115 |
+
world_idx, agent_idx, time_idx, :
|
| 116 |
+
].tolist()
|
| 117 |
+
)
|
| 118 |
+
if not env.config.dynamics_model == "delta_local":
|
| 119 |
+
action_val_tuple = (
|
| 120 |
+
action_val_tuple[0],
|
| 121 |
+
action_val_tuple[1],
|
| 122 |
+
0.0,
|
| 123 |
+
)
|
| 124 |
+
|
| 125 |
+
action_idx = env.values_to_action_key.get(
|
| 126 |
+
action_val_tuple
|
| 127 |
+
)
|
| 128 |
+
expert_action_indices[
|
| 129 |
+
world_idx, agent_idx, time_idx
|
| 130 |
+
] = action_idx
|
| 131 |
+
|
| 132 |
+
expert_actions = expert_action_indices
|
| 133 |
+
else:
|
| 134 |
+
# Map action values to joint action index
|
| 135 |
+
expert_actions = disc_expert_actions
|
| 136 |
+
elif action_space_type == "multi_discrete":
|
| 137 |
+
"""will be update"""
|
| 138 |
+
pass
|
| 139 |
+
else:
|
| 140 |
+
logging.info("Using continuous expert actions... \n")
|
| 141 |
+
|
| 142 |
+
# Storage
|
| 143 |
+
expert_observations_lst = []
|
| 144 |
+
expert_actions_lst = []
|
| 145 |
+
expert_next_obs_lst = []
|
| 146 |
+
expert_dones_lst = []
|
| 147 |
+
|
| 148 |
+
# Initialize dead agent mask
|
| 149 |
+
|
| 150 |
+
dead_agent_mask = ~env.cont_agent_mask.clone()
|
| 151 |
+
alive_agent_mask = env.cont_agent_mask.clone()
|
| 152 |
+
for time_step in range(env.episode_len):
|
| 153 |
+
|
| 154 |
+
# Step the environment with inferred expert actions
|
| 155 |
+
env.step_dynamics(expert_actions[:, :, time_step, :])
|
| 156 |
+
|
| 157 |
+
next_obs = env.get_obs()
|
| 158 |
+
|
| 159 |
+
dones = env.get_dones()
|
| 160 |
+
infos = env.get_infos()
|
| 161 |
+
|
| 162 |
+
# Unpack and store (obs, action, next_obs, dones) pairs for controlled agents
|
| 163 |
+
expert_observations_lst.append(obs[~dead_agent_mask, :])
|
| 164 |
+
expert_actions_lst.append(
|
| 165 |
+
expert_actions[~dead_agent_mask][:, time_step, :]
|
| 166 |
+
)
|
| 167 |
+
|
| 168 |
+
expert_next_obs_lst.append(next_obs[~dead_agent_mask, :])
|
| 169 |
+
expert_dones_lst.append(dones[~dead_agent_mask])
|
| 170 |
+
|
| 171 |
+
# Update
|
| 172 |
+
obs = next_obs
|
| 173 |
+
dead_agent_mask = torch.logical_or(dead_agent_mask, dones)
|
| 174 |
+
|
| 175 |
+
# Render
|
| 176 |
+
if make_video:
|
| 177 |
+
for render in range(render_index[0], render_index[1]):
|
| 178 |
+
frame = env.render(world_render_idx=render)
|
| 179 |
+
frames[render].append(frame)
|
| 180 |
+
if (dead_agent_mask == True).all():
|
| 181 |
+
break
|
| 182 |
+
|
| 183 |
+
is_collision = infos[:, :, :3].sum(dim=-1)
|
| 184 |
+
is_goal = infos[:, :, 3]
|
| 185 |
+
collision_mask = is_collision != 0
|
| 186 |
+
goal_mask = is_goal != 0
|
| 187 |
+
valid_collision_mask = collision_mask & alive_agent_mask
|
| 188 |
+
valid_goal_mask = goal_mask & alive_agent_mask
|
| 189 |
+
collision_rate = (
|
| 190 |
+
valid_collision_mask.sum().float() / alive_agent_mask.sum().float()
|
| 191 |
+
)
|
| 192 |
+
goal_rate = valid_goal_mask.sum().float() / alive_agent_mask.sum().float()
|
| 193 |
+
|
| 194 |
+
print(f"Collision {collision_rate} Goal {goal_rate}")
|
| 195 |
+
|
| 196 |
+
if make_video:
|
| 197 |
+
for render in range(render_index[0], render_index[1]):
|
| 198 |
+
imageio.mimwrite(
|
| 199 |
+
f"{save_path}_world_{render}.mp4",
|
| 200 |
+
np.array(frames[render]),
|
| 201 |
+
fps=30,
|
| 202 |
+
)
|
| 203 |
+
|
| 204 |
+
flat_expert_obs = torch.cat(expert_observations_lst, dim=0)
|
| 205 |
+
flat_expert_actions = torch.cat(expert_actions_lst, dim=0)
|
| 206 |
+
flat_next_expert_obs = torch.cat(expert_next_obs_lst, dim=0)
|
| 207 |
+
flat_expert_dones = torch.cat(expert_dones_lst, dim=0)
|
| 208 |
+
|
| 209 |
+
return (
|
| 210 |
+
flat_expert_obs,
|
| 211 |
+
flat_expert_actions,
|
| 212 |
+
flat_next_expert_obs,
|
| 213 |
+
flat_expert_dones,
|
| 214 |
+
goal_rate,
|
| 215 |
+
collision_rate,
|
| 216 |
+
)
|
| 217 |
+
|
| 218 |
+
|
| 219 |
+
if __name__ == "__main__":
|
| 220 |
+
import argparse
|
| 221 |
+
|
| 222 |
+
args = parse_args()
|
| 223 |
+
torch.set_printoptions(precision=3, sci_mode=False)
|
| 224 |
+
NUM_WORLDS = 10
|
| 225 |
+
MAX_NUM_OBJECTS = 128
|
| 226 |
+
|
| 227 |
+
# Initialize lists to store results
|
| 228 |
+
num_actions = []
|
| 229 |
+
goal_rates = []
|
| 230 |
+
collision_rates = []
|
| 231 |
+
|
| 232 |
+
# Set the environment and render configurations
|
| 233 |
+
# Action space (joint discrete)
|
| 234 |
+
|
| 235 |
+
render_config = RenderConfig(draw_obj_idx=True)
|
| 236 |
+
scene_config = SceneConfig(
|
| 237 |
+
"/data/formatted_json_v2_no_tl_train/", NUM_WORLDS
|
| 238 |
+
)
|
| 239 |
+
env_config = EnvConfig(
|
| 240 |
+
dynamics_model=args.dynamics_model,
|
| 241 |
+
steer_actions=torch.round(torch.linspace(-0.3, 0.3, 7), decimals=3),
|
| 242 |
+
accel_actions=torch.round(torch.linspace(-6.0, 6.0, 7), decimals=3),
|
| 243 |
+
dx=torch.round(torch.linspace(-3.0, 3.0, 100), decimals=3),
|
| 244 |
+
dy=torch.round(torch.linspace(-3.0, 3.0, 100), decimals=3),
|
| 245 |
+
dyaw=torch.round(torch.linspace(-1.0, 1.0, 300), decimals=3),
|
| 246 |
+
)
|
| 247 |
+
|
| 248 |
+
env = GPUDriveTorchEnv(
|
| 249 |
+
config=env_config,
|
| 250 |
+
scene_config=scene_config,
|
| 251 |
+
max_cont_agents=MAX_NUM_OBJECTS, # Number of agents to control
|
| 252 |
+
device="cpu",
|
| 253 |
+
render_config=render_config,
|
| 254 |
+
action_type="continuous",
|
| 255 |
+
)
|
| 256 |
+
# Generate expert actions and observations
|
| 257 |
+
(
|
| 258 |
+
expert_obs,
|
| 259 |
+
expert_actions,
|
| 260 |
+
next_expert_obs,
|
| 261 |
+
expert_dones,
|
| 262 |
+
goal_rate,
|
| 263 |
+
collision_rate,
|
| 264 |
+
) = generate_state_action_pairs(
|
| 265 |
+
env=env,
|
| 266 |
+
device="cpu",
|
| 267 |
+
action_space_type="continuous", # Discretize the expert actions
|
| 268 |
+
use_action_indices=True, # Map action values to joint action index
|
| 269 |
+
make_video=True, # Record the trajectories as sanity check
|
| 270 |
+
render_index=[0, 1], # start_idx, end_idx
|
| 271 |
+
save_path="use_discr_actions_fix",
|
| 272 |
+
)
|
| 273 |
+
env.close()
|
| 274 |
+
del env
|
| 275 |
+
del env_config
|
| 276 |
+
|
| 277 |
+
# Uncommment to save the expert actions and observations
|
| 278 |
+
# torch.save(expert_actions, "expert_actions.pt")
|
| 279 |
+
# torch.save(expert_obs, "expert_obs.pt")
|
gpudrive-main/baselines/ppo/README.md
ADDED
|
@@ -0,0 +1,106 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Using IPPO in GPUDrive
|
| 2 |
+
|
| 3 |
+
## PufferLib implementation
|
| 4 |
+
|
| 5 |
+
### Dependencies
|
| 6 |
+
|
| 7 |
+
This implementation is compatible with the `gpudrive` branch of [PufferLib](https://github.com/PufferAI/PufferLib/tree/gpudrive/pufferlib/environments/gpudrive). To install, run:
|
| 8 |
+
|
| 9 |
+
```
|
| 10 |
+
pip install git+https://github.com/PufferAI/PufferLib.git@gpudrive
|
| 11 |
+
```
|
| 12 |
+
|
| 13 |
+
### Example
|
| 14 |
+
|
| 15 |
+
- Launch a run:
|
| 16 |
+
|
| 17 |
+
```bash
|
| 18 |
+
python baselines/ippo/ippo_pufferlib.py
|
| 19 |
+
```
|
| 20 |
+
|
| 21 |
+
- Configs are in `baselines/ippo/config/ippo_ff_puffer.yaml`
|
| 22 |
+
- A small feedforward network is implemented in `integrations/rl/puffer/utils.py`
|
| 23 |
+
|
| 24 |
+
## Stable baselines 3 implementation
|
| 25 |
+
|
| 26 |
+
### Example
|
| 27 |
+
|
| 28 |
+
- Launch a run:
|
| 29 |
+
|
| 30 |
+
```
|
| 31 |
+
python baselines/ippo/ippo_sb3.py
|
| 32 |
+
```
|
| 33 |
+
|
| 34 |
+
- Configurations are found in `baselines/ippo/config/ippo_ff_sb3.yaml`
|
| 35 |
+
|
| 36 |
+
### Details
|
| 37 |
+
|
| 38 |
+
#### Resampling the data
|
| 39 |
+
|
| 40 |
+
The configuration for resampling traffic scenarios includes:
|
| 41 |
+
|
| 42 |
+
- **`resample_scenarios`**: A boolean that enables or disables traffic scenario resampling when set to `True`.
|
| 43 |
+
- **`resample_criterion`**: Set to `"global_step"`, indicating resampling occurs based on the global step count.
|
| 44 |
+
- **`resample_freq`**: Specifies resampling frequency at `50,000` steps, recommended to align with `num_worlds * n_steps`.
|
| 45 |
+
- **`resample_mode`**: Set to `"random"` for random selection of new scenarios.
|
| 46 |
+
|
| 47 |
+
```
|
| 48 |
+
# RESAMPLE TRAFFIC SCENARIOS
|
| 49 |
+
resample_scenarios: bool = True
|
| 50 |
+
resample_criterion: str = "global_step" # Options: "global_step"
|
| 51 |
+
resample_freq: int = 100_000 # Resample every k steps (recommended to be a multiple of num_worlds * n_steps)
|
| 52 |
+
resample_mode: str = "random" # Options: "random"
|
| 53 |
+
```
|
| 54 |
+
|
| 55 |
+
#### Implemented networks
|
| 56 |
+
|
| 57 |
+
- Classic Observations
|
| 58 |
+
|
| 59 |
+
For classic observations (e.g., `ego_state`), there is support for a permutation equivariant network (recommended). In `baselines/ippo/config.py`, set the following:
|
| 60 |
+
|
| 61 |
+
```python
|
| 62 |
+
# NETWORK
|
| 63 |
+
mlp_class = LateFusionNet
|
| 64 |
+
policy = LateFusionPolicy
|
| 65 |
+
```
|
| 66 |
+
|
| 67 |
+
The default settings for classic observations are:
|
| 68 |
+
|
| 69 |
+
```python
|
| 70 |
+
ego_state: bool = True # Use ego vehicle state
|
| 71 |
+
road_map_obs: bool = True # Use road graph data
|
| 72 |
+
partner_obs: bool = True # Include partner vehicle information
|
| 73 |
+
norm_obs: bool = True # Normalize observations
|
| 74 |
+
```
|
| 75 |
+
|
| 76 |
+
- LiDAR Observations
|
| 77 |
+
|
| 78 |
+
For only LiDAR-based observations, set the following options:
|
| 79 |
+
|
| 80 |
+
```python
|
| 81 |
+
ego_state: bool = False # Use ego vehicle state
|
| 82 |
+
road_map_obs: bool = False # Use road graph data
|
| 83 |
+
partner_obs: bool = False # Include partner vehicle information
|
| 84 |
+
norm_obs: bool = False # Normalize observations
|
| 85 |
+
disable_classic_obs: bool = True # Disable classic observations for faster sim
|
| 86 |
+
lidar_obs: bool = True # Use LiDAR in observations
|
| 87 |
+
```
|
| 88 |
+
|
| 89 |
+
You can also **mix** classic and LiDAR observations by setting:
|
| 90 |
+
|
| 91 |
+
```python
|
| 92 |
+
ego_state: bool = True # Include ego vehicle state in observations
|
| 93 |
+
road_map_obs: bool = True # Include road graph in observations
|
| 94 |
+
partner_obs: bool = True # Include partner vehicle info in observations
|
| 95 |
+
norm_obs: bool = True # Normalize observations
|
| 96 |
+
disable_classic_obs: bool = False # Keep classic observations
|
| 97 |
+
lidar_obs: bool = True # Add LiDAR to observations
|
| 98 |
+
```
|
| 99 |
+
|
| 100 |
+
In both cases, you can use a feedforward network from `networks/basic_ffn.py`:
|
| 101 |
+
|
| 102 |
+
```python
|
| 103 |
+
# NETWORK
|
| 104 |
+
mlp_class = FFN
|
| 105 |
+
policy = FeedForwardPolicy
|
| 106 |
+
```
|