본문 바로가기

CARLA

Getting start CARLA in Linux

 

Getting start CARLA for beginner

I install CARLA with this link in my desktop with Ubuntu 18.04.

 

https://carla.readthedocs.io/en/latest/build_linux/

 

Linux build - CARLA Simulator

Linux build The build process can be quite long and tedious. The F.A.Q. section contains the most common issues and solutions that appear during the installation. However, the CARLA forum is open for anybody to post unexpected issues, doubts or suggestions

carla.readthedocs.io

Requirements

System specifics

  • Ubuntu 16.04 or later. Currently migrating to Ubuntu 18.
  • 30GB disk space. Installing all the software needed and CARLA itself will require quite a lot of space, especially Unreal Engine. Make sure to have around 30/50GB of free disk space.
  • An adequate GPU. CARLA aims for realistic simulations, so the server needs at least a 4GB GPU. A dedicated GPU is highly recommended for machine learning.
  • Two TCP ports and good internet connection. 2000 and 2001 by default. Be sure neither the firewall nor any other application block these.

 

1. install Dependencies

Dependencies

type this in your terminal :

sudo apt-get update && sudo apt-get install wget software-properties-common && sudo add-apt-repository ppa:ubuntu-toolchain-r/test && wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key|sudo apt-key add - && sudo apt-add-repository "deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-8 main" && sudo apt-get update

 

and add command :

 

at Ubuntu 18.04 :

sudo apt-get install build-essential clang-8 lld-8 g++-7 cmake ninja-build libvulkan1 python python-pip python-dev python3-dev python3-pip libpng-dev libtiff5-dev libjpeg-dev tzdata sed curl unzip autoconf libtool rsync libxml2-dev && pip2 install --user setuptools && pip3 install --user setuptools

 

at Previous Ubuntu versions :

sudo apt-get install build-essential clang-8 lld-8 g++-7 cmake ninja-build libvulkan1 python python-pip python-dev python3-dev python3-pip libpng16-dev libtiff5-dev libjpeg-dev tzdata sed curl unzip autoconf libtool rsync libxml2-dev && pip2 install --user setuptools && pip3 install --user setuptools

 

To avoid compatibility issues between Unreal Engine and the CARLA dependencies, it is recommended to use the same compiler version and C++ runtime library to compile everything :

sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/lib/llvm-8/bin/clang++ 180 && sudo update-alternatives --install /usr/bin/clang clang /usr/lib/llvm-8/bin/clang 180

 

2. Creat GitHub account

GitHub

A GitHub account will be needed, as CARLA content is organized in different repositories in there.

 

 

 

3. Connect your GitHub account to EpicGames

In order to access the Unreal Engine repositories, which are set to private, create an Unreal Engine account and connect it to a GitHub account. 

 

Go Unreal engine main page
Sign in
and Enter PERSONAL
Link your GitHub username by clicking  Connect  under the GitHub icon
To authorize the connection click  Authorize EpicGames
Finish Connecting

 

4. Unreal Engine

The current version of CARLA runs on Unreal Engine 4.24 only.

 

Clone the content for Unreal Engine 4.24 in a local computer :

git clone --depth=1 -b 4.24 https://github.com/EpicGames/UnrealEngine.git ~/UnrealEngine_4.24

 

Get into UE folder. Remember, this is the path where UE4.24 has been cloned.

cd ~/UnrealEngine_4.24

 

Make the build.

./Setup.sh && ./GenerateProjectFiles.sh && make

 

Unreal Engine should be installed in the system. Run Engine/Binaries/Linux/UE4Editor.sh to open the Editor and check it out.

cd ~/UnrealEngine_4.24/Engine/Binaries/Linux && ./UE4Editor

 

5. CARLA build

The system should be ready to start building CARLA. Just for clarity, a brief summary so far.

  • Minimum technical requirements to run CARLA are suitable.
  • Dependencies have been properly installed.
  • GitHub account is ready.
  • Unreal Engine 4.24 runs smooth.

Downloading aria2 with :

sudo apt-get install aria2

will speed up the following commands.

 

 

Clone CARLA repository :

git clone https://github.com/carla-simulator/carla

 

Get assets

Only the assets package is yet to be donwloaded. These are stored separately to make the repository a bit lighter. CARLA cannot be built without the assets. There is a script that downloads and extracts the latest content version. The package is >3GB, so downloading it may take some time.

 

Get into the root carla folder. The path should correspond with the repository just cloned:

cd ~/carla

 

Run the script to get the assets. :

./Update.sh

 

Set the environment variable

The variable should be added to ~/.bashrc or ~/.profile to be set persistently session-wide. Otherwise, it will only be accessible from the current shell.

 

export UE4_ROOT=~/UnrealEngine_4.24

 

make CARLA

The last step is to finally build CARLA. There are different make commands to build the different modules. All of them run in the root CARLA folder.

 

Warning

Make sure to run make launch to prepare the server and make PythonAPI for the client.
Alternatively make libcarla will prepare the CARLA library to be imported anywhere.

  • make launch compiles the server simulator and launches Unreal Engine. Press Play to start the spectator view and close the editor window to exit. Camera can be moved with WASD keys and rotated by clicking the scene while moving the mouse around.

: make launch

 

The project may ask to build other instances such as UE4Editor-Carla.dll the first time. Agree in order to open the project. During the first launch, the editor may show warnings regarding shaders and mesh distance fields. These take some time to be loaded and the city will not show properly until then.

  • make PythonAPI compiles the API client, necessary to grant control over the simulation. It is only needed the first time. Remember to run it again when updating CARLA. Scripts will be able to run after this command is executed. The following example will spawn some life into the town.

 

: make PythonAPI && cd PythonAPI/examples && python3 spawn_npc.py

 

 

Now CARLA is ready to go. Here is a brief summary of the most useful make commands available.

CommandDescription

make help Prints all available commands.
make launch Launches CARLA server in Editor window.
make PythonAPI Builds the CARLA client.
make package Builds CARLA and creates a packaged version for distribution.
make clean Deletes all the binaries and temporals generated by the build system.
make rebuild make clean and make launch both in one command.

'CARLA' 카테고리의 다른 글

CARLA : triple monitor with carla_ros_bridge  (0) 2020.04.09
CARLA : double monitor manual_control  (0) 2020.04.08
Getting start CARLA : 2nd Way in Linux  (0) 2020.04.08
CARLA  (0) 2020.04.07