Implementation:CARLA simulator Carla SignalType
| Knowledge Sources | |
|---|---|
| Domains | Road Network, Traffic Signals |
| Last Updated | 2026-02-15 05:00 GMT |
Overview
The SignalType class provides static methods that return OpenDRIVE 1.5M signal type codes following the German traffic sign catalog (country code 6.10), and a utility to detect traffic light types.
Description
carla::road::SignalType is a utility class with static methods returning string type codes for 33 traffic sign categories, including:
- Warning signs -- Danger ("101"), LanesMerging ("121"), CautionPedestrian ("133"), CautionBicycle ("138"), LevelCrossing ("150")
- Regulatory signs -- YieldSign ("205"), StopSign ("206"), MandatoryTurnDirection ("209"), AccessForbidden ("250"), MaximumSpeed ("274")
- Informational signs -- HasWayNextIntersection ("301"), PriorityWay ("306"), CityBegin ("310"), Highway ("330"), DeadEnd ("357")
- Advisory signs -- RecomendedSpeed ("380"), RecomendedSpeedEnd ("381")
The IsTrafficLight() method checks if a given type string corresponds to a traffic light by comparing against a known list of 19 traffic light type codes (e.g., "1000001", "1000002", "F", "W", "A").
Usage
Use this class to classify signals parsed from OpenDRIVE data, particularly to distinguish traffic lights from other signal types for traffic light response logic.
Code Reference
Source Location
- Repository: CARLA
- Files:
LibCarla/source/carla/road/SignalType.h,LibCarla/source/carla/road/SignalType.cpp
Signature
class SignalType {
public:
static const std::string Danger();
static const std::string LanesMerging();
static const std::string StopSign();
static const std::string YieldSign();
static const std::string MaximumSpeed();
static const std::string AccessForbidden();
// ... 28 more static methods
static bool IsTrafficLight(const std::string &type);
};
Import
#include "carla/road/SignalType.h"
I/O Contract
| Input | Type | Description |
|---|---|---|
const std::string & | Signal type string from OpenDRIVE
|
| Output | Type | Description |
|---|---|---|
std::string | Numeric type code string (e.g., "206" for stop sign)
| ||
bool | Whether the type string denotes a traffic light
|
Usage Examples
// Check if a signal is a traffic light
if (SignalType::IsTrafficLight(signal->GetType())) {
// Handle traffic light logic
}
// Compare signal type against known types
if (signal->GetType() == SignalType::StopSign()) {
// Handle stop sign
}