This repo serves as a guide to installing and testing CARLA & CARLA ROS Bridge on Ubuntu 20.04 LTS.
- This repo itself contains several ROS packages and can be placed in any Catkin workspace by
mkdir -p ~/catkin_ws/src
cd ~/catkin_ws/src
git clone [email protected]:lb-robotics/carla-playground.git
cd ..
catkin init
catkin config --install
catkin build
Notice that the use of catkin_tools
is necessary to build the workspace.
- This repo depends on self-developed LibCarla (CARLA C++ libraries, details see here).
- Due to the CMake structure of LibCarla, this repo can only be built wth
catkin_tools 0.5.0
with a proper install space:
catkin config --install
CARLA is an open-source simulator for autonomous driving research and is still in active development. However, when it comes to the brand-new Ubuntu 20.04 LTS, CARLA has not released an official Debian package for users to install conveniently. Thus, users who wish to install CARLA on Ubuntu 20.04 LTS have to build it from source. This article will go through the entire process of how to build CARLA from source on Ubuntu 20.04 LTS.
- Ubuntu 20.04 LTS
- 140 GB disk space. Although the official Wiki says it only takes up to 30-50 GB disk space, unfortunately when I was compiling UnrealEngine I have spent over 100 GB disk space on it.
- CARLA 0.9.10.1, UnrealEngine 4.24, ROS Noetic Ninjemys. This article will focus on how to compile the current-latest CARLA 0.9.10.1 along with UnrealEngine 4.24.
- Python 3.8
Please refer to the official wiki here.
My experience is a little bit difference from the official wiki. I was not able to find and install Ubuntu Xenial's LLVM tool on 20.04 LTS, and thus I used Ubuntu Focal's default apt repository for clang-8
installation. What's more, ROS Noetic has removed all support for Python 2, so we don't need to build anything for Python 2 either.
sudo apt-get update &&
sudo apt-get install wget software-properties-common &&
sudo add-apt-repository ppa:ubuntu-toolchain-r/test &&
sudo apt-get update
sudo apt-get install build-essential clang-8 g++-7 cmake ninja-build libvulkan1 python3-dev python3-pip libpng-dev libtiff5-dev libjpeg-dev tzdata sed curl unzip autoconf libtool rsync libxml2-dev &&
pip3 install --user -Iv setuptools==47.3.1 &&
pip3 install --user distro
For CARLA 0.9.10.1, we are supposed to install UnrealEngine 4.24 only. Create an UnrealEngine account and link your GitHub account to it to get access to the UnrealEngine developer GitHub repository. Then, clone UnrealEngine 4.24 release only onto your local machine.
git clone --depth=1 -b 4.24 https://github.com/EpicGames/UnrealEngine.git ~/UnrealEngine_4.24
Download a patch for Unreal Engine. This patch fixes some Vulkan visualization issues that may occur when changing the map. Download and install it with the following commands.
cd ~/UnrealEngine_4.24
wget https://carla-releases.s3.eu-west-3.amazonaws.com/Linux/UE_Patch/430667-13636743-patch.txt 430667-13636743-patch.txt
patch --strip=4 < 430667-13636743-patch.txt
Build UnrealEngine 4.24 with the following commands. This may take up to 2 hours for the build.
./Setup.sh && ./GenerateProjectFiles.sh && make
Check your build of UnrealEngine 4.24 by trying to open UnrealEngine Editor.
cd ~/UnrealEngine_4.24/Engine/Binaries/Linux && ./UE4Editor
Building CARLA 0.9.10.1 requires to clone CARLA repository onto local machine. After clone, checkout the 0.9.10.1 tag.
git clone https://github.com/carla-simulator/carla
git checkout tags/0.9.10.1
Download the assets that are necessary to build CARLA.
cd ~/carla
./Update.sh
CARLA build tool finds the root folder of UnrealEngine 4.24 by setting the following environment variable:
export UE4_ROOT=~/UnrealEngine_4.24
If you wish to set the environment variable permanently, add it to your ~/.bashrc
.
CARLA build contains the following options:
- 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.
make PythonAPI
- 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
- Creating a packaged version for CARLA helps to start the server much faster and more conveniently. After creating the package, the starting script of CARLA can be found in
~/carla/Dist/CARLA_Shipping_0.9.10.1/LinuxNoEditor/CarlaUE4.sh
.
make package
A working version of CARLA 0.9.10.1 build can be found using this Google Link: https://drive.google.com/file/d/1XYc6xtr0X1xM0U4nHkGW5NnG_O0iSunv/view?usp=sharing. Users can download and extract the tar
file, and run
./CarlaUE4.sh
- If CARLA consumes a lot of GPU resources and you would like to set limit on that, you can manually specify window size of CARLA window:
./CarlaUE4.sh -windowed -ResX=1080 -ResY=720
Thanks this tutorial for providing this information!
- CARLA running in the background can be achieved by this command:
SDL_VIDEODRIVER=offscreen ./CarlaUE4.sh -opengl
There are a lot of useful examples of CARLA Python API under ~/carla/PythonAPI/examples
. Feel free to check them out!
To install ROS Bridge 0.9.10.1, following the official instructions.
CARLA: An Open Urban Driving Simulator
Alexey Dosovitskiy, German Ros,
Felipe Codevilla, Antonio Lopez, Vladlen Koltun; PMLR 78:1-16
[PDF]
[talk]
[GitHub]
Official CARLA Documentation Website: https://carla.readthedocs.io/en/latest/build_linux/