Traffic Lights

class py123d.datatypes.detections.TrafficLightDetectionWrapper[source]

The TrafficLightDetectionWrapper 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 is used in to read and write traffic light detections from/to logs.

Public Data Attributes:

traffic_light_detections

List of individual TrafficLightDetection.

Public Methods:

get_detection_by_lane_id(lane_id)

Retrieve a traffic light detection by its lane id.


property traffic_light_detections: List[TrafficLightDetection]

List of individual TrafficLightDetection.

get_detection_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.detections.TrafficLightDetection[source]

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

Public Data Attributes:

lane_id

The lane id associated with the traffic light detection.

status

The TrafficLightStatus of the traffic light detection.

timepoint

The optional TimePoint 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.

property timepoint: TimePoint | None

The optional TimePoint of the traffic light detection.

class py123d.datatypes.detections.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.