eclipse-sumo / sumo

Eclipse SUMO is an open source, highly portable, microscopic and continuous traffic simulation package designed to handle large networks. It allows for intermodal simulation including pedestrians and comes with a large set of tools for scenario creation.
https://eclipse.dev/sumo
Eclipse Public License 2.0
2.56k stars 1.43k forks source link

Get the lane ID #15678

Closed kasop1 closed 6 days ago

kasop1 commented 1 week ago

Let's say I'm driving through a multi-lane intersection, and the subsequent exit edge is also multi-lane, is there a way to get the lane ID of the lane I'm exiting before I enter the intersection? I know how to get the edge ID.

Thank you in advance.

m-kro commented 1 week ago

Please look at traci.vehicle.getBestLanes for this purpose. "best lanes" contains the lanes the vehicle plans to use.

kasop1 commented 5 days ago

Is “getBestLanes” determined at the time of vehicle insertion? Or does the value of “getBestLanes” change at each simulation step based on the amount of traffic in the road? If so, when is the final BestLanes determined?

m-kro commented 5 days ago

The best lanes are updated as the vehicle travels through the network.

kasop1 commented 5 days ago

Does this mean that it may change for each simulation step? In other words, does it take into account the traffic conditions of My Step?

m-kro commented 5 days ago

There are several events the best lanes are recomputed, e.g. a lane change. So yes, traffic conditions impact the best lanes obviously.

namdre commented 5 days ago

bestLanes correspond to the strategic planning. At the moment, they are only influenced by the route, stops and arrivalLane attribute. There are plans to add a limited measure of influence by traffic conditions (#7157).

However, the point in time at which bestLanes are computed absolutely depends on the traffic conditions (every time the vehicle enters a new lane via longitudinal or lateral movement).