From 797f8331591584814de9ecea34711f348980492c Mon Sep 17 00:00:00 2001 From: QuanyiLi Date: Sat, 8 Jun 2024 10:34:51 +0100 Subject: [PATCH] sync ipynb to this repo --- documentation/source/obs.ipynb | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/documentation/source/obs.ipynb b/documentation/source/obs.ipynb index 26ba4f276..d4792c4cd 100644 --- a/documentation/source/obs.ipynb +++ b/documentation/source/obs.ipynb @@ -4,7 +4,6 @@ "cell_type": "markdown", "id": "72c167e8", "metadata": { - "editable": true, "slideshow": { "slide_type": "" }, @@ -415,7 +414,6 @@ "execution_count": 4, "id": "ff7a70aa", "metadata": { - "editable": true, "slideshow": { "slide_type": "" }, @@ -544,7 +542,6 @@ "execution_count": 45, "id": "3562290f", "metadata": { - "editable": true, "slideshow": { "slide_type": "" }, @@ -592,7 +589,6 @@ "execution_count": 12, "id": "995d5314-92a7-4e68-8bb8-05f1bd8ab718", "metadata": { - "editable": true, "slideshow": { "slide_type": "" }, @@ -619,7 +615,6 @@ "execution_count": 13, "id": "7f20c293-77f9-451c-a552-882def3d6257", "metadata": { - "editable": true, "slideshow": { "slide_type": "" }, @@ -712,7 +707,6 @@ "execution_count": 10, "id": "9ea9966f-f123-40e8-a432-1ac19f396431", "metadata": { - "editable": true, "slideshow": { "slide_type": "" }, @@ -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", @@ -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()" ] } ], @@ -844,7 +842,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.10.13" + "version": "3.7.13" }, "mystnb": { "execution_mode": "force"