flow-project / flow

Computational framework for reinforcement learning in traffic control
MIT License
1.04k stars 369 forks source link

Retrieving datas from SUMO simulation started with flow using TraCI from another terminal #1069

Open LorenzoUccello opened 1 year ago

LorenzoUccello commented 1 year ago

I am using Flow to start a SUMO simulation integrating deep reinforcement learning inside the process. I am also using another computer to retrieve some data from the simulation using TraCI.

The first problem is that flow does not assign the port I choose correctly. Secondly, the other computer connects to the SUMO simulation using TraCI, but as soon as it starts it goes out and doesn't save anything. The simulation keeps going on on the other computer.

• THIS IS THE CODE I USE ON THE FIRST COMPUTER TO ASSIGN THE PORT AND THE CLIENTS FOR SUMO

sim_params = SumoParams(port=45678, render=VISUALIZE_SIM_IN_SUMO, sim_step=1, num_clients=2)

• THIS IS THE CODE I USE ON THE SECOND COMPUTER TO CONNECT WITH TRACI AND RETRIEVE DATA

PORT = 49745 ( I need to set it once I start the simulation on the first computer since Flow does not use the port I specified at the beginning)

traci.init(PORT,tc.DEFAULT_NUM_RETRIES,"second_computer.local") traci.setOrder(2) # number can be anything as long as each client gets its number

If this solution is not achievable, do you know how to get this data from another terminal ?