Commit 4f5ce675 authored by hm-schuegra's avatar hm-schuegra
Browse files

Update README.md

parent e7b29b14
# PythonTraciWrapper
This code is a python wrapper around the Java TraCI-implementation in vadere.
## Work in Progress
If you want to update the python traci wrapper with the current master run the following git command from Vadere's root source code path:
```
git subtree pull --prefix Tools/PythonTraciWrapper git@gitlab.lrz.de:vadere/python-traci-wrapper.git master --squash
```
## Dependencies
python
IPython
py4j
## Run this code
0. Install dependencies
- install python
- install IPython via pip or conda
- install py4j via pip (see https://www.py4j.org/install.html)
1. cd into python-traci-wrapper
2. In a python environment, run
```
python setup.py install
```
3. Verify installation
- cd into vadere's root directory
- checkout branch traci_phsc
- mvn clean && mvn package -DskipTests
- Open a python console and run
```
from pythontraciwrapper.py4j_client import Py4jClient
args = ["--loglevel", "OFF",
"--base-path", "Scenarios/Demos/roVer/scenarios",
"--gui-mode", "True"]
client = Py4jClient("", args)
client.startScenario("scenario002")
```
## Run multiple clients in parallel
To run multiple clients, three port numbers have to be specified for each client without collisions:
- the manager port: where the VadereManager runs
- the java port: the port of the py4j EntryPoint
- the python port: here the python callback server listens
For two clients, this means six different port numbers are required.
```
from IPython import embed
from pythontraciwrapper.py4j_client import Py4jClient
baseArgs = ["--loglevel", "OFF",
"--base-path", "Scenarios/Demos/roVer/scenarios",
"--gui-mode", "True"]
args1 = baseArgs + ["--port", "9997", "--java-port", "10001", "--python-port", "10002"]
args2 = baseArgs + ["--port", "9998", "--java-port", "10003", "--python-port", "10004"]
cli1 = Py4jClient("", args1)
cli2 = Py4jClient("", args2)
scenarioPath = "scenario002"
cli1.startScenario(scenarioPath)
cli2.startScenario(scenarioPath)
embed()
```
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment