I hope that I oversaw something. Making this an easy question :)
Question
Is it possible to easily determine the desired_phase_index for any given lane_id or maybe a vehicle_id ?
Ideally I would like to call get_phase(lane_id) and get all phase indexes that have a green light for this lane_id.
traci.trafficlight.setPhase(
desired_phase_index) would
then give the green light for that lane_id.
Does SUMO have a built-in function for this ? Or is it easy to retrieve this ?
I have tried the following function: traci.trafficlight.getControlledLinks(tl_id). Which claims to "return the links controlled by the traffic light, sorted by the signal index". But
sofar I could not map this to a desired phase for each lane_id.
Explanation
I have attached a screenshot of my network below:
traffic light : gneJ0 controls lanes: {'west_in_0', 'west_in_1', 'east_in_1', 'east_in_0', 'south_in_0', 'north_in_0'}
My traffic light has three phases.
{west_in_0, 'east_in_0'}:
--> Phase 0: horizontal traffic
{'west_in_1',
'east_in_1'} --> Phase 2: horizontal traffic with
left turn
{'south_in_0',
'north_in_0'} --> Phase 4:
vertical traffic
Please run python3 runner.py in the attached directory.
Thanks for your time.
Best regards,
Lourens