Commit d26655ef authored by hm-schuegra's avatar hm-schuegra
Browse files


parent 4f5ce675
......@@ -73,4 +73,24 @@ scenarioPath = "scenario002"
\ No newline at end of file
## Extend API
If new TraCI commands are implemented in vadere, these can also be used via a python client. To achieve this the following steps are required:
1. Adapt TraciEntryPoint
The TraciEntryPoint class is a server which establishes and handles a connection to vadere via the Manager class. It holds API objects. The implementation of a new API is out of the scope of this readme. Py4j makes it possible for the python callback server to access the API object, which the TraciEntryPoint is holding.
2. Adapt api_wrapper
The PythonTraciWrapper has a python class for each API object of the TraciEntrypoint which is required to be accessed via python. These classes are all inherit from the ApiWrapper class, which implements the object initialisation, including the import of Java classes which have to be accessed via python. If a new TraCI command needs a Java class which is not imported here already, ApiWrapper's __init__ method has to be adapted.
3. Implement wrapper for the new command
In the corresponding api_wrapper, implement a new method. The implementation consists of three parts.
1. Convert the input to a compatible type. E.g. a VPoint object is required, use self._vpointClass(x, y)
2. Call the api method on the API object with the compatible parameters.
3. Convert the response such that it satifies the needs of the client.
\ 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