Updated docker image with new commands based on the graphics API used. Brought docker build for managing packages into the main docs from github. Updated rendering docs to reflect the fact UE4.26 uses only vulkan and has an off screen flag. Moved make package from docker instructions to the guide for making packages.
This commit is contained in:
parent
4a8342fae1
commit
9e88bf1e99
|
@ -1,16 +1,16 @@
|
||||||
# Rendering options
|
# Rendering options
|
||||||
|
|
||||||
There are few details to take into account at the time of configuring a simulation. This page covers the more important ones.
|
|
||||||
|
|
||||||
* [__Graphics quality__](#graphics-quality)
|
|
||||||
* [Vulkan vs OpenGL](#vulkan-vs-opengl)
|
- [__Graphics quality__](#graphics-quality)
|
||||||
* [Quality levels](#quality-levels)
|
- [Vulkan vs OpenGL](#vulkan-vs-opengl)
|
||||||
* [__No-rendering mode__](#no-rendering-mode)
|
- [Quality levels](#quality-levels)
|
||||||
* [__Off-screen mode__](#off-screen-mode)
|
- [__No-rendering mode__](#no-rendering-mode)
|
||||||
* [Off-screen Vs no-rendering](#off-screen-vs-no-rendering)
|
- [__Off-screen mode__](#off-screen-mode)
|
||||||
* [__Running off-screen using a preferred GPU__](#running-off-screen-using-a-preferred-gpu)
|
- [Off-screen Vs no-rendering](#off-screen-vs-no-rendering)
|
||||||
* [Docker - recommended approach](#docker-recommended-approach)
|
- [__Running off-screen using a preferred GPU__](#running-off-screen-using-a-preferred-gpu)
|
||||||
* [Deprecated - emulate the virtual display](#deprecated-emulate-the-virtual-display)
|
- [Docker - recommended approach](#docker-recommended-approach)
|
||||||
|
- [Deprecated - emulate the virtual display](#deprecated-emulate-the-virtual-display)
|
||||||
|
|
||||||
|
|
||||||
!!! Important
|
!!! Important
|
||||||
|
@ -19,23 +19,15 @@ There are few details to take into account at the time of configuring a simulati
|
||||||
---
|
---
|
||||||
## Graphics quality
|
## Graphics quality
|
||||||
|
|
||||||
### Vulkan vs OpenGL
|
### Vulkan graphics API
|
||||||
|
|
||||||
Vulkan is the default graphics API used by Unreal Engine, and CARLA. It consumes more memory, but performs faster and makes for a better frame rate. However, it is quite experimental, especially in Linux, and it may lead to some issues.
|
Starting from version 0.9.12, CARLA runs on Unreal Engine 4.26 which only supports the Vulkan graphics API. Previous versions of CARLA could be configured to use OpenGL. If you are using a previous version of CARLA, please select the corresponding documentation version in the lower right corner of the screen for more information.
|
||||||
|
|
||||||
There is the option to change to OpenGL. Use a flag when running CARLA.
|
|
||||||
|
|
||||||
```sh
|
|
||||||
cd carla && ./CarlaUE4.sh -opengl
|
|
||||||
```
|
|
||||||
When working with the build version of CARLA, Unreal Engine needs to be set to use OpenGL. [Here][UEdoc] is a documentation regarding different command line options for Unreal Engine.
|
|
||||||
[UEdoc]: https://docs.unrealengine.com/en-US/Programming/Basics/CommandLineArguments/index.html
|
|
||||||
|
|
||||||
### Quality levels
|
### Quality levels
|
||||||
|
|
||||||
CARLA also allows for two different graphic quality levels. __Epic__, the default is the most detailed. __Low__ disables all post-processing and shadows, the drawing distance is set to 50m instead of infinite.
|
CARLA has two different levels for graphics quality. __Epic__ is the default and is the most detailed. __Low__ disables all post-processing and shadows and the drawing distance is set to 50m instead of infinite.
|
||||||
|
|
||||||
The simulation runs significantly faster in __Low__ mode. This is not only used when there are technical limitations or precision is nonessential. It may be useful to train agents under conditions with simpler data or regarding only close elements.
|
The simulation runs significantly faster in __Low__ mode. This is helpful in situations where there are technical limitations, where precision is nonessential or to train agents under conditions with simpler data or involving only close elements.
|
||||||
|
|
||||||
The images below compare both modes. The flag used is the same for Windows and Linux. There is no equivalent option when working with the build, but the UE editor has its own quality settings. Go to `Settings/Engine Scalability Settings` for a greater customization of the desired quality.
|
The images below compare both modes. The flag used is the same for Windows and Linux. There is no equivalent option when working with the build, but the UE editor has its own quality settings. Go to `Settings/Engine Scalability Settings` for a greater customization of the desired quality.
|
||||||
|
|
||||||
|
@ -61,7 +53,8 @@ The images below compare both modes. The flag used is the same for Windows and L
|
||||||
|
|
||||||
This mode disables rendering. Unreal Engine will skip everything regarding graphics. This mode prevents rendering overheads. It facilitates a lot traffic simulation and road behaviours at very high frequencies. To enable or disable no-rendering mode, change the world settings, or use the provided script in `/PythonAPI/util/config.py`.
|
This mode disables rendering. Unreal Engine will skip everything regarding graphics. This mode prevents rendering overheads. It facilitates a lot traffic simulation and road behaviours at very high frequencies. To enable or disable no-rendering mode, change the world settings, or use the provided script in `/PythonAPI/util/config.py`.
|
||||||
|
|
||||||
Here is an example on how to enable and then disable it via script.
|
Below is an example on how to enable and then disable it via script:
|
||||||
|
|
||||||
```py
|
```py
|
||||||
settings = world.get_settings()
|
settings = world.get_settings()
|
||||||
settings.no_rendering_mode = True
|
settings.no_rendering_mode = True
|
||||||
|
@ -70,7 +63,8 @@ world.apply_settings(settings)
|
||||||
settings.no_rendering_mode = False
|
settings.no_rendering_mode = False
|
||||||
world.apply_settings(settings)
|
world.apply_settings(settings)
|
||||||
```
|
```
|
||||||
And here is an example on how to disable and then enable rendering using the `config.py`.
|
To disable and enable rendering via the command line, run the following commands:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
cd PythonAPI/util && python3 config.py --no-rendering
|
cd PythonAPI/util && python3 config.py --no-rendering
|
||||||
```
|
```
|
||||||
|
@ -78,7 +72,8 @@ cd PythonAPI/util && python3 config.py --no-rendering
|
||||||
cd PythonAPI/util && python3 config.py --rendering
|
cd PythonAPI/util && python3 config.py --rendering
|
||||||
```
|
```
|
||||||
|
|
||||||
The script `PythonAPI/examples/no_rendering_mode.py` will enable no-rendering mode, and use __Pygame__ to create an aerial view using simple graphics.
|
The script `PythonAPI/examples/no_rendering_mode.py` will enable no-rendering mode, and use __Pygame__ to create an aerial view using simple graphics:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
cd PythonAPI/examples && python3 no_rendering_mode.py
|
cd PythonAPI/examples && python3 no_rendering_mode.py
|
||||||
```
|
```
|
||||||
|
@ -89,121 +84,81 @@ cd PythonAPI/examples && python3 no_rendering_mode.py
|
||||||
---
|
---
|
||||||
## Off-screen mode
|
## Off-screen mode
|
||||||
|
|
||||||
Unreal Engine needs for a screen in order to run. However, there is a workaround for remote servers with no display, or desktop users with a GPU not connected to any screen.
|
Starting from version 0.9.12, CARLA runs on Unreal Engine 4.26 which introduced support for off-screen rendering. In previous versions of CARLA, off-screen rendering depended upon the graphics API you were using. If you are using a previous version of CARLA, please select the corresponding documentation version in the lower right corner of the screen for more information.
|
||||||
|
|
||||||
The simulator launches but there is no available window. It runs in the same way as normal mode. This mode tricks Unreal Engine into running in a "fake screen".
|
|
||||||
|
|
||||||
### Off-screen vs no-rendering
|
### Off-screen vs no-rendering
|
||||||
|
|
||||||
It is important to understand the disctintion them to prevent misunderstandings.
|
It is important to understand the distinction between __no-rendering mode__ and __off-screen mode__:
|
||||||
|
|
||||||
* In __no-rendering__, Unreal Engine does not render anything. Graphics are not computed.
|
- __No-rendering mode:__ Unreal Engine does not render anything. Graphics are not computed. GPU based sensors return empty data.
|
||||||
* In __off-screen__, Unreal Engine is working as usual, rendering is computed. Simply, there is no display available. GPU sensors return data when off-screen, and no-rendering mode can be enabled at will.
|
- __Off-screen mode:__ Unreal Engine is working as usual, rendering is computed but there is no display available. GPU based sensors return data.
|
||||||
|
|
||||||
### Setting off-screen mode
|
### Setting off-screen mode
|
||||||
|
|
||||||
This is __only possible in Linux while using OpenGL__. Unreal Engine crushes when Vulkan is running off-screen, and this issue is yet to be fixed by Epic.
|
To start CARLA in off-screen mode, run the following command:
|
||||||
|
|
||||||
To force the simulator run off-screen set the environment variable `DISPLAY` to empty and run CARLA using OpenGL.
|
```sh
|
||||||
|
./CarlaUE4.sh -RenderOffScreen
|
||||||
|
```
|
||||||
|
|
||||||
|
Using off-screen mode differs if you are using either OpenGL or Vulkan.
|
||||||
|
|
||||||
|
__Using OpenGL__, you can run in off-screen mode in Linux by running the following command:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
# Linux
|
# Linux
|
||||||
DISPLAY= ./CarlaUE4.sh -opengl
|
DISPLAY= ./CarlaUE4.sh -opengl
|
||||||
```
|
```
|
||||||
---
|
|
||||||
## Running off-screen using a preferred GPU
|
|
||||||
|
|
||||||
### Docker - recommended approach
|
__Vulkan__ requires extra steps because it needs to communicate to the display X server using the X11 network protocol to work properly. The following steps will guide you on how to set up an Ubuntu 18.04 machine without a display so that CARLA can run with Vulkan.
|
||||||
|
|
||||||
The best way to run a headless CARLA and select the GPU is to [__run CARLA in a Docker__](build_docker.md).
|
__1. Fetch the latest NVIDIA driver:__
|
||||||
|
|
||||||
This section contains an alternative tutorial, but this method is deprecated and performance is much worse. It is here only for those who Docker is not an option.
|
|
||||||
|
|
||||||
|
|
||||||
### Deprecated - emulate the virtual display
|
|
||||||
|
|
||||||
<details>
|
|
||||||
<summary>
|
|
||||||
Show deprecated tutorial on how to emulate the virtual display
|
|
||||||
</summary>
|
|
||||||
|
|
||||||
!!! Warning
|
|
||||||
This tutorial is deprecated. To run headless CARLA, please [__run CARLA in a Docker__](build_docker.md).
|
|
||||||
|
|
||||||
* __Requirements:__
|
|
||||||
|
|
||||||
This tutorial only works in Linux and makes it possible for a remote server using several graphical cards to use CARLA on all GPUs. This is also translatable to a desktop user trying to use CARLA with a GPU that is not plugged to any screen. To achieve that, the steps can be summarized as:
|
|
||||||
|
|
||||||
__1.__ Configure the server to have Nvidia working with no display.
|
|
||||||
__2.__ Use VNC and VGL to simulate a display connected to any GPU.
|
|
||||||
__3.__ Run CARLA.
|
|
||||||
|
|
||||||
This tutorial was tested in Ubuntu 16.04 using NVIDIA 384.11 drivers.
|
|
||||||
|
|
||||||
* __[Latest Nvidia drivers](http://www.nvidia.es/Download/index.aspx)__
|
|
||||||
* __[OpenGL](https://www.khronos.org/opengl/wiki/Getting_Started)__: needed to use Virtual GL (VGL). OpenGL can be installed via apt:
|
|
||||||
```sh
|
```sh
|
||||||
sudo apt-get install freeglut3-dev mesa-utils
|
wget http://download.nvidia.com/XFree86/Linux-x86_64/450.57/NVIDIA-Linux-x86_64-450.57.run
|
||||||
```
|
```
|
||||||
* __[VGL](https://virtualgl.org/vgldoc/2_2_1/#hd004001)__: redirects 3D rendering commands from Unix and Linux OpenGL to the hardware in a dedicated server.
|
|
||||||
|
|
||||||
* __[TurboVNC 2.11](https://cdn.rawgit.com/TurboVNC/turbovnc/2.1.1/doc/index.html#hd005001)__: graphical desktop-sharing system to connect remotely to the server.
|
__2. Install the driver:__
|
||||||
|
|
||||||
* __Extra packages__: necessary to make Unreal work.
|
|
||||||
```sh
|
```sh
|
||||||
sudo apt install x11-xserver-utils libxrandr-dev
|
sudo /bin/bash NVIDIA-Linux-x86_64-450.57.run --accept-license --no-questions --ui=none
|
||||||
```
|
```
|
||||||
!!! Warning
|
|
||||||
Make sure that VNC version is compatible with Unreal. The one above worked properly during the making of this tutorial.
|
|
||||||
|
|
||||||
|
|
||||||
* __Configure the X__
|
__3. Install the xserver related dependencies:__
|
||||||
|
|
||||||
Generate a X compatible with the Nvdia installed and able to run without display:
|
```sh
|
||||||
|
sudo apt-get install -y xserver-xorg mesa-utils libvulkan1
|
||||||
|
```
|
||||||
|
|
||||||
sudo nvidia-xconfig -a --use-display-device=None --virtual=1280x1024
|
__4. Configure the xserver:__
|
||||||
|
|
||||||
* __Emulate the virtual display__
|
```sh
|
||||||
|
sudo nvidia-xconfig --preserve-busid -a --virtual=1280x1024
|
||||||
|
```
|
||||||
|
|
||||||
Run a Xorg. Here number 7 is used, but it could be labeled with any free number:
|
__5. Set the SDL_VIDEODRIVER variable.__
|
||||||
|
|
||||||
sudo nohup Xorg :7 &
|
```sh
|
||||||
|
ENV SDL_VIDEODRIVER=x11
|
||||||
|
```
|
||||||
|
|
||||||
Run an auxiliary remote VNC-Xserver. This will create a virtual display "8":
|
__6. Run the xserver:__
|
||||||
|
|
||||||
/opt/TurboVNC/bin/vncserver :8
|
```sh
|
||||||
|
sudo X :0 &
|
||||||
|
```
|
||||||
|
|
||||||
If everything is working fine the following command will run glxinfo on Xserver 7 selecting the GPU labeled as 0:
|
__7. Run CARLA:__
|
||||||
|
|
||||||
DISPLAY=:8 vglrun -d :7.0 glxinfo
|
```sh
|
||||||
|
DISPLAY=:0.GPU ./CarlaUE4.sh -vulkan
|
||||||
|
```
|
||||||
|
|
||||||
!!! Important
|
CARLA provides a Dockerfile that performs all the above steps [here](https://github.com/carla-simulator/carla/blob/master/Util/Docker/Release.Dockerfile).
|
||||||
To run on other GPU, change the `7.X` pattern in the previous command. To set it to GPU 1: `DISPLAY=:8 vglrun -d :7.1 glxinfo`
|
|
||||||
|
|
||||||
* __Extra__
|
|
||||||
|
|
||||||
To disable the need of sudo when creating the `nohup Xorg` go to `/etc/X11/Xwrapper.config` and change `allowed_users=console` to `allowed_users=anybody`.
|
|
||||||
|
|
||||||
It may be needed to stop all Xorg servers before running `nohup Xorg`. The command for that could change depending on your system. Generally for Ubuntu 16.04 use:
|
|
||||||
|
|
||||||
sudo service lightdm stop
|
|
||||||
|
|
||||||
* __Running CARLA__
|
|
||||||
|
|
||||||
To run CARLA on a certain `<gpu_number>` in a certain `$CARLA_PATH` use the following command:
|
|
||||||
|
|
||||||
DISPLAY=:8 vglrun -d :7.<gpu_number> $CARLA_PATH/CarlaUE4/Binaries/Linux/CarlaUE4
|
|
||||||
|
|
||||||
!!! Note
|
|
||||||
The `8` and `7.X` variables in the previous command depend on which were used while emulating the virtual display.
|
|
||||||
|
|
||||||
</details>
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
That is all there is to know about the different rendering options in CARLA.
|
Any issues or doubts related with this topic can be posted in the CARLA forum.
|
||||||
|
|
||||||
Open CARLA and mess around for a while. If there are any doubts, feel free to post these in the forum.
|
|
||||||
|
|
||||||
<div class="build-buttons">
|
<div class="build-buttons">
|
||||||
<p>
|
<p>
|
||||||
|
|
|
@ -1,66 +1,82 @@
|
||||||
# Running CARLA in a Docker
|
# CARLA in Docker
|
||||||
|
|
||||||
* [__Docker installation__](#docker-installation)
|
Users can pull an image based on a CARLA release to run in a Docker container. This is useful for users who:
|
||||||
* [Docker CE](#docker-ce)
|
|
||||||
* [NVIDIA-Docker2](#nvidia-docker2)
|
|
||||||
* [__Running CARLA container__](#running-carla-container)
|
|
||||||
|
|
||||||
This tutorial is designed for:
|
- Want to run CARLA without needing to install all dependencies
|
||||||
|
- Run multiple CARLA servers and perform GPU mapping
|
||||||
|
- Run the CARLA server without a display
|
||||||
|
|
||||||
* People that want to run CARLA without needing to install all dependencies.
|
This tutorial explains the requirements to run the CARLA image and how to run the image with both OpenGL and Vulkan graphics APIs.
|
||||||
* Recommended solution to run multiple CARLA servers and perform GPU mapping.
|
|
||||||
* People who don't need to render the full simulation (the server is headless).
|
|
||||||
|
|
||||||
This tutorial was tested in Ubuntu 16.04 and using NVIDIA 396.37 drivers.
|
|
||||||
This method requires a version of NVIDIA drivers >=390.
|
|
||||||
|
|
||||||
|
- [__Before you begin__](#before-you-begin)
|
||||||
|
- [__Running CARLA in a container__](#running-carla-in-a-container)
|
||||||
|
- [__Off-screen mode__](#off-screen-mode)
|
||||||
|
|
||||||
---
|
---
|
||||||
## Docker Installation
|
## Before you begin
|
||||||
|
|
||||||
|
You will need to have installed:
|
||||||
|
|
||||||
|
- __Docker:__ Follow the installation instructions [here](https://docs.docker.com/engine/install/).
|
||||||
|
- __NVIDIA Container Toolkit:__ The NVIDIA Container Toolkit is a library and toolset that exposes NVIDIA graphics devices to Linux containers. It is designed specifically for Linux containers running on Linux host systems or within Linux distributions under version 2 of the Windows Subsystem for Linux. Install the `nvidia-docker2` package by following the instructions [here](https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/install-guide.html#installation-guide).
|
||||||
|
|
||||||
!!! note
|
!!! note
|
||||||
Docker requires sudo to run. Follow this guide to add users to the docker sudo
|
Docker requires sudo to run. Follow [this guide](https://docs.docker.com/install/linux/linux-postinstall/) to add users to the docker sudo group.
|
||||||
group <https://docs.docker.com/install/linux/linux-postinstall/>
|
|
||||||
|
|
||||||
### Docker CE
|
|
||||||
|
|
||||||
For our tests we used the Docker CE version.
|
|
||||||
To install Docker CE we recommend using [this tutorial][tutoriallink]
|
|
||||||
|
|
||||||
[tutoriallink]: https://docs.docker.com/install/linux/docker-ce/ubuntu/#extra-steps-for-aufs
|
|
||||||
|
|
||||||
### NVIDIA-Docker2
|
|
||||||
|
|
||||||
To install nvidia-docker-2 we recommend using the "Quick Start" section from the [nvidia-dockers github](https://github.com/NVIDIA/nvidia-docker).
|
|
||||||
|
|
||||||
---
|
---
|
||||||
## Running CARLA container
|
## Running CARLA in a container
|
||||||
|
|
||||||
Pull the CARLA image.
|
__1. Pull the CARLA image.__
|
||||||
|
|
||||||
|
You can pull either the latest CARLA image or a specific release version. The latest image refers to the most [recent packaged release](https://github.com/carla-simulator/carla/releases). To pull the image, run one of the following commands:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
docker pull carlasim/carla:version
|
# Pull the latest image
|
||||||
```
|
docker pull carlasim/carla:latest
|
||||||
|
|
||||||
To select a specific version:
|
# Pull a specific version
|
||||||
|
|
||||||
```sh
|
|
||||||
docker pull carlasim/carla:0.9.11
|
docker pull carlasim/carla:0.9.11
|
||||||
```
|
```
|
||||||
|
|
||||||
Running CARLA under docker.
|
__2. Run the CARLA container.__
|
||||||
|
|
||||||
|
Starting from version 0.9.9, CARLA supports the Vulkan graphics API as well as OpenGL and from 0.9.11, CARLA runs with Vulkan by default. This means if you want to run 0.9.11 with the OpenGL API, you will need to specify certain flags when you run the container.
|
||||||
|
|
||||||
|
To run CARLA using Vulkan:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
docker run -p 2000-2002:2000-2002 --runtime=nvidia --gpus all carlasim/carla:0.8.4
|
sudo docker run --privileged --gpus all --net=host -e DISPLAY=$DISPLAY -e SDL_VIDEODRIVER=x11 -v /tmp/.X11-unix:/tmp/.X11-unix:rw carlasim/carla:0.9.11 /bin/bash ./CarlaUE4.sh -vulkan <-additonal-carla-flags>
|
||||||
```
|
```
|
||||||
|
|
||||||
The `-p 2000-2002:2000-2002` argument is to redirect host ports for the docker container.
|
!!! Note
|
||||||
Use `--gpus '"device=<gpu_01>,<gpu_02>"'` to specify which GPUs should run CARLA. Take a look at this [NVIDIA documentation](https://github.com/NVIDIA/nvidia-docker) to learn other syntax options.
|
This command will allow you to run the CARLA image with Vulkan as long as your machine has a display. See the [rendering documentation](adv_rendering_options.md#off-screen-mode) for information on running with Vulkan in off-screen mode.
|
||||||
|
|
||||||
You can also pass parameters to the CARLA executable. With this you can chose the town and select the port that is going to be used.
|
To run CARLA using OpenGL:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
docker run -p 2000-2002:2000-2002 --runtime=nvidia -e NVIDIA_VISIBLE_DEVICES=0 carlasim/carla:0.8.4 /bin/bash CarlaUE4.sh < Your list of parameters >
|
docker run -e DISPLAY=$DISPLAY --net=host --gpus all --runtime=nvidia carlasim/carla:<version> /bin/bash CarlaUE4.sh -opengl <-additonal-carla-flags>
|
||||||
```
|
```
|
||||||
|
|
||||||
At the list of parameters do not forget to add `-world-port=<port_number>` so that CARLA runs on server mode listening to the `<port_number>`.
|
__3. (Optional) Configure Docker flags.__
|
||||||
|
|
||||||
|
The above commands use some Docker flags that can be configured according to your needs:
|
||||||
|
|
||||||
|
- __Networking:__ The [`--net=host`](https://docs.docker.com/engine/reference/run/#network-settings) argument will allow the container to share the host's entire network. If you prefer to [map specific ports](https://docs.docker.com/engine/reference/run/#expose-incoming-ports) on the host machine to container ports, use the flag `-p <host-ports>:<container-ports>`.
|
||||||
|
- __GPUs:__ You can choose to use all GPUs with `--gpus all`, or target specific GPUs with `--gpus '"device=<gpu_01>,<gpu_02>"'`. See [here](https://docs.docker.com/config/containers/resource_constraints/#gpu) for more information.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Off-screen mode
|
||||||
|
|
||||||
|
OpenGL requires no configuration if you are running CARLA on a machine without a display, however you will need to perform some extra steps to do the same using Vulkan. See the [rendering documentation](adv_rendering_options.md#off-screen-mode) for information.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
Any issues or doubts related with this topic can be posted in the CARLA forum.
|
||||||
|
|
||||||
|
<div class="build-buttons">
|
||||||
|
<p>
|
||||||
|
<a href="https://github.com/carla-simulator/carla/discussions/" target="_blank" class="btn btn-neutral" title="Go to the CARLA forum">
|
||||||
|
CARLA forum</a>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
|
|
@ -0,0 +1,126 @@
|
||||||
|
# Build Unreal Engine and CARLA in Docker
|
||||||
|
|
||||||
|
This guide explains how Unreal Engine and CARLA can be built from scratch using Docker. The resulting image can then used to create CARLA packages or to prepare assets for use in a CARLA package. This process should not be confused with the pre-built CARLA Docker image used to run CARLA on multiple servers or without a display. The documentation for that can be found [here](build_docker.md).
|
||||||
|
|
||||||
|
- [__Before you begin__](#before-you-begin)
|
||||||
|
- [__System Requirements__](#system-requirements)
|
||||||
|
- [__Software requirements__](#software-requirements)
|
||||||
|
- [__Building the images__](#building-the-images)
|
||||||
|
- [__Next Steps: Packages__](#next-steps-packages)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Before you begin
|
||||||
|
|
||||||
|
##### System Requirements
|
||||||
|
|
||||||
|
You will need to meet the following system requirements:
|
||||||
|
|
||||||
|
- 64-bit version of Docker is Ubuntu 16.04+
|
||||||
|
- Minimum 8GB of RAM
|
||||||
|
- Minimum 600GB available disk space for the initial container build process
|
||||||
|
|
||||||
|
##### Software requirements
|
||||||
|
|
||||||
|
__Docker:__
|
||||||
|
|
||||||
|
Install Docker by following the installation instructions [here](https://docs.docker.com/engine/install/).
|
||||||
|
|
||||||
|
__Python__:
|
||||||
|
|
||||||
|
You will need to have Python 3.6 or higher installed and properly set in your system Path. For installation instructions and Python documentation, check [here](https://www.python.org/downloads/).
|
||||||
|
|
||||||
|
__ue4-docker:__
|
||||||
|
|
||||||
|
_ue4-docker_ is a Python package that contains Dockerfiles and build infrastructure to facilitate the building of Docker images for Unreal Engine 4. You can find more information and documentation [here](https://docs.adamrehn.com/ue4-docker/read-these-first/introduction-to-ue4-docker).
|
||||||
|
|
||||||
|
To install _ue4-docker_, run the following command:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
pip3 install ue4-docker
|
||||||
|
```
|
||||||
|
|
||||||
|
Access to port 9876 is required during the build of the Unreal Engine image. If the host system is running an active firewall that blocks that port, you can run the following command to automatically configure access:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
ue4-docker setup
|
||||||
|
```
|
||||||
|
|
||||||
|
__CARLA:__
|
||||||
|
|
||||||
|
The Dockerfiles and tools needed to build Unreal Engine for CARLA and CARLA itself are located in the `Util/Docker` directory of the CARLA source repository.
|
||||||
|
|
||||||
|
If you don't already have it, download the repository using the following command:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
git clone https://github.com/carla-simulator/carla
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Building the images
|
||||||
|
|
||||||
|
The following steps will each take a long time.
|
||||||
|
|
||||||
|
__1. Build Unreal Engine.__
|
||||||
|
|
||||||
|
Run the following command to create a Docker image containing a compiled version of Unreal Engine 4.24.3. Change the version if needed:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
cd Util/Docker
|
||||||
|
|
||||||
|
ue4-docker build 4.24.3 --no-engine --no-minimal
|
||||||
|
```
|
||||||
|
|
||||||
|
__2. Build the CARLA prerequisites image.__
|
||||||
|
|
||||||
|
The following command will build an image called `carla-prerequisites` using `Prerequisites.Dockerfile`:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
docker build -t carla-prerequisites -f Prerequisites.Dockerfile .
|
||||||
|
```
|
||||||
|
|
||||||
|
__3. Build the final CARLA image.__
|
||||||
|
|
||||||
|
The following command will use the image created in the previous step to build the final CARLA image based on the current master branch (latest release) of the CARLA repository:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
docker build -t carla -f Carla.Dockerfile .
|
||||||
|
```
|
||||||
|
|
||||||
|
If you would like to build a specific branch or tag of the CARLA repository, run the following command:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
docker build -t carla -f Carla.Dockerfile . --build-arg GIT_BRANCH=<branch_or_tag_name>
|
||||||
|
```
|
||||||
|
|
||||||
|
__4. Clean up intermediate build images.__
|
||||||
|
|
||||||
|
Run the following command to remove intermediate images left over from the Unreal Engine build process:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
ue4-docker clean
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Next Steps: Packages
|
||||||
|
|
||||||
|
The CARLA image created in this guide is used to create standalone CARLA packages or to package assets such as maps or meshes so they can be used in a CARLA package. This is achieved through the use of the `docker_tools.py` script found in `Util/Docker`. This script uses [`docker-py`](https://github.com/docker/docker-py) to work with the Docker image.
|
||||||
|
|
||||||
|
The `docker_tools.py` script can be used to:
|
||||||
|
|
||||||
|
- __Create a CARLA package__: Find the tutorial [here](tuto_A_create_standalone.md#export-a-package-using-docker)
|
||||||
|
- __Cook assets to be consumed in a CARLA package:__ Find the tutorial [here](tuto_A_add_props.md#ingestion-in-a-carla-package)
|
||||||
|
- __Prepare a map so it's ready for use in a CARLA package:__ Find the tutorial [here](tuto_M_add_map_package.md)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
Any issues or doubts related with this topic can be posted in the CARLA forum.
|
||||||
|
|
||||||
|
<div class="build-buttons">
|
||||||
|
<p>
|
||||||
|
<a href="https://github.com/carla-simulator/carla/discussions/" target="_blank" class="btn btn-neutral" title="Go to the CARLA forum">
|
||||||
|
CARLA forum</a>
|
||||||
|
</p>
|
||||||
|
</div>
|
|
@ -2,11 +2,12 @@
|
||||||
|
|
||||||
It is a common practice in CARLA to manage assets with standalone packages. Keeping them aside allows to reduce the size of the build. These asset packages can be easily imported into a CARLA package anytime. They also become really useful to easily distribute assets in an organized way.
|
It is a common practice in CARLA to manage assets with standalone packages. Keeping them aside allows to reduce the size of the build. These asset packages can be easily imported into a CARLA package anytime. They also become really useful to easily distribute assets in an organized way.
|
||||||
|
|
||||||
* [__Export a package from the UE4 Editor__](#export-a-package-from-the-ue4-editor)
|
- [__Export a package from the UE4 Editor__](#export-a-package-from-the-ue4-editor)
|
||||||
* [__Import assets into a CARLA package__](#import-assets-into-a-carla-package)
|
- [__Export a package using Docker__](#export-a-package-using-docker)
|
||||||
|
- [__Import assets into a CARLA package__](#import-assets-into-a-carla-package)
|
||||||
|
|
||||||
---
|
---
|
||||||
## Export a package from the UE4 Editor
|
## Export a package in a CARLA build from source
|
||||||
|
|
||||||
Once assets are imported into Unreal, users can generate a __standalone package__ for them. This will be used to distribute the content to CARLA packages such as 0.9.8.
|
Once assets are imported into Unreal, users can generate a __standalone package__ for them. This will be used to distribute the content to CARLA packages such as 0.9.8.
|
||||||
|
|
||||||
|
@ -18,8 +19,26 @@ make package ARGS="--packages=Package1,Package2"
|
||||||
|
|
||||||
This will create a standalone package compressed in a `.tar.gz` file for each of the packages listed. The files will be saved in `Dist` folder on Linux, and `/Build/UE4Carla/` on Windows.
|
This will create a standalone package compressed in a `.tar.gz` file for each of the packages listed. The files will be saved in `Dist` folder on Linux, and `/Build/UE4Carla/` on Windows.
|
||||||
|
|
||||||
!!! Note
|
---
|
||||||
As an alternative, the [Docker method](tuto_A_add_map/add_map_package.md) will create the standalone package without the need of having Unreal Engine in the system.
|
|
||||||
|
## Export a package using Docker
|
||||||
|
|
||||||
|
Unreal Engine and CARLA can be built in a Docker image which can then be used to create a package or export assets for use in a package.
|
||||||
|
|
||||||
|
To create the Docker image, follow the tutorial [here](build_docker_unreal.md).
|
||||||
|
|
||||||
|
When you have the image ready:
|
||||||
|
|
||||||
|
1. Navigate to `Util/Docker`.
|
||||||
|
2. Create a CARLA package or prepare assets for use in a package by running one of the following commands:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
# To create a standalone package
|
||||||
|
./docker_tools.py --output /output/path
|
||||||
|
|
||||||
|
#To cook assets to be consumed in a CARLA package
|
||||||
|
./docker_tools.py --input /assets/to/import/path --output /output/path --packages PkgeName1,PkgeName2
|
||||||
|
```
|
||||||
|
|
||||||
---
|
---
|
||||||
## Import assets into a CARLA package
|
## Import assets into a CARLA package
|
||||||
|
|
|
@ -16,7 +16,7 @@ nav:
|
||||||
- 'Windows build': 'build_windows.md'
|
- 'Windows build': 'build_windows.md'
|
||||||
- 'Update CARLA': 'build_update.md'
|
- 'Update CARLA': 'build_update.md'
|
||||||
- 'Build system': 'build_system.md'
|
- 'Build system': 'build_system.md'
|
||||||
- 'Running in a Docker': 'build_docker.md'
|
- 'CARLA in Docker': 'build_docker.md'
|
||||||
- 'F.A.Q.': 'build_faq.md'
|
- 'F.A.Q.': 'build_faq.md'
|
||||||
- First steps:
|
- First steps:
|
||||||
- 'Core concepts': 'core_concepts.md'
|
- 'Core concepts': 'core_concepts.md'
|
||||||
|
@ -56,6 +56,7 @@ nav:
|
||||||
- 'RLlib Integration': "tuto_G_rllib_integration.md"
|
- 'RLlib Integration': "tuto_G_rllib_integration.md"
|
||||||
- 'Scenic': 'tuto_G_scenic.md'
|
- 'Scenic': 'tuto_G_scenic.md'
|
||||||
- 'Chrono Integration': 'tuto_G_chrono.md'
|
- 'Chrono Integration': 'tuto_G_chrono.md'
|
||||||
|
- 'Build Unreal and CARLA in Docker': 'build_docker_unreal.md'
|
||||||
- Tutorials (assets):
|
- Tutorials (assets):
|
||||||
- 'Add a new map': 'tuto_A_add_map_overview.md'
|
- 'Add a new map': 'tuto_A_add_map_overview.md'
|
||||||
- 'Add a new vehicle': 'tuto_A_add_vehicle.md'
|
- 'Add a new vehicle': 'tuto_A_add_vehicle.md'
|
||||||
|
|
Loading…
Reference in New Issue