Principle:CARLA simulator Carla Map Loading
| Knowledge Sources | |
|---|---|
| Domains | Autonomous Driving Simulation, Virtual Environments |
| Last Updated | 2026-02-15 00:00 GMT |
Overview
Map loading is the process of replacing the current virtual environment with a new pre-built road network, static geometry, and associated metadata such as lane markings, traffic signs, and navigation waypoints.
Description
In autonomous driving simulation, a map represents the entire static world: road topology, building geometry, vegetation, terrain, traffic infrastructure, and semantic annotations. Maps are typically pre-authored using tools like RoadRunner and exported in OpenDRIVE format (for road network topology) alongside Unreal Engine assets (for 3D geometry and materials).
Loading a map is a heavyweight operation that:
- Destroys all existing actors in the current world (vehicles, pedestrians, sensors, traffic lights).
- Unloads the current level from GPU and CPU memory.
- Loads the new level including all static meshes, materials, textures, and collision geometry.
- Initializes the road network by parsing the OpenDRIVE definition embedded in the map.
- Resets simulation settings to defaults (optionally, controlled by a flag).
Because map loading is destructive and expensive (often taking several seconds), it is typically performed once at the beginning of a simulation session or between evaluation episodes.
Map layers allow selective loading of geometry categories (buildings, vegetation, street furniture, etc.) to reduce memory usage and loading time when certain visual elements are unnecessary.
Usage
Use map loading when you need to:
- Switch environments -- Move between urban, suburban, highway, or rural test scenarios.
- Reset episodes -- Reload the same map to get a clean world state between training episodes.
- Benchmark across maps -- Evaluate driving algorithms on diverse road topologies.
- Reduce memory footprint -- Load only the map layers needed for a particular test (e.g., roads only, without buildings).
Theoretical Basis
Map structure:
Map
+-- OpenDRIVE definition (road topology, lanes, junctions)
| +-- Roads
| | +-- Lanes (driving, shoulder, sidewalk, etc.)
| | +-- Traffic signs and signals
| +-- Junctions (intersections)
+-- Unreal Engine level (3D geometry)
+-- Static meshes (buildings, props, terrain)
+-- Materials and textures
+-- Collision volumes
Map layer bitmask:
Map layers are represented as a bitmask allowing selective loading:
| Layer | Content | Use Case |
|---|---|---|
| All | Everything | Full visual fidelity |
| Buildings | Building geometry | Urban scenarios |
| Decals | Road markings, stains | Lane detection testing |
| Foliage | Trees, bushes, grass | Perception testing |
| Ground | Terrain mesh | Always needed |
| ParkedVehicles | Static parked cars | Parking scenarios |
| Particles | Weather particles | Rain/fog testing |
| Props | Street furniture, barriers | Obstacle detection |
| StreetLights | Light poles and fixtures | Night driving |
| Walls | Fences, walls, guardrails | Boundary detection |
Loading state machine:
[Current World] --(load_world)--> [Destroying Actors]
|
[Unloading Level]
|
[Loading New Level]
|
[Parsing OpenDRIVE]
|
[Initializing World] --> [New World Ready]
Settings reset behavior: By default, loading a new map resets all world settings to their defaults (asynchronous mode, variable time step, rendering enabled). This prevents stale configuration from a previous session from affecting the new map. The reset can be suppressed when the caller intends to immediately reapply custom settings.