Implementation:CARLA simulator Carla Signal
Appearance
| Knowledge Sources | |
|---|---|
| Domains | Road Network, Traffic Signals |
| Last Updated | 2026-02-15 05:00 GMT |
Overview
The Signal class represents a traffic signal or sign in the OpenDRIVE road network, storing its position, orientation, type, dimensions, and associated controllers.
Description
carla::road::Signal is a MovableNonCopyable class modeling an OpenDRIVE signal element with properties:
- Position -- road ID, s-coordinate, t-offset (lateral), z-offset, horizontal offset, pitch, and roll
- Identity -- signal ID, name, country code, type, subtype, and text
- Orientation -- encoded as "+", "-", or both, mapped to the
SignalOrientationenum (Positive, Negative, Both) - Dynamic flag -- whether the signal changes state (parsed from "yes"/"no" string)
- Dimensions -- height, width, and a numeric value (e.g., speed limit value)
- Dependencies -- a vector of
SignalDependencyobjects linking to other signals - Transform -- a
geom::Transformfor the signal's 3D world position - Controllers -- a set of
ContIdreferences
Usage
Use this class to query traffic signal properties when processing signal references along a route, implementing traffic light logic, or placing signal assets in the 3D world.
Code Reference
Source Location
- Repository: CARLA
- File:
LibCarla/source/carla/road/Signal.h
Signature
enum SignalOrientation { Positive, Negative, Both };
struct SignalDependency {
std::string _dependency_id;
std::string _type;
};
class Signal : private MovableNonCopyable {
public:
Signal(RoadId road_id, SignId signal_id, double s, double t,
std::string name, std::string dynamic, std::string orientation,
double zOffset, std::string country, std::string type,
std::string subtype, double value, std::string unit,
double height, double width, std::string text,
double hOffset, double pitch, double roll);
RoadId GetRoadId() const;
const SignId &GetSignalId() const;
double GetS() const;
double GetT() const;
bool GetDynamic() const;
const std::string &GetName() const;
SignalOrientation GetOrientation() const;
double GetZOffset() const;
const std::string &GetCountry() const;
const std::string &GetType() const;
const std::string &GetSubtype() const;
double GetValue() const;
double GetHeight() const;
double GetWidth() const;
const geom::Transform &GetTransform() const;
const std::set<ContId> &GetControllers() const;
};
Import
#include "carla/road/Signal.h"
I/O Contract
| Input | Type | Description |
|---|---|---|
| Various | All signal attributes from OpenDRIVE XML |
| Output | Type | Description |
|---|---|---|
| Various getters | Signal type, position, orientation, dimensions | ||
geom::Transform | 3D world position and rotation
|
Usage Examples
const auto &signals = map_data.GetSignals();
for (const auto &[id, signal] : signals) {
if (signal->GetDynamic()) {
auto type = signal->GetType();
auto transform = signal->GetTransform();
}
}
Related Pages
Page Connections
Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment