Quick start


Installation summary

Show command line summary for the quick start installation
# Install required modules Pygame and Numpy
 pip install --user pygame numpy

# There are two different ways to install CARLA

# Option A) Debian package installation
# This repository contains CARLA 0.9.10 and later. To install previous CARLA versions, change to a previous version of the docs using the pannel in the bottom right part of the window
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 1AF1527DE64CB8D9
sudo add-apt-repository "deb [arch=amd64] http://dist.carla.org/carla $(lsb_release -sc) main"
sudo apt-get update
sudo apt-get install carla-simulator # Install the latest CARLA version or update the current installation
sudo apt-get install carla-simulator=0.9.10-1 # install a specific CARLA version
cd /opt/carla-simulator
./CarlaUE4.sh

# Option B) Package installation
#   Go to: https://github.com/carla-simulator/carla/blob/master/Docs/download.md
#   Download the desired package and additional assets
#   Extract the package
#   Extract the additional assets in `/Import`
#   Run CARLA (Linux).
./CarlaUE.sh
#   Run CARLA (Windows)
> CarlaUE4.exe

# Run a script to test CARLA.
cd PythonAPI/examples
python3 spawn_npc.py # Support for Python2 was provided until 0.9.10 (not included)

# The PythonAPI can be compiled for Python2 when using a Linux build from source


Requirements

The quick start installation uses a pre-packaged version of CARLA. The content is comprised in a boundle that can run automatically with no build installation needed. The API can be accesseded fully but advanced customization and development options are unavailable.
The requirements are simpler than those for the build installation.

  • Server side. A 4GB minimum GPU will be needed to run a highly realistic environment. A dedicated GPU is highly advised for machine learning.
  • Client side. Python is necessary to access the API via command line. Also, a good internet connection and two TCP ports (2000 and 2001 by default).
  • System requirements. Any 64-bits OS should run CARLA. However, since release 0.9.9, CARLA cannot run in 16.04 Linux systems with default compilers. These should be upgraded to work with CARLA.
  • Other requirements. Two Python modules: Pygame to create graphics directly with Python, and Numpy for great calculus.

To install both modules using pip, run the following commands.

 pip install --user pygame numpy

CARLA installation

The Debian installation is the easiest way to get the latest release in Linux.
Download the GitHub repository to get either a specific release or the Windows version of CARLA.

A. Debian CARLA installation

Set up the Debian repository in the system.

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 1AF1527DE64CB8D9
sudo add-apt-repository "deb [arch=amd64] http://dist.carla.org/carla $(lsb_release -sc) main"

Install CARLA and check for the installation in the /opt/ folder.

sudo apt-get update # Update the Debian package index
sudo apt-get install carla-simulator # Install the latest CARLA version, or update the current installation
cd /opt/carla-simulator # Open the folder where CARLA is installed

This repository contains CARLA 0.9.10 and later versions. To install a specific version add the version tag to the installation command.

sudo apt-get install carla-simulator=0.9.10-1 # In this case, "0.9.10" refers to a CARLA version, and "1" to the Debian revision

Important

To install CARLA versions prior to 0.9.10, change to a previous version of the documentation using the pannel in the bottom right corner of the window, and follow the old instructions.

B. Package installation

The repository contains different versions of the simulator available. Development and stable sections list the packages for the different official releases. The later the version the more experimental it is. The nightly build is the current development version as today and so, the most unstable.

There may be many files per release. The package is a compressed file named as CARLA_version.number.

Download and extract the release file. It contains a precompiled version of the simulator, the Python API module and some scripts to be used as examples.


Import additional assets

For every release there are other packages containing additional assets and maps, such as Additional_Maps_0.9.9.2 for CARLA 0.9.9.2, which contains Town06, Town07, and Town10. These are stored separatedly to reduce the size of the build, so they can only be run after these packages are imported.

Download and move the package to the Import folder, and run the following script to extract them.

> cd ~/carla
> ./ImportAssets.sh

Note

On Windows, directly extract the package on the root folder.


Running CARLA

Open a terminal in the main CARLA folder. Run the following command to execute the package file and start the simulation:

# Linux:
> ./CarlaUE4.sh
# Windows:
> CarlaUE4.exe

Important

In the deb installation, CarlaUE4.sh will be in /opt/carla-simulator/bin/, instead of the main carla/ folder where it normally is.

A window containing a view over the city will pop up. This is the spectator view. To fly around the city use the mouse and WASD keys (while clicking). The server simulator is now running and waiting for a client to connect and interact with the world.
Now it is time to start running scripts. The following example will spawn some life into the city:

# Go to the folder containing example scripts
> cd PythonAPI/examples

> python3 spawn_npc.py # Support for Python2 was provided until 0.9.10 (not included)

Note

The PythonAPI can be compiled for Python2 when using a Linux build from source.

Command-line options

There are some configuration options available when launching CARLA.

  • -carla-rpc-port=N Listen for client connections at port N. Streaming port is set to N+1 by default.
  • -carla-streaming-port=N Specify the port for sensor data streaming. Use 0 to get a random unused port. The second port will be automatically set to N+1.
  • -quality-level={Low,Epic} Change graphics quality level. Find out more in rendering options.
  • Full list of UE4 command-line arguments. There is a lot of options provided by UE. However, not all of these will be available in CARLA.
> ./CarlaUE4.sh -carla-rpc-port=3000

The script PythonAPI/util/config.py provides for more configuration options.

> ./config.py --no-rendering      # Disable rendering
> ./config.py --map Town05        # Change map
> ./config.py --weather ClearNoon # Change weather

> ./config.py --help # Check all the available configuration options

Updating CARLA

The packaged version requires no updates. The content is bundled and thus, tied to a specific version of CARLA. Everytime there is a release, the repository will be updated. To run this latest or any other version, delete the previous and install the one desired.


Follow-up

Thus concludes the quick start installation process. In case any unexpected error or issue occurs, the CARLA forum is open to everybody. There is an Installation issues category to post this kind of problems and doubts.

So far, CARLA should be operative in the desired system. Terminals will be used to contact the server via script, interact with the simulation and retrieve data. To do so, it is essential to understand the core concepts in CARLA. Read the First steps section to learn on those. Additionally, all the information about the Python API regarding classes and its methods can be accessed in the Python API reference.