Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[sumo-user] [not working] traci.subscriptions with multiple traci clients from the same function using connections.

Dear All,

I implemented 2 python classes (stepListeners) that require to use traci.subscriptions
(http://sumo.dlr.de/wiki/TraCI/Interfacing_TraCI_from_Python#Subscriptions).
These classes are independent from each other, and in some cases have overlapping subscriptions
(subscriptions to the same elements). I cannot change the classes (for compatibility reasons), so
I'm trying to use:
- multiple clients, one for each class
  (http://sumo.dlr.de/wiki/TraCI/Interfacing_TraCI_from_Python#Controlling_the_same_simulation_from_multiple_clients).
- from the same _main() function
(http://sumo.dlr.de/wiki/TraCI/Interfacing_TraCI_from_Python#Controlling_parallel_simulations_from_the_same_TraCI_script)

I tried all the possible ordering of start/init, getConnection, setOrder and they hang on line 2
(Loading configuration... done. ***Starting server on port 59759 ***)
"""
 1 # TraCI client #1
 2 traci.start(['sumo', '-c', '../MoSTScenario/scenario/most.traci.sumocfg',
 3              '--num-clients', '2'], port=59759, label='pypml')
 4 # TraCI client #2
 5 traci.init(port=59759, label='triggers')
 6
 7 _pypml_handler = traci.getConnection('pypml') # with and without simulationStep() after.
 8 _pypml_handler.setOrder(1) # number can be anything
 9 logging.info('PyPML TraCI client acquired.')
10
11 _triggers_handler = traci.getConnection('triggers')
12 _triggers_handler.setOrder(2) # number can be anything
13 logging.info('Triggers TraCI client acquired.')
"""

If I use them one at the time (connections only / multiple clients in separated files) all works
fine. Is there a way to use these 2 functionalities together?

Thanks in advance for your time :)

All the Best,
Lara

-- 
Lara CODECA
Postdoc
Tel : 04.93.00.81.51

EURECOM
Campus SophiaTech
http://www.eurecom.fr/


Back to the top