Skip to main content

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

- Upon calling 'vehicle.add(depart="now" ...)' the vehicle is schedule for insertion in the next step. 
   - Insertion may be delayed if the road is occupied at that time
   - you can force insertion using the functions vehicle.moveTo / vehicle.moveToXY
- The laneIndex is only availabe after insertion and the TraCI constant INVALID_INT_VALUE is returned before insertion

Am Do., 7. Juli 2022 um 07:59 Uhr schrieb Luson <xxxxx@xxxxxxx>:

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.

_______________________________________________
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