Implementation:CARLA simulator Carla ObjectLabel
| Knowledge Sources | |
|---|---|
| Domains | Semantic Segmentation, RPC Serialization |
| Last Updated | 2026-02-15 05:00 GMT |
Overview
ObjectLabel.h defines the CityObjectLabel enumeration, which assigns semantic segmentation labels to objects in the CARLA simulation for use by semantic cameras and object queries.
Description
Defined in the carla::rpc namespace as a uint8_t-backed enum class, CityObjectLabel provides 30 distinct labels following the CityScapes labeling convention plus CARLA-specific extensions. Standard CityScapes labels include Roads (1), Sidewalks (2), Buildings (3), Vegetation (9), Pedestrians (12), Car (14), Truck (15), Bus (16), etc. CARLA-specific labels include Static (20), Dynamic (21), Water (23), RoadLines (24), Ground (25), Bridge (26), RailTrack (27), GuardRail (28), and Rock (29). The special value Any (0xFF) matches all labels. The enum is registered with MsgPack via MSGPACK_ADD_ENUM.
Usage
Use this enumeration when filtering objects by semantic label in the simulation, configuring semantic segmentation cameras, or querying object types from the environment.
Code Reference
Source Location
- Repository: CARLA
- File:
LibCarla/source/carla/rpc/ObjectLabel.h
Signature
namespace carla {
namespace rpc {
enum class CityObjectLabel : uint8_t {
None = 0u,
Roads = 1u, Sidewalks = 2u,
Buildings = 3u, Walls = 4u,
Fences = 5u, Poles = 6u,
TrafficLight = 7u, TrafficSigns = 8u,
Vegetation = 9u, Terrain = 10u,
Sky = 11u, Pedestrians = 12u,
Rider = 13u, Car = 14u,
Truck = 15u, Bus = 16u,
Train = 17u, Motorcycle = 18u,
Bicycle = 19u,
// CARLA custom
Static = 20u, Dynamic = 21u,
Other = 22u, Water = 23u,
RoadLines = 24u, Ground = 25u,
Bridge = 26u, RailTrack = 27u,
GuardRail = 28u, Rock = 29u,
Any = 0xFF
};
} // namespace rpc
} // namespace carla
MSGPACK_ADD_ENUM(carla::rpc::CityObjectLabel);
Import
#include "carla/rpc/ObjectLabel.h"
I/O Contract
| Label | Value | Category |
|---|---|---|
| None | 0 | Default / unassigned |
| Roads | 1 | CityScapes road surface |
| Sidewalks | 2 | CityScapes sidewalk |
| Car | 14 | CityScapes vehicle |
| Pedestrians | 12 | CityScapes pedestrian |
| Static | 20 | CARLA custom static object |
| Dynamic | 21 | CARLA custom dynamic object |
| Any | 0xFF | Wildcard matching all labels |
Usage Examples
#include "carla/rpc/ObjectLabel.h"
using Label = carla::rpc::CityObjectLabel;
// Filter for vehicles only
if (object_label == Label::Car ||
object_label == Label::Truck ||
object_label == Label::Bus) {
// Handle vehicle object
}