Heuristic:CARLA simulator Carla Synchronous Mode Fixed Delta
| Knowledge Sources | |
|---|---|
| Domains | Simulation, Debugging |
| Last Updated | 2026-02-15 07:00 GMT |
Overview
Always set `fixed_delta_seconds` when enabling synchronous mode to ensure deterministic, reproducible simulation behavior.
Description
When running CARLA in synchronous mode (`synchronous_mode = True`), the simulation advances one tick per explicit `world.tick()` call from the client. If `fixed_delta_seconds` is not set, the simulation will use variable time steps, leading to non-deterministic behavior where physics, sensor timing, and actor movements vary between runs. The CARLA C++ runtime explicitly warns about this misconfiguration. Additionally, if substepping is enabled, the number of max substeps must be between 1 and 16 (inclusive).
Usage
Use this heuristic whenever enabling synchronous mode, which is required for:
- Deterministic sensor data collection (Workflow 4: Sensor Data Collection)
- Reproducible traffic generation (Workflow 2: Traffic Generation)
- Reliable simulation recording (Workflow 5: Recording and Replay)
- Any scenario requiring frame-accurate coordination between client and server
The Insight (Rule of Thumb)
- Action: Always set `settings.fixed_delta_seconds` when `settings.synchronous_mode = True`.
- Value: Common values are `0.05` (20 FPS, used in generate_traffic.py:131) or `0.2` (5 FPS, used in sensor_synchronization.py:53). The local planner defaults to `1.0/20.0 = 0.05` (local_planner.py:78).
- Trade-off: Smaller delta seconds = more accurate physics but slower throughput. Larger delta seconds = faster but coarser simulation.
- Substepping: If `settings.substepping = True`, keep `max_substeps` between 1 and 16 and ensure `max_substep_delta_time * max_substeps >= fixed_delta_seconds`.
Reasoning
The CARLA simulator server uses the delta time to advance physics, sensor triggers, and traffic logic. Without a fixed delta, each tick may have a different duration based on server processing time, making simulations non-reproducible. The C++ runtime in Simulator.cpp:256-259 checks for this and logs a warning. Additionally, the Traffic Manager must also be set to synchronous mode (`traffic_manager.set_synchronous_mode(True)`) to stay in sync with the world tick, as demonstrated in generate_traffic.py:127.
// LibCarla/source/carla/client/detail/Simulator.cpp:255-265
if (settings.synchronous_mode && !settings.fixed_delta_seconds) {
log_warning(
"synchronous mode enabled with variable delta seconds. It is highly "
"recommended to set 'fixed_delta_seconds' when running on synchronous mode.");
}
else if (settings.synchronous_mode && settings.substepping) {
if(settings.max_substeps < 1 || settings.max_substeps > 16) {
log_warning(
"synchronous mode and substepping are enabled but the number of substeps is not valid. "
# PythonAPI/examples/generate_traffic.py:126-131
if not args.asynch:
traffic_manager.set_synchronous_mode(True)
if not settings.synchronous_mode:
synchronous_master = True
settings.synchronous_mode = True
settings.fixed_delta_seconds = 0.05