Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [sumo-user] Issue with getLeader method

What version of sumo are you using?
If it's a recent version, please provide minimal scenario files for reproducing this situation including the traci commands that were called.

Am Sa., 22. Apr. 2023 um 16:09 Uhr schrieb ĐEEPTHI P <deepthi.p08@xxxxxxxxx>:
It is a straight highway road and all vehicles are moving from left to right. Also, the behavior is not consistent. Most of the time, getLeader returns a vehicle which is ahead of the ego vehicle, but sometimes it returns a vehicle which is behind.

On Sat, 22 Apr 2023 at 15:34, Jakob Erdmann <namdre.sumo@xxxxxxxxx> wrote:
looks like ego and leader are driving on a road that goes from right to left.

Am Sa., 22. Apr. 2023 um 14:38 Uhr schrieb ĐEEPTHI P <deepthi.p08@xxxxxxxxx>:
Hi,

I used the code below to get the position of leading vehicle. However, sometimes the simulation gives the position of the leading vehicle behind the ego vehicle (as shown in the output). How does this happen ?

 leader = traci.vehicle.getLeader(ego_id)
 if leader != None:
    leader_id = leader[0]
    lead_pos = traci.vehicle.getPosition(leader_id)
    ego_pos = traci.vehicle.getPosition(ego_id)
    print("Ego position {}, Lead position {}".format(ego_pos, lead_pos))

Ego position (795.95, -1.6), Lead position (781.706206685247, -1.6) Ego position (797.5900467095553, -1.6), Lead position (783.2492279457477, -1.6) Ego position (799.1890996324844, -1.6), Lead position (784.7922492062485, -1.6)

Regards,
Deepthi
_______________________________________________
sumo-user mailing list
sumo-user@xxxxxxxxxxx
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/sumo-user
_______________________________________________
sumo-user mailing list
sumo-user@xxxxxxxxxxx
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/sumo-user
--
Regards,
Deepthi
_______________________________________________
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