The client can be a windows or a linux computer, and you will need to install the following softwares :
SUMO, the traffic simulator. Once you have installed it, make sure that the installation folder is added in the system path variable (it should be added by default). To make sure that SUMO is correctly installed, open a command prompt and type sumo-gui, it should open a window. If not, please make sure that the installation process went ok.
The SUMO files. Clone it using git clone https://gitlab.orbit-lab.org/traffic-simulator/sumo-simulator.git.
The server programs are designed to be used on a linux machine. You may have to adapt them if you need to make them run on a different machine. You will need the following softwares :
Python 3 for running the different scripts. It should be already installed by default on your linux distribution. If not, try downloading it through your package manager. You also need to have the following additional packages for python :
pyserial by running pip3 install pyserial. You may have to run apt-get install python3-pyserial or dnf install python3-pyserial if you encounter the error "no module named Serial" at some point.
RabbitMQ, the software handling the connection between Unity and the cars.
Once those software are installed, there is also some git repository to clone. Here, you only have to clone the pubsub repository by doing git clone https://gitlab.orbit-lab.org/traffic-simulator/pubsub.git.
You may encounter problems on cloning some of the repositories because it ask you your username and password. Enter your gitlab.orbit-lab.org credentials, which are supposed to be your orbit account credentials. You can however download all the repositories as zip files, but you must do the cloning steps for the unity project, including the git lfs pull, because it contains large files that would not be included if you only did download as zip.
When you have every software and files needed, you can start running all that is needed.
On the server side, you have some modifications to do. Go to the folder where you cloned the pubsub repository, and go to the python_rpc folder.
Open the file rpc_client.py, and modify (HOST, PORT) to whatever you want the rpc_client script to run on.
Open the file tl.py, and modify HOST, PORT to whatever you want the traffic light script to run on. Choose a different port than rpc_client.py.
You can the launch RabbitMQ by launching sudo rabbitmq-server start and then launching those scripts :
This script should be run on the linux machine (the node in our case).
./rpc_server.py [car ID] [RabbitMQ IP address] [subscriptions] by replacing [car ID] by a name/number of your choice, [RabbitMQ IP address] by the ip address where RabbitMQ is running (normally, it should be localhost), and finally [subscriptions] by whatever you want the car to be subscribed to. An example would then be : ./rpc_server.py car1 localhost *.side.
For each car you have you will need to start a rpc_server.py script with a unique car ID. This script will be running on the cars.
When those scripts are running, you have some modifications to make to your local unity project. First, go to the folder where you cloned the sumo-simulator repository. Open the config.sumo.cfg file and modify the different files to where they are on your computer.
If you are running the server on one node on the ORBIT network, you might want to take a look at ssh tunneling and port forwarding to be able to connect to the servers from your local computer (you may not be connected to the same network and have to access the nodes only from an intermediary ssh connection).
You can then open a new unity project into the folder where you cloned the repository sumo-unity-lfs. When Unity is opened, open the scene named "Scene" and import TMP-Essentials as asked.
Open the game object named SumoConnection and under Sumo Settings make sure that Sumo Config File is set to where the config.sumo.cfg file is.
Under RabbitMQ Settings, make sure that the IP and port are corresponding to the one you put on the rpc_client.py script.
Open the file named TrafficLightObject.cs under Assets/my_scripts/SimulationObjects/ and modify the host and port to the one you put on the tl.py script.
You are good to go, launch the project and everything should be up and running. Make sure that you receive messages on the different python scripts, and if not, check the different steps again.
If you want to learn more about RabbitMQ you can look at these tutorials. In particular we built the RPC client and server using info from this tutorial.
If you want to learn more about how the traffic lights work you can check out this repo.