Implementation:CARLA simulator Carla ActorDefinition
| Knowledge Sources | |
|---|---|
| Domains | Actor System, RPC Serialization |
| Last Updated | 2026-02-15 05:00 GMT |
Overview
ActorDefinition is an RPC-serializable class that describes an actor blueprint, including its unique ID, string identifier, tags, and configurable attributes.
Description
Defined in the carla::rpc namespace, this class represents the definition (blueprint) of an actor type available in the CARLA simulation. It contains: a numeric uid (ActorId), a string id (e.g., "vehicle.tesla.model3"), a tags string for categorization, and a vector of ActorAttribute objects describing all configurable parameters. When compiled within UE4, it can be constructed from FActorDefinition, combining both Variations and Attributes into the single attributes vector. Serialized via MSGPACK_DEFINE_ARRAY.
Usage
Use this type to enumerate available actor types from the server and inspect their configurable attributes before spawning.
Code Reference
Source Location
- Repository: CARLA
- File:
LibCarla/source/carla/rpc/ActorDefinition.h
Signature
namespace carla {
namespace rpc {
class ActorDefinition {
public:
ActorDefinition() = default;
ActorId uid = 0u;
std::string id;
std::string tags;
std::vector<ActorAttribute> attributes;
MSGPACK_DEFINE_ARRAY(uid, id, tags, attributes);
};
} // namespace rpc
} // namespace carla
Import
#include "carla/rpc/ActorDefinition.h"
I/O Contract
| Field | Type | Default | Description |
|---|---|---|---|
| uid | ActorId |
0 | Unique numeric identifier for the blueprint |
| id | std::string |
empty | Blueprint string identifier (e.g., "vehicle.tesla.model3") |
| tags | std::string |
empty | Comma-separated categorization tags |
| attributes | std::vector<ActorAttribute> |
empty | Configurable attributes with defaults and recommended values |
Usage Examples
#include "carla/rpc/ActorDefinition.h"
// List available blueprints
auto definitions = client.GetActorDefinitions();
for (const auto &def : definitions) {
std::cout << def.id << " [" << def.tags << "]" << std::endl;
for (const auto &attr : def.attributes) {
std::cout << " " << attr.id << " = " << attr.value << std::endl;
}
}