From 637a2213c545d33d88cb42479b20fec07e65d345 Mon Sep 17 00:00:00 2001 From: Quanyi Li Date: Tue, 6 Feb 2024 14:01:46 +0000 Subject: [PATCH] Update doc: how to development a new environment (#631) * update scenario description * add new environment develop * development * make better execution queue * add doc * fix a potential bug * automatically generate colab links * doc * move top down renderer to engine * finish a part * fix bug * add * allow reset to return info * Done * format * step return * wrap info * add map section * fix bug --- .gitignore | 2 + documentation/README.md | 6 +- documentation/source/action.ipynb | 5 +- documentation/source/before_reading.ipynb | 3 + documentation/source/conf.py | 36 ++ documentation/source/config_system.ipynb | 3 + documentation/source/debug_mode.ipynb | 3 + documentation/source/development.rst | 12 - documentation/source/figs/execution_queue.png | Bin 70968 -> 135739 bytes documentation/source/index.rst | 3 +- documentation/source/log_msg.ipynb | 3 + documentation/source/map.ipynb | 42 +++ documentation/source/navigation.ipynb | 6 +- documentation/source/new_env.ipynb | 328 ++++++++++++++++++ documentation/source/obs.ipynb | 3 + documentation/source/panda_render.ipynb | 6 +- documentation/source/points_and_lines.ipynb | 5 +- documentation/source/record_replay.ipynb | 6 +- documentation/source/reward_cost_done.ipynb | 3 + documentation/source/rl_environments.ipynb | 5 +- .../source/scenario_description.ipynb | 42 +-- documentation/source/sensors.ipynb | 3 + documentation/source/system_design.ipynb | 63 +++- documentation/source/top_down_render.ipynb | 23 +- documentation/source/training.ipynb | 3 + documentation/source/vehicle.ipynb | 6 +- metadrive/component/map/pg_map.py | 15 +- metadrive/engine/base_engine.py | 16 +- .../{obs => engine}/top_down_renderer.py | 6 +- metadrive/envs/base_env.py | 32 +- .../envs/legacy_envs/mix_waymo_pg_env.py | 4 +- metadrive/envs/marl_envs/marl_intersection.py | 2 +- metadrive/envs/marl_envs/tinyinter.py | 4 +- metadrive/envs/metadrive_env.py | 2 +- metadrive/scenario/parse_object_state.py | 9 + metadrive/tests/test_env/test_build_city.py | 2 +- metadrive/tests/test_env/test_waymo_env.py | 2 + metadrive/tests/vis_env/vis_nuscenes.py | 222 ++++++------ metadrive/utils/__init__.py | 181 +--------- metadrive/utils/doc_utils.py | 194 +++++++++++ metadrive/utils/draw_top_down_map.py | 2 +- metadrive/utils/vertex.py | 4 +- 42 files changed, 931 insertions(+), 386 deletions(-) delete mode 100644 documentation/source/development.rst create mode 100644 documentation/source/map.ipynb create mode 100644 documentation/source/new_env.ipynb rename metadrive/{obs => engine}/top_down_renderer.py (99%) create mode 100644 metadrive/utils/doc_utils.py diff --git a/.gitignore b/.gitignore index 740fcdf4f..765ba3bfc 100644 --- a/.gitignore +++ b/.gitignore @@ -51,3 +51,5 @@ **/**.mp4 /documentation/jupyter_execute/ /documentation/**/**.gif +/documentation/source/img.png +/documentation/source/demo.png diff --git a/documentation/README.md b/documentation/README.md index 87bedad75..38e4332fa 100644 --- a/documentation/README.md +++ b/documentation/README.md @@ -79,4 +79,8 @@ And you need to skip all cells you don't want to run with cell tags: ```python {"tags": ["skip-execution"]} -``` \ No newline at end of file +``` + +### Preprocess-Add colab link +Everytime the `make html` is called, all `ipynb` file will have corresponding colab link in it by modifying the source +code. So you will find that your source code is modified in git. Please commit that changes as well. diff --git a/documentation/source/action.ipynb b/documentation/source/action.ipynb index ca1374549..5383d2e28 100644 --- a/documentation/source/action.ipynb +++ b/documentation/source/action.ipynb @@ -6,6 +6,9 @@ "metadata": {}, "source": [ "# Action and Policy\n", + "\n", + "[![Click and Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/metadriverse/metadrive/blob/main/documentation/source/action.ipynb)\n", + "\n", "This section will discuss how to control the vehicle in MetaDrive with the *Policy* interface. Before this, let's have a look at the raw control signal required by vehicles.\n", "\n", "## Action\n", @@ -786,7 +789,7 @@ "metadata": {}, "source": [ "### ReplayPolicy\n", - "Usually, we use [ScenarioNet](https://metadriverse.github.io/scenarionet/) to convert scenarios collected by Waymo, nuScenes, nuPlan, and Argoverse to internal [Scenario Description](description.ipynb) and rebuild the scenarios in MetaDrive. Thus this policy is used to load and replay the recorded traffic trajectories for these real-world scenarios. There are two replay policies for replaying the trajectories of ego car and traffic participants, respectively:\n", + "Usually, we use [ScenarioNet](https://metadriverse.github.io/scenarionet/) to convert scenarios collected by Waymo, nuScenes, nuPlan, and Argoverse to internal [Scenario Description](scenario_description.ipynb) and rebuild the scenarios in MetaDrive. Thus this policy is used to load and replay the recorded traffic trajectories for these real-world scenarios. There are two replay policies for replaying the trajectories of ego car and traffic participants, respectively:\n", "* **ReplayEgoCarPolicy**\n", "* **ReplayTrafficParticipantPolicy**\n", "\n", diff --git a/documentation/source/before_reading.ipynb b/documentation/source/before_reading.ipynb index 9a1c44d75..c4750627a 100644 --- a/documentation/source/before_reading.ipynb +++ b/documentation/source/before_reading.ipynb @@ -6,6 +6,9 @@ "metadata": {}, "source": [ "# Before reading the Doc\n", + "\n", + "[![Click and Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/metadriverse/metadrive/blob/main/documentation/source/before_reading.ipynb)\n", + "\n", "Most of the document is made with `jupyter notebook`. Therefore, you can clone the [repo](https://github.com/metadriverse/metadrive) and run the demo code listed in `metadrive/documentation/source/*.ipynb` on your local machine. These examples are supposed to work with the latest main branch. Note: videos can not be played in notebook as it doesn't support `