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?
_______________________________________________