Implementation:CARLA simulator Carla Blueprint 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 blueprint-related classes (ActorAttributeType, Color, FloatColor, ActorAttribute, ActorBlueprint, BlueprintLibrary) in the CARLA Python API.
Description
This YML file provides the canonical API specification for blueprint-related classes used to configure and spawn actors in CARLA. It defines ActorAttributeType (an enum with Bool, Int, Float, String, RGBColor), Color (a 32-bit RGBA color class with r, g, b, a components), FloatColor (a floating-point RGBA color class), ActorAttribute, ActorBlueprint, and BlueprintLibrary. The Color class provides constructors, equality operators, and string conversion. These classes form the foundation for selecting actor blueprints, configuring their attributes, and spawning them into the simulation world.
Usage
Use this specification when working with CARLA blueprint libraries, configuring actor attributes before spawning, or extending the blueprint system. It is consumed by doc_gen.py to produce API reference documentation.
Code Reference
Source Location
- Repository: CARLA
- File: PythonAPI/docs/blueprint.yml
Signature
- module_name: carla
classes:
- class_name: ActorAttributeType
instance_variables:
- var_name: Bool
- var_name: Int
- var_name: Float
- var_name: String
- var_name: RGBColor
- class_name: Color
instance_variables:
- var_name: r # type: int (0-255)
- var_name: g # type: int (0-255)
- var_name: b # type: int (0-255)
- var_name: a # type: int (0-255)
methods:
- def_name: __init__
- def_name: __eq__
- def_name: __ne__
- def_name: __str__
- class_name: FloatColor
instance_variables:
- var_name: r # type: float
- var_name: g # type: float
- var_name: b # type: float
- var_name: a # type: float
Import
import carla
color = carla.Color(255, 0, 0, 255)
blueprint_library = world.get_blueprint_library()
I/O Contract
| Field | Type | Description |
|---|---|---|
| module_name | string | Module namespace (carla) |
| classes | list | Blueprint-related class definitions |
| ActorAttributeType | enum | Attribute type enum (Bool, Int, Float, String, RGBColor) |
| Color | class | 32-bit RGBA color (0-255 per channel) |
| FloatColor | class | Floating-point RGBA color |
Usage Examples
import carla
client = carla.Client('localhost', 2000)
world = client.get_world()
# Access blueprint library
bp_lib = world.get_blueprint_library()
vehicle_bps = bp_lib.filter('vehicle.*')
# Select and configure a blueprint
bp = bp_lib.find('vehicle.tesla.model3')
bp.set_attribute('color', '255,0,0')
# Use Color class
red = carla.Color(255, 0, 0)
float_red = carla.FloatColor(1.0, 0.0, 0.0)