Skip to content

Commit

Permalink
sync ipynb to this repo
Browse files Browse the repository at this point in the history
  • Loading branch information
QuanyiLi committed Jun 8, 2024
1 parent a0247a8 commit 797f833
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions documentation/source/obs.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
"cell_type": "markdown",
"id": "72c167e8",
"metadata": {
"editable": true,
"slideshow": {
"slide_type": ""
},
Expand Down Expand Up @@ -415,7 +414,6 @@
"execution_count": 4,
"id": "ff7a70aa",
"metadata": {
"editable": true,
"slideshow": {
"slide_type": ""
},
Expand Down Expand Up @@ -544,7 +542,6 @@
"execution_count": 45,
"id": "3562290f",
"metadata": {
"editable": true,
"slideshow": {
"slide_type": ""
},
Expand Down Expand Up @@ -592,7 +589,6 @@
"execution_count": 12,
"id": "995d5314-92a7-4e68-8bb8-05f1bd8ab718",
"metadata": {
"editable": true,
"slideshow": {
"slide_type": ""
},
Expand All @@ -619,7 +615,6 @@
"execution_count": 13,
"id": "7f20c293-77f9-451c-a552-882def3d6257",
"metadata": {
"editable": true,
"slideshow": {
"slide_type": ""
},
Expand Down Expand Up @@ -712,7 +707,6 @@
"execution_count": 10,
"id": "9ea9966f-f123-40e8-a432-1ac19f396431",
"metadata": {
"editable": true,
"slideshow": {
"slide_type": ""
},
Expand Down Expand Up @@ -806,13 +800,16 @@
"from metadrive.envs.metadrive_env import MetaDriveEnv\n",
"from metadrive.obs.state_obs import LidarStateObservation\n",
"from metadrive.component.sensors.rgb_camera import RGBCamera\n",
"import os\n",
"test_doc = os.getenv('TEST_DOC')\n",
"sensor_size = (84, 60) if test_doc else (200, 100)\n",
"\n",
"env = MetaDriveEnv(config=dict(\n",
" use_render=False,\n",
" agent_observation=LidarStateObservation,\n",
" image_observation=True,\n",
" norm_pixel=False,\n",
" sensors=dict(rgb_camera=(RGBCamera, 512, 256)),\n",
" sensors=dict(rgb_camera=(RGBCamera, *sensor_size)),\n",
"))\n",
"\n",
"obs, info = env.reset()\n",
Expand All @@ -822,9 +819,10 @@
"image = env.engine.get_sensor(\"rgb_camera\").perceive(to_float=False)\n",
"image = image[..., [2, 1, 0]]\n",
"\n",
"import matplotlib.pyplot as plt\n",
"plt.imshow(image)\n",
"plt.show()"
"if not test_doc:\n",
" import matplotlib.pyplot as plt\n",
" plt.imshow(image)\n",
" plt.show()"
]
}
],
Expand All @@ -844,7 +842,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.13"
"version": "3.7.13"
},
"mystnb": {
"execution_mode": "force"
Expand Down

0 comments on commit 797f833

Please sign in to comment.