Environment Configuration

An PGDrive instance accepts a dict as the environmental config. For example, you can build a PGDrive instance with 200 generated maps via:

from pgdrive import PGDriveEnv
config = dict(
env = PGDriveEnv(config)

In this page, we describe the meaning of each configuration options.

PGDriveEnv Config

We do generalization experiments under the default setting of PGDriveEnv. To reproduce our experiment results, no special configuration is needed.

However, PGDrive can also support other research topics, and we will simply introduce the meaning of some configuration options of PGDriveEnv.

Draw Scene & Visualization

  • use_render (bool): Pop a window on your screen or not

  • offscreen_render (bool): When you want to access the image of camera, it should be set to True.

  • force_fps (Union[int, None]): Decide the render fps. “None” means that no fps limitation.

  • debug (bool): For developing use, draw the scene with bounding box

Manual Control

  • controller (str): “joystick” or “keyboard”. Controlling vehicle by joystick is more recommended.

  • manual_control (bool): Controllers above are available only when this flag is True

  • use_chase_camera (bool): A perspective like racing game. usually True, when manual control

  • camera_height (float): Chase camera height

TrafficManager Config

  • traffic_density (float): Vehicle number per 10 meter, aiming to adjust the number of vehicle on road

  • traffic_mode: Trigger mode (Triger) / reborn mode (Reborn). In Reborn mode vehicles will enter the map again after arriving its destination.

  • random_traffic (bool): the traffic generation will not be controlled by current map seed. If set to False, each map will have same traffic flow.

Map Config

  • map (int or string): You can set a string or int as the key to generate map in an easy way. An int=N means generating a map containing N blocks, and the block type is randomly selected. Since in PGDrive each block has a unique ID in char type, string can determine the block type sequence. For example, “SCrRX” means the first block is Straight, and the next blocks are Circular, InRamp, OutRamp and Intersection. We provide the following block types:

    Block Type


















  • map_config (dict): The original map config. Find more information in Map source code, or find usage in our test scripts.

    • type (str): The map can be generated by BIG according to BLOCK_NUM, BLOCK_SEQUENCE, or MAP_FILE

    • config (srt): A int telling BIG the total block number under BLOCK_NUM mode, or a str describing BLOCK_SEQUENCE (each block has a unique character severing as its ID, so combining them to get a map, the parameters of these block is sampled by BIG), and under MAP_FILE mode the config should be a dict describing the whole map.

    • lane_width (float): Width of lanes.

    • lane_num (int): Number of lanes in each road.

Generalization Environment Config

  • start_seed (int): Random seed of first map.

  • environment_num (int): Number of environments. BIG generates map by a random generator initialized by a specific seed. Therefore, “environment_num” maps are generated by seeds [seed for seed in range(start_seed, start_seed+environment_num)]

Observation Config

  • offscreen_render (bool): If you want to use camera data, please set this to True.

  • rgb_clip (bool): Squeeze the value between [0, 255] to [0.0, 1.0]

  • vehicle_config (dict): Sensor parameters for vehicle

  • image_source (str): decided which camera image to use (mini_map or front camera). Now we only support capture one image as a part of observation.

Action Config

  • decision_repeat (int): The minimal step size of the world is 2e-2 second, and thus for agent the world will step decision_repeat * 2e-2 second after applying one action or step.

Reward Scheme

Coefficient of different kinds of reward to describe the driving goal Find more information by accessing our source code in PGDriveEnv You can adjust our primitive reward function or design your own reward function


  • use_increment_steering (bool): Keyboard control use discretized action such as -1, 0, +1. You can set this value to True to make the keyboard strokes serve as increments to existing action.

  • action_check (bool): Check whether the value of action is between [0.0, 1.0] or not.

  • engine_config (dict): Some basic settings for low-level physics world. More information can be found in source code.

PGWorld Config

This is the core of PGDrive, including physics engine, task manager and so on.
  • window_size (tuple): Width, height of rendering window.

  • debug (bool): The debug value in PGDriveEnv will be passed to PGWorld.

  • physics_world_step_size (float): The minimum step size of bullet physics engine.

  • show_fps (bool): Turn on/ turn off the frame rater.

  • onscreen_message (bool): Turn on to show help message or your self defined messages by organizing them in a dict and pass it in render(text=your_messgaes_dict) function.

  • force_fps (None or float): None means no render fps limit, while float indicates the maximum render FPS.

  • decision_repeat (int): This will be written by PGDriveEnv to do ForceFPS.

  • debug_physics_world (bool): Only render physics world without model, a special debug option.

  • headless_machine_render (bool): Set this to true only when training on headless machine and use rgb image!!!!!!

  • use_render (bool): The value is same as use_render in PGDriveEnv

  • offscreen_render (bool): The value is same as offscreen_render in PGDriveEnv.