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

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

Back to the top