The following requirements should be fulfilled before installing CARLA: • System requirements. CARLA is built for Windows and Linux systems. • An adequate GPU. CARLA aims for realistic simulations, so the server needs at least a 6 GB GPU although 8 GB is recommended, especially when dealing with machine learning. • Disk space. CARLA will use about 20 GB of space. • Python. Python is the main scripting language in CARLA. On Linux, CARLA supports Python 2.7 and Python 3.7. On windows, Python 3.7 only is supported. • Pip. Some installation methods of the CARLA client library require pip or pip3 (depending on your Python version) version 20.3 or higher. 2 Linux Installation The Debian package is available for both Ubuntu 18.04 and Ubuntu 20.04.
2.1 Install the Carla Server on Linux
• Set up the Debian repository in the system (each of the two commands bellow is to be run as a single line):
$ sudo apt-key adv --keyserver keyserver.ubuntu.com --recvkeys 1AF1527DE64CB8D9
$ sudo add-apt-repository "deb [arch=amd64] http://dist.carla.
org/carla(lsb_release -sc) main"
• Update the package lists and install the Carla server:
$ sudo apt-get update
$ sudo apt-get install carla-simulator
• Import additional assets: Each Carla release has it’s own additional package of extra assets and maps. These additional assets can be installed with the command bellow:
$ cd /opt/carla-simulator
$ ./ImportAssets.sh
• Test your server installation:
You can start the Carla server with the following command:
$ ./CarlaUE4.sh
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 W A D S keys, holding
down the right mouse button to control the direction.
This is the server simulator which is now running and waiting for a client to
connect and interact with the world.
Troubleshooting
Some problem might arise when runing the server. These problem are reviewed
below:
• You get the error message: “error while loading shared libraries: libomp.so.5:
cannot open shared object file: No such file or directory”.
This error is solved by installing libomp5:
$ sudo apt install libomp5
• If you have 2 graphic cards (Intel and Nvidia) installed, Carla tend to select the first active GPU device (which is often Intel GPU), even if you have selected Nvidia in PRIME. This leads to a segmentation fault. To overcome this, you have to tell Carla to prefer the Nvidia GPU:
$ ./CarlaUE4.sh -preferNvidia
• If you are installing Carla on a remote machine, forwarding the Carla server GUI will fail. To solve this, you will need to start Carla in Off-screen mode. In this mode, unreal Engine is working as usual, rendering is computed but there is no display available. GPU based sensors return data as usual.
$ ./CarlaUE4.sh -RenderOffScreen
2.2 Install Carla Client on Linux
The Carla client API is implemented in Python. 2.2.1 Create a Conda Environment (optional) It is highly recommended to install the CARLA client library in a conda virtual environment to avoid packages conflicts whit your other projects. Note for example that Carla requires python 3.7 (or python 2.7). If your are not familiar with the Anaconda python distribution, see how to installit on Linux in Appendix 4.2. Assuming you have Anaconda installed, create a virtual environment (named carla for example) with python 3.7 and activate it:
$ conda create -n carla python=3.7
$ conda activate carla
2.2.2 Check your Pip Version • Pip3 requires version 20.3 or higher. Check your pip3 version:
$ pip3 -V
If needed, upgrade pip3:
$ pip3 install --upgrade pip
• Install the python dependencies:
$ pip3 install pygame opencv-python
$ conda install numpy matplotlib
2.2.3 Install the Client You are now ready to install the carla client in your created virtual environment. CARLA provides .whl files for different Python versions. There can be found in PythonAPI/carla/dist/. There is one file per supported Python version, indicated by the file name. Install the one corresponding to your carla server- and python version (0.9.13 & 3.7 at the time of writing):
$ cd /opt/carla-simulator/PythonAPI/carla/dist
$ pip3 install carla-0.9.13-cp37-cp37m-manylinux_2_27_x86_64.whl
2.3 Test your Complete Linux Installation You can test your complete installation (client & server) by running the demo_run_carla.py script provided with this installation guide. An Opencv windows will pop up displaying a car driving around. Note that you must run this script within your carla conda environment and the server has to be runing (started via ./CarlaUE4.sh).
$ conda create -n carla python=3.7
$ conda activate carla
• Install the python dependencies:
$ pip3 install pygame opencv-python
$ conda install numpy matplotlib
• Install the client via the whl file:
CARLA provides .whl files for different Python versions. There can be found in PythonAPI/carla/dist/. There is one file per supported Python version,indicated by the file name.
In the conda command prompt, navigate to the directory where you extracted Carla, then navigate to PythonAPI/carla/dist/ and run the following
command to install the client corresponding to your carla server- and python
version (0.9.13 & 3.7 at the time of writing):
$ pip3 install carla-0.9.13-cp37-cp37m-win_amd64.whl
The process is shown in the figure bellow:
3.3 Test your Complete Windows Installation
You can test your complete installation (client & server) by running the demo_run_carla.py script provided with this installation guide. An Opencv windows will pop up displaying a car driving around.Note that you must run this script within your carla conda environment and the server has to be runing (started via
CarlaUE4.exe).
These are the files used to manipulate carla and perform simulation on it. Basic structure of API.
Vehicles are special type of actor in carla.It incorporates special type of components that simulates physcics of wheeled vehicles. This achived by applying types of different controls.