Reputation: 115
I have a query about ~.setStop() method. I defined my flow as following for generating a scenario in which the relevant vehicles (type car1) enter the network, stop for 10 seconds at the determined position and finally, start moving again and leave the network.
<vType id = "car1" vClass = "passenger" guiShape = "passenger" color = "red" length = "5.5" maxSpeed = "30" />
<flow id = "f1" type="car1" begin="5" end= "900" departSpeed = "10" departLane = "0" arrivalLane = "0" number = "5" from = "e1" to = "e3" />"
Then I called the flow with this part of the code:
while step < 1000:
traci.simulationStep()
for veh_id in traci.vehicle.getIDList():
length = traci.vehicle.getLength(veh_id)
lane_id = traci.vehicle.getLaneIndex(veh_id)
if length == 5.5 :
traci.vehicle.setStop(veh_id, "e2", laneIndex=0, flags = 0, duration = 10)
step += 1
traci.close()
sys.stdout.flush()
I expect vehicles to stop for 10 seconds and then to continue their route but, they stop where is determined till the end of the simulation and make a queue. How can I fix this issue? Ali
Upvotes: 0
Views: 173
Reputation: 3680
You are issuing setStop in each step again for the same vehicle thus the duration is always 10 seconds from now and it stops indefinitely.
Upvotes: 1