Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Implementation:CARLA simulator Carla World API Spec

From Leeroopedia
Revision as of 12:15, 16 February 2026 by Admin (talk | contribs) (Auto-imported from implementations/CARLA_simulator_Carla_World_API_Spec.md)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Knowledge Sources
Domains Simulation, Autonomous Driving, API Specification
Last Updated 2026-02-15 05:00 GMT

Overview

YML specification file that defines world-level classes in the CARLA Python API, including Timestamp, ActorList, WorldSettings, World, WorldSnapshot, and DebugHelper.

Description

This YML file specifies the classes that manage the simulation world state in CARLA. Timestamp contains frame count, elapsed_seconds, delta_seconds, and platform_timestamp. ActorList provides access to all actors in the scene with filter(), find(), iteration, and length methods. WorldSettings controls simulation configuration including synchronous_mode, no_rendering_mode, fixed_delta_seconds, substepping, tile_stream_distance, and actor_active_distance. The World class is the central hub providing methods for actor spawning (spawn_actor, try_spawn_actor), retrieving actors, accessing the map, getting/applying settings, weather control, tick/wait_for_tick synchronization, and debug drawing. WorldSnapshot captures the state of all actors at a specific frame.

Usage

Use the World class (obtained via client.get_world()) as the primary interface for interacting with the simulation: spawning actors, configuring settings, retrieving map data, and managing the simulation tick loop.

Code Reference

Source Location

  • Repository: CARLA
  • File: PythonAPI/docs/world.yml

Signature

- module_name: carla
  classes:
  - class_name: Timestamp
    instance_variables:
    - var_name: frame              # type: int
    - var_name: elapsed_seconds    # type: float (seconds)
    - var_name: delta_seconds      # type: float (seconds)
    - var_name: platform_timestamp # type: float (seconds)

  - class_name: ActorList
    methods:
    - def_name: filter(wildcard_pattern)  # return: list
    - def_name: find(actor_id)            # return: carla.Actor
    - def_name: __getitem__(pos)
    - def_name: __iter__
    - def_name: __len__

  - class_name: WorldSettings
    instance_variables:
    - var_name: synchronous_mode       # type: bool
    - var_name: no_rendering_mode      # type: bool
    - var_name: fixed_delta_seconds    # type: float
    - var_name: substepping            # type: bool
    - var_name: tile_stream_distance   # type: float
    - var_name: actor_active_distance  # type: float

Import

import carla
client = carla.Client('localhost', 2000)
world = client.get_world()
settings = world.get_settings()

I/O Contract

Class Key Members Description
Timestamp frame, elapsed_seconds, delta_seconds Simulation time information
ActorList filter(), find(), __len__ Collection of all actors in scene
WorldSettings synchronous_mode, no_rendering_mode, fixed_delta_seconds Simulation configuration
World spawn_actor(), get_actors(), get_map(), tick() Central simulation interface
WorldSnapshot timestamp, find(), has_actor() Frozen state at a specific frame

Usage Examples

import carla

client = carla.Client('localhost', 2000)
world = client.get_world()

# Configure synchronous mode
settings = world.get_settings()
settings.synchronous_mode = True
settings.fixed_delta_seconds = 0.05
world.apply_settings(settings)

# Spawn an actor
bp = world.get_blueprint_library().find('vehicle.tesla.model3')
sp = world.get_map().get_spawn_points()[0]
vehicle = world.spawn_actor(bp, sp)

# Simulation loop
for _ in range(100):
    world.tick()
    snapshot = world.get_snapshot()
    print(f"Frame: {snapshot.timestamp.frame}")

# Get all vehicles
actors = world.get_actors()
vehicles = actors.filter('vehicle.*')
print(f"Total vehicles: {len(vehicles)}")

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment