rodrigoqueiroz / geoscenarioserver

8 stars 1 forks source link

Added traffic light handling for SVs #27

Closed divitsharma closed 3 years ago

divitsharma commented 3 years ago

Handling traffic lights is setup as follows: Traffic lights must be added both to the lanelet map (to define the regulatory element and affected lanelets) and the GeoScenario file (to define how it cycles through colors).

The GS traffic light is stored as a new TrafficLight object, which holds its states and durations and cycles through them. This object is linked to the nearest lanelet2 traffic light regulatory element with a dictionary mapping lanelet id:TrafficLight.

SimTraffic writes out traffic light states to a shared array as a list of (lanelet id, color) where color is represented as an int. This is read by the planner, which finds which traffic light applies to the SV and transforms its stop line to the frenet frame for the stopping maneuver.