Implementation:CARLA simulator Carla Actor API Spec
| Knowledge Sources | |
|---|---|
| Domains | Simulation, Autonomous Driving, API Specification |
| Last Updated | 2026-02-15 05:00 GMT |
Overview
YML specification file that defines the carla.Actor class API, including all instance variables, methods, and documentation for the base actor type in the CARLA Python API.
Description
This YML file serves as the canonical API specification for the Actor class within the CARLA simulator's Python API. Actors are defined as anything that plays a role in the simulation or can be moved around, including pedestrians, vehicles, sensors, and traffic signs. The specification documents instance variables such as attributes, id, type_id, is_alive, is_active, is_dormant, parent, semantic_tags, actor_state, and bounding_box. It also defines methods for physics manipulation (add_angular_impulse, add_force, add_impulse, add_torque), lifecycle management (destroy), velocity control (enable_constant_velocity, disable_constant_velocity), and state queries (get_acceleration, get_transform, get_velocity). This file is consumed by the documentation generator (doc_gen.py) to produce the official CARLA Python API reference documentation.
Usage
Use this specification when referencing or extending the Actor class API. It is consumed by the doc_gen.py script to auto-generate Markdown documentation. Developers maintaining or extending the CARLA Python API should update this file when adding or modifying Actor-level methods or properties.
Code Reference
Source Location
- Repository: CARLA
- File: PythonAPI/docs/actor.yml
Signature
- module_name: carla
classes:
- class_name: Actor
instance_variables:
- var_name: attributes # type: dict
- var_name: id # type: int
- var_name: type_id # type: str
- var_name: is_alive # type: bool
- var_name: is_active # type: bool
- var_name: is_dormant # type: bool
- var_name: parent # type: carla.Actor
- var_name: semantic_tags # type: list(int)
- var_name: actor_state # type: carla.ActorState
- var_name: bounding_box # type: carla.BoundingBox
methods:
- def_name: add_angular_impulse
- def_name: add_force
- def_name: add_impulse
- def_name: add_torque
- def_name: destroy
- def_name: disable_constant_velocity
- def_name: enable_constant_velocity
- def_name: get_acceleration
Import
# This YML file is consumed by the doc generator:
python doc_gen.py
# The Actor class is used via the carla module:
import carla
actor = world.spawn_actor(blueprint, transform)
I/O Contract
| Field | Type | Description |
|---|---|---|
| module_name | string | Module namespace (carla) |
| classes | list | List of class definitions |
| class_name | string | Name of the class (Actor) |
| instance_variables | list | Properties exposed on the class |
| methods | list | Methods available on the class |
| def_name | string | Method name |
| params | list | Method parameters with type and doc |
| return | string | Return type of the method |
Usage Examples
import carla
client = carla.Client('localhost', 2000)
world = client.get_world()
# Spawn an actor
blueprint = world.get_blueprint_library().find('vehicle.tesla.model3')
spawn_point = world.get_map().get_spawn_points()[0]
vehicle = world.spawn_actor(blueprint, spawn_point)
# Use Actor properties
print(vehicle.id)
print(vehicle.type_id)
print(vehicle.is_alive)
# Apply physics
vehicle.add_force(carla.Vector3D(1000, 0, 0))
vehicle.enable_constant_velocity(carla.Vector3D(10, 0, 0))
# Cleanup
vehicle.destroy()