Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[sumo-user] set phase of traffic lights

I have build a cross with straight way and turn-left way,and the cross is like this :
image.png


and the traffic light information below:
    <connection from="1i" to="2o" fromLane="0" toLane="0" via=":0_6_0" tl="0" linkIndex="6" dir="s" state="o"/>
    <connection from="1i" to="4o" fromLane="1" toLane="1" via=":0_7_0" tl="0" linkIndex="7" dir="l" state="o"/>
    <connection from="1o" to="1i" fromLane="1" toLane="1" via=":1_0_0" dir="t" state="M"/>
    <connection from="2i" to="1o" fromLane="0" toLane="0" via=":0_2_0" tl="0" linkIndex="2" dir="s" state="o"/>
    <connection from="2i" to="3o" fromLane="1" toLane="1" via=":0_3_0" tl="0" linkIndex="3" dir="l" state="o"/>
    <connection from="2o" to="2i" fromLane="1" toLane="1" via=":2_0_0" dir="t" state="M"/>
    <connection from="3i" to="4o" fromLane="0" toLane="0" via=":0_4_0" tl="0" linkIndex="4" dir="s" state="o"/>
    <connection from="3i" to="1o" fromLane="1" toLane="1" via=":0_5_0" tl="0" linkIndex="5" dir="l" state="o"/>
    <connection from="3o" to="3i" fromLane="1" toLane="1" via=":3_0_0" dir="t" state="M"/>
    <connection from="4i" to="3o" fromLane="0" toLane="0" via=":0_0_0" tl="0" linkIndex="0" dir="s" state="o"/>
    <connection from="4i" to="2o" fromLane="1" toLane="1" via=":0_1_0" tl="0" linkIndex="1" dir="l" state="o"/>
in a time-step ,I set the phase of the traffic light in this way:
            traci.trafficlight.setPhase("0",0)
            traci.trafficlight.setPhase("0",1)
to let the south-north vehicles can pass the cross simultaneously,is it correct?if I was wrong ,what is the right way to control the traffic lights?


Back to the top