Hello,
the modules starting with an underscore (traci._person) are not meant to be
instantiated. They undergo some behind-the-scenes initialization and are
made available via
traci.person, traci.vehicle etc.

If you are not multiplexing multiple traci connections from a single traci
script, you can just do

traci.person.add(personID, edgeID, pos)

For more examples see
http://sumo.dlr.de/wiki/TraCI/Interfacing_TraCI_from_Python and
http://sumo.dlr.de/wiki/Tutorials#TraCI_Tutorials

Note, that programming IDE's may mark your code as invalid because the
member traci.person is created at runtime. Just ignore your IDE in that
case.

regards,
Jakob

2018-09-18 18:27 GMT+02:00 Konstantin Turubanov <
[email protected]>:

> 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!
>
>
>
>
>
> _______________________________________________
> sumo-user mailing list
> [email protected]
> To change your delivery options, retrieve your password, or unsubscribe
> from this list, visit
> https://dev.eclipse.org/mailman/listinfo/sumo-user
>
>
_______________________________________________
sumo-user mailing list
[email protected]
To change your delivery options, retrieve your password, or unsubscribe from 
this list, visit
https://dev.eclipse.org/mailman/listinfo/sumo-user

Reply via email to