Implementation:CARLA simulator Carla BlueprintLibrary Find For Sensors
| Knowledge Sources | |
|---|---|
| Domains | Simulation, Perception |
| Last Updated | 2026-02-15 00:00 GMT |
Overview
Concrete tool for locating sensor blueprints by ID and configuring their attributes provided by the CARLA simulator.
Description
BlueprintLibrary.find() retrieves a specific ActorBlueprint by its string identifier from the world's blueprint library. For sensor data collection, this is used to obtain blueprints for camera, LiDAR, radar, GNSS, and IMU sensors. Once retrieved, ActorBlueprint.set_attribute() modifies the sensor's configuration parameters such as image resolution, field of view, number of LiDAR channels, and noise characteristics. All attribute values are passed as strings regardless of their underlying type.
Usage
These methods are used together when setting up a sensor data collection rig. First, find() retrieves the blueprint for the desired sensor type, then set_attribute() is called one or more times to configure its parameters before passing the blueprint to World.spawn_actor().
Code Reference
Source Location
- Repository: CARLA
- File:
LibCarla/source/carla/client/BlueprintLibrary.h(L48),PythonAPI/carla/src/Blueprint.cpp(L105-113) - Lines: L48 (find), L105-113 (set_attribute)
Signature
BlueprintLibrary.find(id: str) -> carla.ActorBlueprint
ActorBlueprint.set_attribute(key: str, value: str) -> None
Import
import carla
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| id | str | Yes | Hierarchical sensor blueprint identifier (e.g., sensor.camera.rgb, sensor.lidar.ray_cast, sensor.other.radar, sensor.other.gnss, sensor.other.imu). |
| key | str | Yes | Attribute name to configure (e.g., image_size_x, fov, channels, range). |
| value | str | Yes | Attribute value as a string. Numeric values are converted internally (e.g., "1920", "90.0", "64"). |
Outputs
| Name | Type | Description |
|---|---|---|
| blueprint | carla.ActorBlueprint | The retrieved sensor blueprint, ready for attribute configuration and spawning. find() raises RuntimeError if the ID is not found. |
| (none) | None | set_attribute() modifies the blueprint in place and returns None. |
Usage Examples
Basic Example
import carla
client = carla.Client('localhost', 2000)
client.set_timeout(10.0)
world = client.get_world()
blueprint_library = world.get_blueprint_library()
# Configure an RGB camera sensor
camera_bp = blueprint_library.find('sensor.camera.rgb')
camera_bp.set_attribute('image_size_x', '1920')
camera_bp.set_attribute('image_size_y', '1080')
camera_bp.set_attribute('fov', '90')
camera_bp.set_attribute('sensor_tick', '0.05') # 20 Hz
Multi-Sensor Suite Configuration
import carla
client = carla.Client('localhost', 2000)
client.set_timeout(10.0)
world = client.get_world()
bp_lib = world.get_blueprint_library()
# --- RGB Camera ---
rgb_bp = bp_lib.find('sensor.camera.rgb')
rgb_bp.set_attribute('image_size_x', '1920')
rgb_bp.set_attribute('image_size_y', '1080')
rgb_bp.set_attribute('fov', '110')
# --- Depth Camera ---
depth_bp = bp_lib.find('sensor.camera.depth')
depth_bp.set_attribute('image_size_x', '1920')
depth_bp.set_attribute('image_size_y', '1080')
depth_bp.set_attribute('fov', '110')
# --- Semantic Segmentation Camera ---
seg_bp = bp_lib.find('sensor.camera.semantic_segmentation')
seg_bp.set_attribute('image_size_x', '1920')
seg_bp.set_attribute('image_size_y', '1080')
seg_bp.set_attribute('fov', '110')
# --- LiDAR ---
lidar_bp = bp_lib.find('sensor.lidar.ray_cast')
lidar_bp.set_attribute('channels', '64')
lidar_bp.set_attribute('range', '100.0')
lidar_bp.set_attribute('points_per_second', '1200000')
lidar_bp.set_attribute('rotation_frequency', '20')
lidar_bp.set_attribute('upper_fov', '15.0')
lidar_bp.set_attribute('lower_fov', '-25.0')
# --- Radar ---
radar_bp = bp_lib.find('sensor.other.radar')
radar_bp.set_attribute('horizontal_fov', '30.0')
radar_bp.set_attribute('vertical_fov', '30.0')
radar_bp.set_attribute('range', '100.0')
# --- GNSS ---
gnss_bp = bp_lib.find('sensor.other.gnss')
gnss_bp.set_attribute('noise_alt_stddev', '0.1')
gnss_bp.set_attribute('noise_lat_stddev', '0.00001')
gnss_bp.set_attribute('noise_lon_stddev', '0.00001')
# --- IMU ---
imu_bp = bp_lib.find('sensor.other.imu')
imu_bp.set_attribute('noise_accel_stddev_x', '0.1')
imu_bp.set_attribute('noise_accel_stddev_y', '0.1')
imu_bp.set_attribute('noise_accel_stddev_z', '0.1')
imu_bp.set_attribute('noise_gyro_stddev_x', '0.01')
imu_bp.set_attribute('noise_gyro_stddev_y', '0.01')
imu_bp.set_attribute('noise_gyro_stddev_z', '0.01')