Dear reviewer, I would like to control pedestrians and vehicles during simulation, using TraCI.
However, no efforts brought any success; for instance:
import os, sys
if 'SUMO_HOME' in os.environ:
tools = os.path.join(os.environ['SUMO_HOME'], 'tools')
sys.path.append(tools)
else:
sys.exit("please declare environment variable 'SUMO_HOME'")
sumoBinary = r"C:\Program Files (x86)\Eclipse\Sumo\bin\sumo-gui.exe"
sumoCmd = [sumoBinary, "-c", "sushpol.xml"]
import traci
traci.start(sumoCmd)
step = 0
while step < 1000:
traci.simulationStep()
if(step>=20):
conn=traci.Connection('127.0.0.1',15292,' ')
pedestrian=traci._person.PersonDomain()
pedestrian._connection=conn
pedestrian.add(personID=str(645+step),edgeID='390820825#1',pos=0)
print('check')
step += 1
traci.close()
1. Here I create connection using socket and instance of PersonDomain class. After trying to add additional person in network, it freezes and no action happens. Is there an error?
2. As I understood, every major class in Traci accessed through domains now, So I could not find any tutorials up to date. Are there any? I want to delete vehicles, make people to change location and etc. It is not possible, if I can't even engage with them.
3 Thank you for reading in advance, if you want some souvenirs from Russia - contact me ;)
Спасибо, Konstantin!