Need help with gym-carla?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

227 Stars 53 Forks MIT License 36 Commits 24 Opened issues


An OpenAI gym wrapper for CARLA simulator

Services available


Need anything else?

Contributors list

# 188,155
29 commits


An OpenAI gym third party environment for CARLA simulator.

System Requirements

  • Ubuntu 16.04


  1. Setup conda environment

    $ conda create -n env_name python=3.6
    $ conda activate env_name
  2. Clone this git repo in an appropriate folder

    $ git clone
  3. Enter the repo root folder and install the packages:

    $ pip install -r requirements.txt
    $ pip install -e .
  4. Download CARLA_0.9.6, extract it to some folder, and add CARLA to

    environment variable:
    $ export PYTHONPATH=$PYTHONPATH:$YourFolder$/CARLA_0.9.6/PythonAPI/carla/dist/carla-0.9.6-py3.5-linux-x86_64.egg


  1. Enter the CARLA root folder and launch the CARLA server by:
    $ ./ -windowed -carla-port=2000
    You can use
    to get back your mouse control.

Or you can run in non-display mode by:

$ DISPLAY= ./ -opengl -carla-port=2000
  1. Run the test file:
    $ python
    See details of
    about how to use the CARLA gym wrapper.


  1. We provide a dictionary observation including front view camera (obs['camera']), birdeye view lidar point cloud (obs['lidar']) and birdeye view semantic representation (obs['birdeye']):

    We also provide a state vector observation (obs['state']) which is composed of lateral distance and heading error between the ego vehicle to the target lane center line (in meter and rad), ego vehicle's speed (in meters per second), and and indicator of whether there is a front vehicle within a safety margin.
  2. The termination condition is either the ego vehicle collides, runs out of lane, reaches a destination, or reaches the maximum episode timesteps. Users may modify function terminal in to enable customized termination condition.

  3. The reward is a weighted combination of longitudinal speed and penalties for collision, exceeding maximum speed, out of lane, large steering and large lateral accleration. Users may modify function getreward in to enable customized reward function.

Related Repos and Papers

Deep Reinforcement Learning for Autonomous Driving

Deep Imitation Learning for Autonomous Driving

Autonomous Driving Perception and Representation Learning

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.