Traffic Lights

class py123d.datatypes.TrafficLightDetections[source]

The TrafficLightDetections is a container for multiple traffic light detections. It provides methods to access individual detections as well as to retrieve a detection by lane id. The wrapper is used to read and write traffic light detections from/to logs.

Public Data Attributes:

detections

List of individual TrafficLightDetection.

timestamp

The Timestamp of the traffic light detections.

metadata

The metadata for the traffic light detections.

Inherited from BaseModality

timestamp

Returns the timestamp associated with this modality data, if available.

metadata

Returns the metadata associated with this modality data.

modality_type

Convenience property to access the modality type directly from the modality data.

modality_id

Convenience property to access the modality id directly from the modality data.

modality_key

Convenience property to access the modality key directly from the modality data.

Public Methods:

get_by_lane_id(lane_id)

Retrieve a traffic light detection by its lane id.


property detections: List[TrafficLightDetection]

List of individual TrafficLightDetection.

property timestamp: Timestamp

The Timestamp of the traffic light detections.

property metadata: TrafficLightDetectionsMetadata

The metadata for the traffic light detections.

property modality_id: str | SerialIntEnum | None

Convenience property to access the modality id directly from the modality data.

property modality_key: str

Convenience property to access the modality key directly from the modality data.

property modality_type: ModalityType

Convenience property to access the modality type directly from the modality data.

get_by_lane_id(lane_id)[source]

Retrieve a traffic light detection by its lane id.

Parameters:

lane_id (int) – The lane id to search for.

Return type:

Optional[TrafficLightDetection]

Returns:

The traffic light detection for the given lane id, or None if not found.

class py123d.datatypes.TrafficLightDetection[source]

Single traffic light detection of a lane, that includes the lane id and status (green, yellow, red, off, unknown).

Public Data Attributes:

lane_id

The lane id associated with the traffic light detection.

status

The TrafficLightStatus of the traffic light detection.


property lane_id: int

The lane id associated with the traffic light detection.

property status: TrafficLightStatus

The TrafficLightStatus of the traffic light detection.

class py123d.datatypes.TrafficLightStatus[source]

Enum for that represents the status of a traffic light.

GREEN = 0

Green light is on.

YELLOW = 1

Yellow light is on.

RED = 2

Red light is on.

OFF = 3

Traffic light is off.

UNKNOWN = 4

Traffic light status is unknown.