Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [sumo-user] [SUMO-USER] Adding a new vehicle

what version of sumo are you using?
Also, please don't double-post your questions. There are already enough mails on this list.

Am Di., 4. Juni 2019 um 16:35 Uhr schrieb Pratik Dutta <pratikcsc@xxxxxxxxx>:
Hello everyone,
I want to insert an vehicle to the network using the code

traci.vehicle.add('X', rID, typeID='DEFAULT_VEHTYPE', depart='72', departLane=int(1), departPos=str(tempPostion), departSpeed='0', arrivalLane="1", arrivalPos='max', arrivalSpeed='current', fromTaz='', toTaz='', line='', personCapacity=0, personNumber=0)

but the error occured like this
  tc.TYPE_STRING, len(val)) + str(val).encode("latin1")
   TypeError: object of type 'int' has no len()

then, i started debug, and found the code of traci._vehicle.add(.........)
where there is a loop with variable name val, and that val content should be sring, hence the above error triggered.
------------------------------------------------------------------------------------------------
So I decided to change the departLane to string, so the code would be like

traci.vehicle.add('X', rID, typeID='DEFAULT_VEHTYPE', depart='72', departLane='1', departPos=str(tempPostion), departSpeed='0', arrivalLane="1", arrivalPos='max', arrivalSpeed='current', fromTaz='', toTaz='', line='', personCapacity=0, personNumber=0)

and the following error occurs,
traci.exceptions.TraCIException: Invalid departlane definition for vehicle 'X'.
---------------------------------------------------------------------------------------------------
the departLane should be within ("random", "free", "allowed", "best", "first", or an int>=0)

so, what should be the exact code to insert a new vehicle to the network?



Regards,
Pratik Dutta

_______________________________________________
sumo-user mailing list
sumo-user@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://www.eclipse.org/mailman/listinfo/sumo-user

Back to the top