Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[sumo-user] Calculate number of vehicles ahead in the edge and lane

Hi everyone,

I want to calculate the number of vehicles I have in front of a certain vehicle, this to calculate the number of vehicles moving and standing in front  of a vehicle.

I was thinking in using getLeader, to get all the vehicles in front, but this only returns one vehicle id.
What would be the best approach to calculate a standing queue of vehicles?
Iterate in the edge until there is no leader in that edge?

And to get the number of vehicles standing and moving, I was thinking in using for each of the leaders returned, isStopped to get the number of vehicles that are stopped and wich are not.

Is this the best approach, or would you recommend something better to do?

Best regards,
José

Back to the top