{ "cells": [ { "cell_type": "markdown", "id": "1bc67b98", "metadata": {}, "source": [ "# Configuration\n", "\n", "[![Click and Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/metadriverse/metaurban/blob/main/documentation/source/config_system.ipynb)\n", "\n", "\n", "A MetaUrban instance accepts a dict as the environmental config.\n", "\n", "In this page, we describe the details of the config system and configurable options for all environments." ] }, { "cell_type": "markdown", "id": "9f006d2e", "metadata": {}, "source": [ "## Config system\n", "This section discusses how to configure the an environment in MetaUrban and some features of the config system.\n", "\n", "### Overwriting\n", "Every environment has a default config, which records the parameters required to launch the environment. It is content is actually a nested dictionary whose keys and values represent the parameter names and corresponding values. \n", "This default config dict can be accessed via the class method:\n", "```python\n", "from metaurban.envs import SidewalkStaticMetaUrbanEnv \n", "default_config = SidewalkStaticMetaUrbanEnv.default_config()\n", "```\n", "\n", "When creating environments, the external config `config` will overwritten default values of certain fields in the `default_config`. The following code exemplifies this. " ] }, { "cell_type": "code", "execution_count": 1, "id": "355c4e18", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "default_config['num_scenarios']: 1\n", "env_config['num_scenarios']: 100\n" ] } ], "source": [ "from metaurban.envs import SidewalkStaticMetaUrbanEnv \n", "default_config = SidewalkStaticMetaUrbanEnv.default_config()\n", "env = SidewalkStaticMetaUrbanEnv(dict(num_scenarios=100, object_density=0.1, log_level=50))\n", "env_config = env.config\n", "print(\"default_config['num_scenarios']:\", default_config[\"num_scenarios\"])\n", "print(\"env_config['num_scenarios']:\", env_config[\"num_scenarios\"])" ] }, { "cell_type": "markdown", "id": "e87826b1", "metadata": {}, "source": [ "### Sanity Check\n", "There is a check mechanism which prohibit users to set the value for a key that doesn't exist in the `default_config`. This is helpful to make sure that users type the correct parameter name and successfully config the target parameter. " ] }, { "cell_type": "code", "execution_count": 2, "id": "0f825c89", "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "\u001b[38;20m[INFO] Environment: SidewalkStaticMetaUrbanEnv\u001b[0m\n", "\u001b[38;20m[INFO] MetaUrban version: 0.0.1\u001b[0m\n", "\u001b[38;20m[INFO] Sensors: [lidar: Lidar(), side_detector: SideDetector(), lane_line_detector: LaneLineDetector()]\u001b[0m\n", "\u001b[38;20m[INFO] Render Mode: none\u001b[0m\n", "\u001b[38;20m[INFO] Horizon (Max steps per agent): None\u001b[0m\n" ] } ], "source": [ "try:\n", " env = SidewalkStaticMetaUrbanEnv(dict(non_exist_key=False))\n", "except KeyError as error:\n", " print(str(error)[:62] + \" ...\")" ] }, { "cell_type": "markdown", "id": "e9d82697", "metadata": {}, "source": [ "The check mechanism will further ensure if the type of the parameter is correct. For example, the `num_scenarios` should be an `int` type, and thus a `list` type parameter will raise an error. " ] }, { "cell_type": "code", "execution_count": 3, "id": "e5a35eb4", "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "\u001b[38;20m[INFO] Environment: SidewalkStaticMetaUrbanEnv\u001b[0m\n", "\u001b[38;20m[INFO] MetaUrban version: 0.0.1\u001b[0m\n", "\u001b[38;20m[INFO] Sensors: [lidar: Lidar(), side_detector: SideDetector(), lane_line_detector: LaneLineDetector()]\u001b[0m\n", "\u001b[38;20m[INFO] Render Mode: none\u001b[0m\n", "\u001b[38;20m[INFO] Horizon (Max steps per agent): None\u001b[0m\n" ] } ], "source": [ "try:\n", " env = SidewalkStaticMetaUrbanEnv(dict(num_scenarios=[0, 1]))\n", "except AssertionError as error:\n", " print(str(error)[:62] + \" ...\")" ] }, { "cell_type": "markdown", "id": "ebf36961", "metadata": {}, "source": [ "### Basic Config Sharing\n", "The default configs are different across all environments, but may share some identical fields. Take the `MetaDriveEnv` and `ScenarioEnv` as example." ] }, { "cell_type": "code", "execution_count": 4, "id": "74d81755", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Number of parameters of SidewalkStaticMetaUrbanEnv: 123\n", "Number of parameters of SidewalkDynamicMetaUrbanEnv: 120\n", "\n", "The config between MetaDriveEnv and ScenarioEnv is different.\n", "\n", "Number of identical parameters: 120\n", "Number of unique parameters in SidewalkStaticMetaUrbanEnv: 3\n", "Number of unique parameters in SidewalkDynamicMetaUrbanEnv: 0\n" ] } ], "source": [ "from metaurban.envs import SidewalkStaticMetaUrbanEnv, SidewalkDynamicMetaUrbanEnv\n", "static_config = set(SidewalkStaticMetaUrbanEnv.default_config().keys())\n", "dynamic_config = set(SidewalkDynamicMetaUrbanEnv.default_config().keys())\n", "print(\"Number of parameters of SidewalkStaticMetaUrbanEnv: {}\".format(len(static_config)))\n", "print(\"Number of parameters of SidewalkDynamicMetaUrbanEnv: {}\\n\".format(len(dynamic_config)))\n", "\n", "try:\n", " assert static_config == dynamic_config\n", "except AssertionError as error:\n", " print(\"The config between MetaDriveEnv and ScenarioEnv is different.\\n\")\n", " \n", "identical_parameters = dynamic_config.intersection(static_config)\n", "print(\"Number of identical parameters: \\\n", " {}\".format(len(identical_parameters)))\n", "print(\"Number of unique parameters in SidewalkStaticMetaUrbanEnv: \\\n", " {}\".format(len(static_config-identical_parameters)))\n", "print(\"Number of unique parameters in SidewalkDynamicMetaUrbanEnv: \\\n", " {}\".format(len(dynamic_config-identical_parameters)))" ] }, { "cell_type": "markdown", "id": "856d2938", "metadata": {}, "source": [ "It is worth mentioning the parameter sharing mechanism, which is helpful when we create a new environment, so we don't need to copy some common configs to the `default_config` to the new environments again and again. Let's first check out how the `default_config()` function is implemented." ] }, { "cell_type": "code", "execution_count": 5, "id": "890a6f47", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\u001b[35m@classmethod\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", "\u001b[34mdef\u001b[39;49;00m\u001b[37m \u001b[39;49;00m\u001b[35mdefault_config\u001b[39;49;00m\u001b[35m(\u001b[39;49;00m\u001b[35mcls\u001b[39;49;00m\u001b[35m)\u001b[39;49;00m -> \u001b[30mConfig\u001b[39;49;00m\u001b[35m:\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[30mconfig\u001b[39;49;00m = \u001b[35msuper\u001b[39;49;00m\u001b[35m(\u001b[39;49;00m\u001b[30mSidewalkDynamicMetaUrbanEnv\u001b[39;49;00m\u001b[35m,\u001b[39;49;00m \u001b[35mcls\u001b[39;49;00m\u001b[35m)\u001b[39;49;00m.\u001b[30mdefault_config\u001b[39;49;00m\u001b[35m(\u001b[39;49;00m\u001b[35m)\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[30mconfig\u001b[39;49;00m.\u001b[30mupdate\u001b[39;49;00m\u001b[35m(\u001b[39;49;00m\u001b[30mMETAURBAN_DEFAULT_CONFIG\u001b[39;49;00m\u001b[35m)\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[30mconfig\u001b[39;49;00m.\u001b[30mregister_type\u001b[39;49;00m\u001b[35m(\u001b[39;49;00m\u001b[33m\"\u001b[39;49;00m\u001b[33mmap\u001b[39;49;00m\u001b[33m\"\u001b[39;49;00m\u001b[35m,\u001b[39;49;00m \u001b[35mstr\u001b[39;49;00m\u001b[35m,\u001b[39;49;00m \u001b[35mint\u001b[39;49;00m\u001b[35m)\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[30mconfig\u001b[39;49;00m\u001b[35m[\u001b[39;49;00m\u001b[33m\"\u001b[39;49;00m\u001b[33mmap_config\u001b[39;49;00m\u001b[33m\"\u001b[39;49;00m\u001b[35m]\u001b[39;49;00m.\u001b[30mregister_type\u001b[39;49;00m\u001b[35m(\u001b[39;49;00m\u001b[33m\"\u001b[39;49;00m\u001b[33mconfig\u001b[39;49;00m\u001b[33m\"\u001b[39;49;00m\u001b[35m,\u001b[39;49;00m \u001b[34mNone\u001b[39;49;00m\u001b[35m)\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[34mreturn\u001b[39;49;00m \u001b[30mconfig\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", "\n" ] } ], "source": [ "from metadrive.utils import print_source\n", "print_source(SidewalkDynamicMetaUrbanEnv.default_config)" ] }, { "cell_type": "markdown", "id": "02bbb322", "metadata": {}, "source": [ "It is quite simple and is implemented by overwriting the `super(SidewalkDynamicMetaUrbanEnv, cls).default_config()`. If we check the contents of the two config dict, we will find that the `BaseEnv.default_config() = super(SidewalkDynamicMetaUrbanEnv, cls).default_config()` is the subset of `SidewalkDynamicMetaUrbanEnv.default_config()` and provides the `SidewalkDynamicMetaUrbanEnv` with the basic configs." ] }, { "cell_type": "code", "execution_count": 6, "id": "0bf08048", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "True" ] }, "execution_count": 6, "metadata": {}, "output_type": "execute_result" } ], "source": [ "from metaurban.envs.base_env import BaseEnv\n", "set(BaseEnv.default_config()).issubset(set(SidewalkDynamicMetaUrbanEnv.default_config()))" ] }, { "cell_type": "markdown", "id": "ee5790d8", "metadata": {}, "source": [ "It is the same for the SidewalkStaticMetaUrbanEnv as well, whose default config is:" ] }, { "cell_type": "code", "execution_count": 7, "id": "162c423a", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\u001b[35m@classmethod\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", "\u001b[34mdef\u001b[39;49;00m\u001b[37m \u001b[39;49;00m\u001b[35mdefault_config\u001b[39;49;00m\u001b[35m(\u001b[39;49;00m\u001b[35mcls\u001b[39;49;00m\u001b[35m)\u001b[39;49;00m -> \u001b[30mConfig\u001b[39;49;00m\u001b[35m:\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[30mconfig\u001b[39;49;00m = \u001b[35msuper\u001b[39;49;00m\u001b[35m(\u001b[39;49;00m\u001b[30mSidewalkStaticMetaUrbanEnv\u001b[39;49;00m\u001b[35m,\u001b[39;49;00m \u001b[35mcls\u001b[39;49;00m\u001b[35m)\u001b[39;49;00m.\u001b[30mdefault_config\u001b[39;49;00m\u001b[35m(\u001b[39;49;00m\u001b[35m)\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[30mconfig\u001b[39;49;00m.\u001b[30mupdate\u001b[39;49;00m\u001b[35m(\u001b[39;49;00m\u001b[30mmetaurban_DEFAULT_CONFIG\u001b[39;49;00m\u001b[35m)\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[30mconfig\u001b[39;49;00m.\u001b[30mregister_type\u001b[39;49;00m\u001b[35m(\u001b[39;49;00m\u001b[33m\"\u001b[39;49;00m\u001b[33mmap\u001b[39;49;00m\u001b[33m\"\u001b[39;49;00m\u001b[35m,\u001b[39;49;00m \u001b[35mstr\u001b[39;49;00m\u001b[35m,\u001b[39;49;00m \u001b[35mint\u001b[39;49;00m\u001b[35m)\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[30mconfig\u001b[39;49;00m\u001b[35m[\u001b[39;49;00m\u001b[33m\"\u001b[39;49;00m\u001b[33mmap_config\u001b[39;49;00m\u001b[33m\"\u001b[39;49;00m\u001b[35m]\u001b[39;49;00m.\u001b[30mregister_type\u001b[39;49;00m\u001b[35m(\u001b[39;49;00m\u001b[33m\"\u001b[39;49;00m\u001b[33mconfig\u001b[39;49;00m\u001b[33m\"\u001b[39;49;00m\u001b[35m,\u001b[39;49;00m \u001b[34mNone\u001b[39;49;00m\u001b[35m)\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[34mreturn\u001b[39;49;00m \u001b[30mconfig\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", "\n" ] } ], "source": [ "print_source(SidewalkStaticMetaUrbanEnv.default_config)" ] }, { "cell_type": "markdown", "id": "d26cedbd", "metadata": {}, "source": [ "As there is an overwriting function is called, it is ok to overwrite the values of parameters in `BaseEnv.default_config()` when making the `default_config` for a inherited environment." ] }, { "cell_type": "markdown", "id": "5dab9545-cc22-4634-addf-6553e78abd06", "metadata": {}, "source": [ "### Programming with Configs\n", "\n", "The configs can be accessed everywhere in the program just like the simulation engine instance, so we can use these parameters to adjust the behavior of the simulation." ] }, { "cell_type": "markdown", "id": "e43d0c22", "metadata": {}, "source": [ "## Basic Configs\n", "\n", "As all environments are subclass of `BaseEnv` and share the parameters of `BaseEnv`, we first discuss the parameters in `BaseEnv.default_config()`. \n", "The available items with annotations are listed as follows.\n", "You can check this in the source code as well." ] }, { "cell_type": "code", "execution_count": 9, "id": "c5100f12", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\u001b[31mBASE_DEFAULT_CONFIG\u001b[39;49;00m = \u001b[35mdict\u001b[39;49;00m\u001b[35m(\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", "\u001b[37m\u001b[39;49;00m\n", " \u001b[30m# ===== agent =====\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[30m# Whether randomize the car model for the agent, randomly choosing from 4 types of cars\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[31mrandom_agent_model\u001b[39;49;00m=\u001b[34mFalse\u001b[39;49;00m\u001b[35m,\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[30m# The ego config is: env_config[\"vehicle_config\"].update(env_config\"[agent_configs\"][\"default_agent\"])\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[31magent_configs\u001b[39;49;00m=\u001b[35m{\u001b[39;49;00m\u001b[31mDEFAULT_AGENT\u001b[39;49;00m\u001b[35m:\u001b[39;49;00m \u001b[35mdict\u001b[39;49;00m\u001b[35m(\u001b[39;49;00m\u001b[31muse_special_color\u001b[39;49;00m=\u001b[34mTrue\u001b[39;49;00m\u001b[35m,\u001b[39;49;00m \u001b[31mspawn_lane_index\u001b[39;49;00m=\u001b[34mNone\u001b[39;49;00m\u001b[35m)\u001b[39;49;00m\u001b[35m}\u001b[39;49;00m\u001b[35m,\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", "\u001b[37m\u001b[39;49;00m\n", " \u001b[30m# ===== multi-agent =====\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[30m# This should be >1 in MARL envs, or set to -1 for spawning as many vehicles as possible.\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[31mnum_agents\u001b[39;49;00m=\u001b[34m1\u001b[39;49;00m\u001b[35m,\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[30m# Turn on this to notify the simulator that it is MARL env\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[31mis_multi_agent\u001b[39;49;00m=\u001b[34mFalse\u001b[39;49;00m\u001b[35m,\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[30m# The number of agent will be fixed adn determined at the start of the episode, if set to False\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[31mallow_respawn\u001b[39;49;00m=\u001b[34mFalse\u001b[39;49;00m\u001b[35m,\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[30m# How many substeps for the agent to stay static at the death place after done. (Default for MARL: 25)\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[31mdelay_done\u001b[39;49;00m=\u001b[34m0\u001b[39;49;00m\u001b[35m,\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", "\u001b[37m\u001b[39;49;00m\n", " \u001b[30m# ===== Action/Control =====\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[30m# Please see Documentation: Action and Policy for more details\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[30m# What policy to use for controlling agents\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[31magent_policy\u001b[39;49;00m=\u001b[31mEnvInputPolicy\u001b[39;49;00m\u001b[35m,\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[30m# If set to True, agent_policy will be overriden and change to ManualControlPolicy\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[31mmanual_control\u001b[39;49;00m=\u001b[34mFalse\u001b[39;49;00m\u001b[35m,\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[30m# What interfaces to use for manual control, options: \"steering_wheel\" or \"keyboard\" or \"xbos\"\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[31mcontroller\u001b[39;49;00m=\u001b[33m\"\u001b[39;49;00m\u001b[33mkeyboard\u001b[39;49;00m\u001b[33m\"\u001b[39;49;00m\u001b[35m,\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[30m# Used with EnvInputPolicy. If set to True, the env.action_space will be discrete\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[31mdiscrete_action\u001b[39;49;00m=\u001b[34mFalse\u001b[39;49;00m\u001b[35m,\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[30m# If True, use MultiDiscrete action space. Otherwise, use Discrete.\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[31muse_multi_discrete\u001b[39;49;00m=\u001b[34mFalse\u001b[39;49;00m\u001b[35m,\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[30m# How many discrete actions are used for steering dim\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[31mdiscrete_steering_dim\u001b[39;49;00m=\u001b[34m5\u001b[39;49;00m\u001b[35m,\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[30m# How many discrete actions are used for throttle/brake dim\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[31mdiscrete_throttle_dim\u001b[39;49;00m=\u001b[34m5\u001b[39;49;00m\u001b[35m,\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[30m# Check if the action is contained in gym.space. Usually turned off to speed up simulation\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[31maction_check\u001b[39;49;00m=\u001b[34mFalse\u001b[39;49;00m\u001b[35m,\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", "\u001b[37m\u001b[39;49;00m\n", " \u001b[30m# ===== Observation =====\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[30m# Please see Documentation: Observation for more details\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[30m# Whether to normalize the pixel value from 0-255 to 0-1\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[31mnorm_pixel\u001b[39;49;00m=\u001b[34mTrue\u001b[39;49;00m\u001b[35m,\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[30m# The number of timesteps for stacking image observation\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[31mstack_size\u001b[39;49;00m=\u001b[34m3\u001b[39;49;00m\u001b[35m,\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[30m# Whether to use image observation or lidar. It takes effect in get_single_observation\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[31mimage_observation\u001b[39;49;00m=\u001b[34mFalse\u001b[39;49;00m\u001b[35m,\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[30m# Like agent_policy, users can use customized observation class through this field\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[31magent_observation\u001b[39;49;00m=\u001b[34mNone\u001b[39;49;00m\u001b[35m,\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", "\u001b[37m\u001b[39;49;00m\n", " \u001b[30m# ===== Termination =====\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[30m# The maximum length of each agent episode. Set to None to remove this constraint\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[31mhorizon\u001b[39;49;00m=\u001b[34mNone\u001b[39;49;00m\u001b[35m,\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[30m# If set to True, the terminated will be True as well when the length of agent episode exceeds horizon\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[31mtruncate_as_terminate\u001b[39;49;00m=\u001b[34mFalse\u001b[39;49;00m\u001b[35m,\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", "\u001b[37m\u001b[39;49;00m\n", " \u001b[30m# ===== Main Camera =====\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[30m# A True value makes the camera follow the reference line instead of the vehicle, making its movement smooth\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[31muse_chase_camera_follow_lane\u001b[39;49;00m=\u001b[34mFalse\u001b[39;49;00m\u001b[35m,\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[30m# Height of the main camera\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[31mcamera_height\u001b[39;49;00m=\u001b[32m2.2\u001b[39;49;00m\u001b[35m,\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[30m# Distance between the camera and the vehicle. It is the distance projecting to the x-y plane.\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[31mcamera_dist\u001b[39;49;00m=\u001b[32m7.5\u001b[39;49;00m\u001b[35m,\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[30m# Pitch of main camera. If None, this will be automatically calculated\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[31mcamera_pitch\u001b[39;49;00m=\u001b[34mNone\u001b[39;49;00m\u001b[35m,\u001b[39;49;00m \u001b[30m# degree\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[30m# Smooth the camera movement\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[31mcamera_smooth\u001b[39;49;00m=\u001b[34mTrue\u001b[39;49;00m\u001b[35m,\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[30m# How many frames used to smooth the camera\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[31mcamera_smooth_buffer_size\u001b[39;49;00m=\u001b[34m20\u001b[39;49;00m\u001b[35m,\u001b[39;49;00m \u001b[30m# HACK: Default 20\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[30m# FOV of main camera\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[31mcamera_fov\u001b[39;49;00m=\u001b[34m65\u001b[39;49;00m\u001b[35m,\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[30m# Only available in MARL setting, choosing which agent to track. Values should be \"agent0\", \"agent1\" or so on\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[31mprefer_track_agent\u001b[39;49;00m=\u001b[34mNone\u001b[39;49;00m\u001b[35m,\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[30m# Setting the camera position for the Top-down Camera for 3D viewer (pressing key \"B\" to activate it)\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[31mtop_down_camera_initial_x\u001b[39;49;00m=\u001b[34m0\u001b[39;49;00m\u001b[35m,\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[31mtop_down_camera_initial_y\u001b[39;49;00m=\u001b[34m0\u001b[39;49;00m\u001b[35m,\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[31mtop_down_camera_initial_z\u001b[39;49;00m=\u001b[34m200\u001b[39;49;00m\u001b[35m,\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", "\u001b[37m\u001b[39;49;00m\n", " \u001b[30m# ===== Vehicle =====\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[31mvehicle_config\u001b[39;49;00m=\u001b[35mdict\u001b[39;49;00m\u001b[35m(\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[30m# Vehicle model. Candidates: \"s\", \"m\", \"l\", \"xl\", \"default\". random_agent_model makes this config invalid\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[31mvehicle_model\u001b[39;49;00m=\u001b[33m\"\u001b[39;49;00m\u001b[33mdefault\u001b[39;49;00m\u001b[33m\"\u001b[39;49;00m\u001b[35m,\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[30m# If set to True, the vehicle can go backwards with throttle/brake < -1\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[31menable_reverse\u001b[39;49;00m=\u001b[34mFalse\u001b[39;49;00m\u001b[35m,\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[30m# Whether to show the box as navigation points\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[31mshow_navi_mark\u001b[39;49;00m=\u001b[34mTrue\u001b[39;49;00m\u001b[35m,\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[30m# Whether to show a box mark at the destination\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[31mshow_dest_mark\u001b[39;49;00m=\u001b[34mFalse\u001b[39;49;00m\u001b[35m,\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[30m# Whether to draw a line from current vehicle position to the designation point\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[31mshow_line_to_dest\u001b[39;49;00m=\u001b[34mFalse\u001b[39;49;00m\u001b[35m,\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[30m# Whether to draw a line from current vehicle position to the next navigation point\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[31mshow_line_to_navi_mark\u001b[39;49;00m=\u001b[34mFalse\u001b[39;49;00m\u001b[35m,\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[30m# If set to True, the vehicle will be in color green in top-down renderer or MARL setting\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[31muse_special_color\u001b[39;49;00m=\u001b[34mFalse\u001b[39;49;00m\u001b[35m,\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[30m# Clear wheel friction, so it can not move by setting steering and throttle/brake. Used for ReplayPolicy\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[31mno_wheel_friction\u001b[39;49;00m=\u001b[34mFalse\u001b[39;49;00m\u001b[35m,\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", "\u001b[37m\u001b[39;49;00m\n", " \u001b[30m# ===== image capturing =====\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[30m# Which camera to use for image observation. It should be a sensor registered in sensor config.\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[31mimage_source\u001b[39;49;00m=\u001b[33m\"\u001b[39;49;00m\u001b[33mrgb_camera\u001b[39;49;00m\u001b[33m\"\u001b[39;49;00m\u001b[35m,\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", "\u001b[37m\u001b[39;49;00m\n", " \u001b[30m# ===== vehicle spawn and navigation =====\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[30m# A BaseNavigation instance. It should match the road network type.\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[31mnavigation_module\u001b[39;49;00m=\u001b[34mNone\u001b[39;49;00m\u001b[35m,\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[30m# A lane id specifies which lane to spawn this vehicle\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[31mspawn_lane_index\u001b[39;49;00m=\u001b[34mNone\u001b[39;49;00m\u001b[35m,\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[30m# destination lane id. Required only when navigation module is not None.\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[31mdestination\u001b[39;49;00m=\u001b[34mNone\u001b[39;49;00m\u001b[35m,\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[30m# the longitudinal and lateral position on the spawn lane\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[31mspawn_longitude\u001b[39;49;00m=\u001b[32m5.0\u001b[39;49;00m\u001b[35m,\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[31mspawn_lateral\u001b[39;49;00m=\u001b[32m0.0\u001b[39;49;00m\u001b[35m,\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", "\u001b[37m\u001b[39;49;00m\n", " \u001b[30m# If the following items is assigned, the vehicle will be spawn at the specified position with certain speed\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[31mspawn_position_heading\u001b[39;49;00m=\u001b[34mNone\u001b[39;49;00m\u001b[35m,\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[31mspawn_velocity\u001b[39;49;00m=\u001b[34mNone\u001b[39;49;00m\u001b[35m,\u001b[39;49;00m \u001b[30m# m/s\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[31mspawn_velocity_car_frame\u001b[39;49;00m=\u001b[34mFalse\u001b[39;49;00m\u001b[35m,\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", "\u001b[37m\u001b[39;49;00m\n", " \u001b[30m# ==== others ====\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[30m# How many cars the vehicle has overtaken. It is deprecated due to bug.\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[31movertake_stat\u001b[39;49;00m=\u001b[34mFalse\u001b[39;49;00m\u001b[35m,\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[30m# If set to True, the default texture for the vehicle will be replaced with a pure color one.\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[31mrandom_color\u001b[39;49;00m=\u001b[34mFalse\u001b[39;49;00m\u001b[35m,\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[30m# The shape of vehicle are predefined by its class. But in special scenario (WaymoVehicle) we might want to\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[30m# set to arbitrary shape.\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[31mwidth\u001b[39;49;00m=\u001b[34mNone\u001b[39;49;00m\u001b[35m,\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[31mlength\u001b[39;49;00m=\u001b[34mNone\u001b[39;49;00m\u001b[35m,\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[31mheight\u001b[39;49;00m=\u001b[34mNone\u001b[39;49;00m\u001b[35m,\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[31mmass\u001b[39;49;00m=\u001b[34mNone\u001b[39;49;00m\u001b[35m,\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", "\u001b[37m\u001b[39;49;00m\n", " \u001b[30m# Set the vehicle size only for pygame top-down renderer. It doesn't affect the physical size!\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[31mtop_down_width\u001b[39;49;00m=\u001b[34mNone\u001b[39;49;00m\u001b[35m,\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[31mtop_down_length\u001b[39;49;00m=\u001b[34mNone\u001b[39;49;00m\u001b[35m,\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", "\u001b[37m\u001b[39;49;00m\n", " \u001b[30m# ===== vehicle module config =====\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[31mlidar\u001b[39;49;00m=\u001b[35mdict\u001b[39;49;00m\u001b[35m(\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[31mnum_lasers\u001b[39;49;00m=\u001b[34m240\u001b[39;49;00m\u001b[35m,\u001b[39;49;00m \u001b[31mdistance\u001b[39;49;00m=\u001b[34m50\u001b[39;49;00m\u001b[35m,\u001b[39;49;00m \u001b[31mnum_others\u001b[39;49;00m=\u001b[34m0\u001b[39;49;00m\u001b[35m,\u001b[39;49;00m \u001b[31mgaussian_noise\u001b[39;49;00m=\u001b[32m0.0\u001b[39;49;00m\u001b[35m,\u001b[39;49;00m \u001b[31mdropout_prob\u001b[39;49;00m=\u001b[32m0.0\u001b[39;49;00m\u001b[35m,\u001b[39;49;00m \u001b[31madd_others_navi\u001b[39;49;00m=\u001b[34mFalse\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[35m)\u001b[39;49;00m\u001b[35m,\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[31mside_detector\u001b[39;49;00m=\u001b[35mdict\u001b[39;49;00m\u001b[35m(\u001b[39;49;00m\u001b[31mnum_lasers\u001b[39;49;00m=\u001b[34m0\u001b[39;49;00m\u001b[35m,\u001b[39;49;00m \u001b[31mdistance\u001b[39;49;00m=\u001b[34m50\u001b[39;49;00m\u001b[35m,\u001b[39;49;00m \u001b[31mgaussian_noise\u001b[39;49;00m=\u001b[32m0.0\u001b[39;49;00m\u001b[35m,\u001b[39;49;00m \u001b[31mdropout_prob\u001b[39;49;00m=\u001b[32m0.0\u001b[39;49;00m\u001b[35m)\u001b[39;49;00m\u001b[35m,\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[31mlane_line_detector\u001b[39;49;00m=\u001b[35mdict\u001b[39;49;00m\u001b[35m(\u001b[39;49;00m\u001b[31mnum_lasers\u001b[39;49;00m=\u001b[34m0\u001b[39;49;00m\u001b[35m,\u001b[39;49;00m \u001b[31mdistance\u001b[39;49;00m=\u001b[34m20\u001b[39;49;00m\u001b[35m,\u001b[39;49;00m \u001b[31mgaussian_noise\u001b[39;49;00m=\u001b[32m0.0\u001b[39;49;00m\u001b[35m,\u001b[39;49;00m \u001b[31mdropout_prob\u001b[39;49;00m=\u001b[32m0.0\u001b[39;49;00m\u001b[35m)\u001b[39;49;00m\u001b[35m,\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[31mshow_lidar\u001b[39;49;00m=\u001b[34mFalse\u001b[39;49;00m\u001b[35m,\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[31mshow_side_detector\u001b[39;49;00m=\u001b[34mFalse\u001b[39;49;00m\u001b[35m,\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[31mshow_lane_line_detector\u001b[39;49;00m=\u001b[34mFalse\u001b[39;49;00m\u001b[35m,\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[30m# Whether to turn on vehicle light, only available when enabling render-pipeline\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[31mlight\u001b[39;49;00m=\u001b[34mFalse\u001b[39;49;00m\u001b[35m,\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[35m)\u001b[39;49;00m\u001b[35m,\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", "\u001b[37m\u001b[39;49;00m\n", " \u001b[30m# ===== Sensors =====\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[31msensors\u001b[39;49;00m=\u001b[35mdict\u001b[39;49;00m\u001b[35m(\u001b[39;49;00m\u001b[31mlidar\u001b[39;49;00m=\u001b[35m(\u001b[39;49;00m\u001b[31mLidar\u001b[39;49;00m\u001b[35m,\u001b[39;49;00m \u001b[35m)\u001b[39;49;00m\u001b[35m,\u001b[39;49;00m \u001b[31mside_detector\u001b[39;49;00m=\u001b[35m(\u001b[39;49;00m\u001b[31mSideDetector\u001b[39;49;00m\u001b[35m,\u001b[39;49;00m \u001b[35m)\u001b[39;49;00m\u001b[35m,\u001b[39;49;00m \u001b[31mlane_line_detector\u001b[39;49;00m=\u001b[35m(\u001b[39;49;00m\u001b[31mLaneLineDetector\u001b[39;49;00m\u001b[35m,\u001b[39;49;00m \u001b[35m)\u001b[39;49;00m\u001b[35m)\u001b[39;49;00m\u001b[35m,\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", "\u001b[37m\u001b[39;49;00m\n", " \u001b[30m# ===== Engine Core config =====\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[30m# If true pop a window to render\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[31muse_render\u001b[39;49;00m=\u001b[34mFalse\u001b[39;49;00m\u001b[35m,\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[30m# (width, height), if set to None, it will be automatically determined\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[31mwindow_size\u001b[39;49;00m=\u001b[35m(\u001b[39;49;00m\u001b[34m1200\u001b[39;49;00m\u001b[35m,\u001b[39;49;00m \u001b[34m900\u001b[39;49;00m\u001b[35m)\u001b[39;49;00m\u001b[35m,\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[30m# Physics world step is 0.02s and will be repeated for decision_repeat times per env.step()\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[31mphysics_world_step_size\u001b[39;49;00m=\u001b[32m2e-2\u001b[39;49;00m\u001b[35m,\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[31mdecision_repeat\u001b[39;49;00m=\u001b[34m5\u001b[39;49;00m\u001b[35m,\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[30m# This is an advanced feature for accessing image without moving them to ram!\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[31mimage_on_cuda\u001b[39;49;00m=\u001b[34mFalse\u001b[39;49;00m\u001b[35m,\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[30m# Don't set this config. We will determine the render mode automatically, it runs at physics-only mode by default.\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[31m_render_mode\u001b[39;49;00m=\u001b[31mRENDER_MODE_NONE\u001b[39;49;00m\u001b[35m,\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[30m# If set to None: the program will run as fast as possible. Otherwise, the fps will be limited under this value\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[31mforce_render_fps\u001b[39;49;00m=\u001b[34mNone\u001b[39;49;00m\u001b[35m,\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[30m# We will maintain a set of buffers in the engine to store the used objects and can reuse them when possible\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[30m# enhancing the efficiency. If set to True, all objects will be force destroyed when call clear()\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[31mforce_destroy\u001b[39;49;00m=\u001b[34mFalse\u001b[39;49;00m\u001b[35m,\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[30m# Number of buffering objects for each class.\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[31mnum_buffering_objects\u001b[39;49;00m=\u001b[34m200\u001b[39;49;00m\u001b[35m,\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[30m# Turn on it to use render pipeline, which provides advanced rendering effects (Beta)\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[31mrender_pipeline\u001b[39;49;00m=\u001b[34mFalse\u001b[39;49;00m\u001b[35m,\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[30m# daytime is only available when using render-pipeline\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[31mdaytime\u001b[39;49;00m=\u001b[33m\"\u001b[39;49;00m\u001b[33m19:00\u001b[39;49;00m\u001b[33m\"\u001b[39;49;00m\u001b[35m,\u001b[39;49;00m \u001b[30m# use string like \"13:40\", We usually set this by editor in toolkit\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[30m# Shadow range, unit: [m]\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[31mshadow_range\u001b[39;49;00m=\u001b[34m50\u001b[39;49;00m\u001b[35m,\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[30m# Whether to use multi-thread rendering\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[31mmulti_thread_render\u001b[39;49;00m=\u001b[34mTrue\u001b[39;49;00m\u001b[35m,\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[31mmulti_thread_render_mode\u001b[39;49;00m=\u001b[33m\"\u001b[39;49;00m\u001b[33mCull\u001b[39;49;00m\u001b[33m\"\u001b[39;49;00m\u001b[35m,\u001b[39;49;00m \u001b[30m# or \"Cull/Draw\"\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[30m# Model loading optimization. Preload pedestrian for avoiding lagging when creating it for the first time\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[31mpreload_models\u001b[39;49;00m=\u001b[34mTrue\u001b[39;49;00m\u001b[35m,\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[30m# model compression increasing the launch time\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[31mdisable_model_compression\u001b[39;49;00m=\u001b[34mTrue\u001b[39;49;00m\u001b[35m,\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", "\u001b[37m\u001b[39;49;00m\n", " \u001b[30m# ===== Terrain =====\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[30m# The size of the square map region, which is centered at [0, 0]. The map objects outside it are culled.\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[31mmap_region_size\u001b[39;49;00m=\u001b[34m1024\u001b[39;49;00m\u001b[35m,\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[30m# Whether to remove lanes outside the map region. If True, lane localization only applies to map region\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[31mcull_lanes_outside_map\u001b[39;49;00m=\u001b[34mFalse\u001b[39;49;00m\u001b[35m,\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[30m# Road will have a flat marin whose width is determined by this value, unit: [m]\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[31mdrivable_area_extension\u001b[39;49;00m=\u001b[34m7\u001b[39;49;00m\u001b[35m,\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[30m# Height scale for mountains, unit: [m]. 0 height makes the terrain flat\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[31mheight_scale\u001b[39;49;00m=\u001b[34m50\u001b[39;49;00m\u001b[35m,\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[30m# If using mesh collision, mountains will have physics body and thus interact with vehicles.\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[31muse_mesh_terrain\u001b[39;49;00m=\u001b[34mFalse\u001b[39;49;00m\u001b[35m,\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[30m# If set to False, only the center region of the terrain has the physics body\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[31mfull_size_mesh\u001b[39;49;00m=\u001b[34mTrue\u001b[39;49;00m\u001b[35m,\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[30m# Whether to show crosswalk\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[31mshow_crosswalk\u001b[39;49;00m=\u001b[34mTrue\u001b[39;49;00m\u001b[35m,\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[30m# Whether to show sidewalk\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[31mshow_sidewalk\u001b[39;49;00m=\u001b[34mTrue\u001b[39;49;00m\u001b[35m,\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", "\u001b[37m\u001b[39;49;00m\n", " \u001b[30m# ===== Debug =====\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[30m# Please see Documentation: Debug for more details\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[31mpstats\u001b[39;49;00m=\u001b[34mFalse\u001b[39;49;00m\u001b[35m,\u001b[39;49;00m \u001b[30m# turn on to profile the efficiency\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[31mdebug\u001b[39;49;00m=\u001b[34mFalse\u001b[39;49;00m\u001b[35m,\u001b[39;49;00m \u001b[30m# debug, output more messages\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[31mdebug_panda3d\u001b[39;49;00m=\u001b[34mFalse\u001b[39;49;00m\u001b[35m,\u001b[39;49;00m \u001b[30m# debug panda3d\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[31mdebug_physics_world\u001b[39;49;00m=\u001b[34mFalse\u001b[39;49;00m\u001b[35m,\u001b[39;49;00m \u001b[30m# only render physics world without model, a special debug option\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[31mdebug_static_world\u001b[39;49;00m=\u001b[34mFalse\u001b[39;49;00m\u001b[35m,\u001b[39;49;00m \u001b[30m# debug static world\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[31mlog_level\u001b[39;49;00m=\u001b[31mlogging\u001b[39;49;00m.\u001b[31mINFO\u001b[39;49;00m\u001b[35m,\u001b[39;49;00m \u001b[30m# log level. logging.DEBUG/logging.CRITICAL or so on\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[31mshow_coordinates\u001b[39;49;00m=\u001b[34mFalse\u001b[39;49;00m\u001b[35m,\u001b[39;49;00m \u001b[30m# show coordinates for maps and objects for debug\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", "\u001b[37m\u001b[39;49;00m\n", " \u001b[30m# ===== GUI =====\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[30m# Please see Documentation: GUI for more details\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[30m# Whether to show these elements in the 3D scene\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[31mshow_fps\u001b[39;49;00m=\u001b[34mTrue\u001b[39;49;00m\u001b[35m,\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[31mshow_logo\u001b[39;49;00m=\u001b[34mFalse\u001b[39;49;00m\u001b[35m,\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[31mshow_mouse\u001b[39;49;00m=\u001b[34mTrue\u001b[39;49;00m\u001b[35m,\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[31mshow_skybox\u001b[39;49;00m=\u001b[34mTrue\u001b[39;49;00m\u001b[35m,\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[31mshow_terrain\u001b[39;49;00m=\u001b[34mTrue\u001b[39;49;00m\u001b[35m,\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[31mshow_interface\u001b[39;49;00m=\u001b[34mTrue\u001b[39;49;00m\u001b[35m,\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[30m# Show marks for policies for debugging multi-policy setting\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[31mshow_policy_mark\u001b[39;49;00m=\u001b[34mFalse\u001b[39;49;00m\u001b[35m,\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[30m# Show an arrow marks for providing navigation information\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[31mshow_interface_navi_mark\u001b[39;49;00m=\u001b[34mTrue\u001b[39;49;00m\u001b[35m,\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[30m# A list showing sensor output on window. Its elements are chosen from sensors.keys() + \"dashboard\"\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[31minterface_panel\u001b[39;49;00m=\u001b[35m[\u001b[39;49;00m\u001b[33m\"\u001b[39;49;00m\u001b[33mdashboard\u001b[39;49;00m\u001b[33m\"\u001b[39;49;00m\u001b[35m]\u001b[39;49;00m\u001b[35m,\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", "\u001b[37m\u001b[39;49;00m\n", " \u001b[30m# ===== Record/Replay Metadata =====\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[30m# Please see Documentation: Record and Replay for more details\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[30m# When replay_episode is True, the episode metadata will be recorded\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[31mrecord_episode\u001b[39;49;00m=\u001b[34mFalse\u001b[39;49;00m\u001b[35m,\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[30m# The value should be None or the log data. If it is the later one, the simulator will replay logged scenario\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[31mreplay_episode\u001b[39;49;00m=\u001b[34mNone\u001b[39;49;00m\u001b[35m,\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[30m# When set to True, the replay system will only reconstruct the first frame from the logged scenario metadata\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[31monly_reset_when_replay\u001b[39;49;00m=\u001b[34mFalse\u001b[39;49;00m\u001b[35m,\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[30m# If True, when creating and replaying object trajectories, use the same ID as in dataset\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[31mforce_reuse_object_name\u001b[39;49;00m=\u001b[34mFalse\u001b[39;49;00m\u001b[35m,\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", "\u001b[37m\u001b[39;49;00m\n", " \u001b[30m# ===== randomization =====\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[31mnum_scenarios\u001b[39;49;00m=\u001b[34m1\u001b[39;49;00m\u001b[35m,\u001b[39;49;00m \u001b[30m# the number of scenarios in this environment\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", " \u001b[31msequential_seeding\u001b[39;49;00m=\u001b[34mFalse\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", "\u001b[35m)\u001b[39;49;00m\u001b[37m\u001b[39;49;00m\n", "\n" ] } ], "source": [ "import metaurban.envs.base_env as base_env\n", "from metaurban.utils import print_source, CONFIG\n", "module_source = print_source(base_env, [\"BASE_DEFAULT_CONFIG\", \")\\n\\n\"], colorscheme=CONFIG)" ] }, { "cell_type": "markdown", "id": "62f34482", "metadata": {}, "source": [ "## Environment Configs\n", "Please see [Environments](rl_environments.ipynb) for unique configs for each environment or check the source code of each environment. " ] } ], "metadata": { "kernelspec": { "display_name": "metaurban", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.10.16" }, "mystnb": { "execution_mode": "off" } }, "nbformat": 4, "nbformat_minor": 5 }