Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [sumo-user] Vehicles not following Traffic Signal with traci.

There is no good reason why this should ever be the case unless you are using traci to override the junction model (doesn't appear in the listed code) or sumoCmd is quite different from what you are running in sumo-gui (i.e. sumoCmd is loading xml definitions where vehicles are explicitly configured to violate traffic signals).


Am Di., 8. Dez. 2020 um 11:31 Uhr schrieb Shah Sultan <syedshahsultan@xxxxxxxxx>:
Hello everyone

I am new with Traci. I am trying to run my model with that. What I am
observing is that the vehicles in my models are not following traffic
signals. On the other hand, with sumo-gui, they are completely following it.
Am I missing something? 

import traci
traci.start(sumoCmd)
print("Starting SUMO")
traci.gui.setSchema("View #0", "real world")

step = 0
while step < 3600:
    traci.simulationStep()

    vehicles=traci.vehicle.getIDList();
    if (step%10)==0: #every 10 sec....
        for i in range(0,len(vehicles)):
            print("Speed ", vehicles[i], ": ",
traci.vehicle.getSpeed(vehicles[i]), " m/s")   
            print("CO2Emission by vehicle", vehicles[i], ": ",
traci.vehicle.getCO2Emission(vehicles[i]), " mg/s")               
            print("EdgeID of veh ", vehicles[i], ": ",
traci.vehicle.getRoadID(vehicles[i])) 
            print('Distance covered by vehicle', vehicles[i], ": ",
traci.vehicle.getDistance(vehicles[i]), " m") 
            print('Waiting time by vehicle', vehicles[i], ": ",
traci.vehicle.getWaitingTime(vehicles[i]), " sec")     
    step +=1
traci.close()



--
Sent from: http://sumo-user-mailing-list.90755.n8.nabble.com/
_______________________________________________
sumo-user mailing list
sumo-user@xxxxxxxxxxx
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/sumo-user

Back to the top