Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[sumo-user] add vehicles using traci

Hi all, 

I am trying to add a vehicle using traci. 

I want to add a vehicle using the code below and then operate on that vehicle right below it. 

 

traci.vehicle.add('veh1', "route_0", depart = 'now', departLane = 'allowed')


When I wrote the code just below the vehicle add code above, the problem arises in two operations. 

 

1. 

vehicle_n = traci.vehicle.getIDConunt()

vehicle_id = traci.vehicle.getIDList()

print(vehicle_n, vehicle_id)

 

When the above code is executed, the added vehicle does not appear. 

 

2. 

ind = traci.vehicle.getLaneIndex('veh1')

print(ind)

 

When the above code is executed, garbage values are output. 

 

It's a little different from the actual code, but I have the same problem as above. 

May I know in some cases where the above problem occurs? 

Will the added vehicle be available in the next step of the simulation? 

 

Thanks.


Back to the top