Configuring the simulation

Before you start running your own experiments there are few details to take into account at the time of configuring your simulation. In this document we cover the most important ones.

Fixed time-step

The time-step is the simulation-time elapsed between two steps of the simulation. In video-games, this simulation-time is almost always adjusted to real time for better realism. This is achieved by having a variable time-step that adjusts the simulation to keep up with real-time. In simulations however, it is better to detach the simulation-time from real-time, and let the simulation run as fast as possible using a fixed time-step. Doing so, we are not only able to simulate longer periods in less time, but also gain repeatability by reducing the float-point arithmetic errors that a variable time-step introduces.

CARLA can be run in both modes.

Variable time-step

The simulation tries to keep up with real-time. To do so, the time-step is slightly adjusted each update. Simulations are not repeatable. By default, the simulator starts in this mode

Fixed time-step

The simulation runs as fast as possible, simulating the same time increment on each step. To run the simulator this way you need to pass two parameters in the command-line, one to enable the fixed time-step mode, and the second to specify the FPS of the simulation (i.e. the inverse of the time step). For instance, to run the simulation at a fixed time-step of 0.1 seconds we execute

$ ./CarlaUE4.sh -benchmark -fps=10

It is important to note that this mode can only be enabled when launching the simulator since this is actually a feature of Unreal Engine.

Important

Do not decrease the frame-rate below 10 FPS.
Our settings are adjusted to clamp the physics engine to a minimum of 10 FPS. If the game tick falls below this, the physics engine will still simulate 10 FPS. In that case, things dependent on the game's delta time are no longer in sync with the physics engine. Ref. #695

Changing the map

The map can be selected by passing the path to the map as first argument when launching the simulator

# Linux
./CarlaUE4.sh /Game/Carla/Maps/Town01
rem Windows
CarlaUE4.exe /Game/Carla/Maps/Town01

The path "/Game/" maps to the Content folder of our repository in "Unreal/CarlaUE4/Content/".

Running off-screen

In Linux, you can force the simulator to run off-screen by setting the environment variable DISPLAY to empty

# Linux
DISPLAY= ./CarlaUE4.sh

This launches the simulator without simulator window, of course you can still connect to it normally and run the example scripts. Note that with this method, in multi-GPU environments, it's not possible to select the GPU that the simulator will use for rendering. To do so, follow the instruction in Running without display and selecting GPUs.

Other command-line options

  • -carla-port=N Listen for client connections at port N, streaming port is set to N+1.
  • -quality-level={Low,Epic} Change graphics quality level, "Low" mode runs significantly faster.
  • Full list of UE4 command-line arguments.