Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[sumo-user] Way to execute code at each junction?

Dear Sir,
Following is the code in Traci :

for i in range(3000):  
        traci.simulationStep()
*        -----------------Here : 1*
    traci.close()
    sys.stdout.flush()

*-----------------Here : 1 *Can we write a function here so that it will execute at each Junction?

*Means *
If (VehicleX is at JunctionX)
{
    Call a Function To Find_Next_Edge() which vehicle can take
}
Else
{
    Move on the same edge.
}

Is it possible to solve using :
traci.junction.subscribeContext(junctionID, tc.CMD_GET_VEHICLE_VARIABLE, 42, [tc.VAR_SPEED, tc.VAR_WAITING_TIME])
print(traci.junction.getContextSubscriptionResults(junctionID))

If yes, Please suggest me how?

--
:)
Bijal Varia

Back to the top