Dear Joseph,
 
in the case of two vehicles following each other on the same lane, you can 
use the TraCI function traci.vehicle.getLeader
<https://sumo.dlr.de/pydoc/traci._vehicle.html#VehicleDomain-getLeader> . 
It will search downstream of the current vehicle whether it can find a 
leader within a given distance (100m by default). If you want to know the 
distance between random vehicles, you can get their positions using other 
Traci functions like traci.vehicle.getPosition
<https://sumo.dlr.de/pydoc/traci._vehicle.html#VehicleDomain-getPosition> 
, traci.vehicle.getLanePosition
<https://sumo.dlr.de/pydoc/traci._vehicle.html#VehicleDomain-getLanePosition> 
, traci.vehicle.getLaneID
<https://sumo.dlr.de/pydoc/traci._vehicle.html#VehicleDomain-getLaneID> . 
Then you can use them as input of a distance metric (euclidean distance, 
routing in the road graph using sumolib.net.getShortestPath
<https://sumo.dlr.de/pydoc/sumolib.net.html> ,...).
 
Best regards
Mirko
 
 
 
 
-----Original-Nachricht-----
Betreff: [sumo-user] Value between two vehicles
Datum: 2024-03-03T21:59:25+0100
Von: "Joseph Grech via sumo-user" <sumo-user@eclipse.org>
An: "sumo-user@eclipse.org" <sumo-user@eclipse.org>
 
 
 
Hi,
 
I need to find a way to get the distance between any two vehicles in the 
simulation. Is there a TraCI function that can do so? 
 
Thanks,
Joseph Grech
 

_______________________________________________
sumo-user mailing list
sumo-user@eclipse.org
To unsubscribe from this list, visit 
https://www.eclipse.org/mailman/listinfo/sumo-user

Reply via email to