aiwc / test_world

AI World Cup simulation environment
MIT License
7 stars 12 forks source link

Issues running multiple simulation instances due to fixed websocket ports #21

Closed stefaniapedrazzi closed 6 years ago

stefaniapedrazzi commented 6 years ago

Currently it is not to be possible to run multiple instances of the simulation at the same time on a single machine because of the websockets ports that are not dynamically computed in case they are already in used. https://github.com/aiwc/test_world/blob/master/controllers/supervisor/constants.hpp

A server machine usually has enough computational power to run multiple simulations and it would be very convenient to solve this port conflict.

chshong commented 6 years ago

Would it be enough to make the wamp router parameters (SERVER_IP, WS_PORT, RS_PORT, RS_PATH, and REALM) as input arguments to the supervisor program?

stefaniapedrazzi commented 6 years ago

Who will be responsible to set the wamp router supervisor program arguments and check that the resources are not already in use?

It would be better to not add this responsibility to the simulation server that starts the Webots instance on the server machine, in order to keep it as simple and generic as possible. But if these arguments are specified in the web page (automatically or using some user input) it will probably be difficult to know which are the resources already in use because when you send the request to start a simulation you don't know on which server machine it will run.

So I think that if these parameters are only used locally on the server machine to run the simulation and doesn't need to be known by the user before the simulation start, then the best and simplest solution is to check the availability dynamically in the supervisor program.

chshong commented 6 years ago

Considering cases, it seems WS_PORT, RS_PORT, and RS_PATH should be dynamically set. I will modify the program to dynamically fetch ports and create temporary socket file without conflicts.

chshong commented 6 years ago

I have updated the develop branch to fetch ports and create temporary socket file dynamically.

I checked I could run multiple instances of Webots running AI World Cup simulation on both linux and windows.

stefaniapedrazzi commented 6 years ago

Thank you. I will check later today and close this issue.