Implementation:CARLA simulator Carla RPC Actor
| Knowledge Sources | |
|---|---|
| Domains | Actor System, RPC Serialization |
| Last Updated | 2026-02-15 05:00 GMT |
Overview
Actor is an RPC-serializable class that represents a simulation actor with its identity, description, bounding box, semantic tags, and optional sensor streaming token.
Description
Defined in the carla::rpc namespace, this class holds the essential data for any actor in the CARLA simulation. It contains an ActorId (id and parent_id), an ActorDescription with the blueprint information, a geom::BoundingBox for spatial extents, a vector of semantic_tags for semantic segmentation labeling, and an optional stream_token for sensor data streaming. The HasAStream method checks whether the actor has an associated streaming token (used by sensors), and GetStreamToken retrieves it. Serialized via MSGPACK_DEFINE_ARRAY.
Usage
This type is the primary representation of actors transmitted between the CARLA server and client. It is returned by actor spawn and query operations.
Code Reference
Source Location
- Repository: CARLA
- File:
LibCarla/source/carla/rpc/Actor.h
Signature
namespace carla {
namespace rpc {
class Actor {
public:
Actor() = default;
ActorId id = 0u;
ActorId parent_id = 0u;
ActorDescription description;
geom::BoundingBox bounding_box;
std::vector<uint8_t> semantic_tags;
std::vector<unsigned char> stream_token;
bool HasAStream() const;
streaming::Token GetStreamToken() const;
MSGPACK_DEFINE_ARRAY(id, parent_id, description,
bounding_box, semantic_tags, stream_token);
};
} // namespace rpc
} // namespace carla
Import
#include "carla/rpc/Actor.h"
I/O Contract
| Field | Type | Default | Description |
|---|---|---|---|
| id | ActorId |
0 | Unique identifier for this actor |
| parent_id | ActorId |
0 | Parent actor ID (0 if no parent) |
| description | ActorDescription |
default | Blueprint description of the actor |
| bounding_box | geom::BoundingBox |
default | Spatial bounding box |
| semantic_tags | std::vector<uint8_t> |
empty | Semantic segmentation labels |
| stream_token | std::vector<unsigned char> |
empty | Sensor streaming token data |
Usage Examples
#include "carla/rpc/Actor.h"
carla::rpc::Actor actor;
// Populated by server after spawning
if (actor.HasAStream()) {
auto token = actor.GetStreamToken();
// Subscribe to sensor data stream using token
}