V2X-Server is the backend application for V2X-Pilot. It can decode and expose data received from smart intersections.
The app was developed to communicate with the smart intersections in Friedrichshafen. The current implementation is optimized for the intersection 309.
- UDP message processing for receiving messages from Cohda Mk5 OBU.
- MAPEM/SPATEM message decoding using asn1tools and the ans.1 specification provided by ETSI.
- GraphQL API server using Flask and Ariadne for exposing the data to clients.
To avoid compatibility issues please create a new virtual environment for this project.
- Check your Python version with
python -V
. The app requires at least Python 3.10! - Clone the repository and open the terminal in the main folder.
- Install the required packages with
pip install -r requirements.txt
. - Start the server with
python -m v2x_server
. In case you want to start the server in offline mode with sample data usepython -m v2x_server debug
. - The GraphQL playground is now available at http://localhost:5000/graphql. API requests can be sent to this endpoint (POST request). GraphQL schema and documentation are available on the right side of the playground application.
Example GraphQL query for requesting available messages and signal groups:
query {
available_messages {
messages {
intersection_id
spat_available
map_available
}
}
intersection(intersectionId: 309) {
item {
name
signal_groups {
id
}
}
}
}
- Cohda Mk5 OBU with antenna and corresponding power cable
- 12V power supply for Cohda OBU (e.g. 12V battery)
- Raspberry Pi, SD card and power supply
- Ethernet cable
- PC for setup
- Client OBU (Windows or Android device)
- Wi-Fi SSID: ITSRouter
- Wi-Fi password: itsrouter
- IP address: 192.168.1.1
- SSH user: pi
- SSH password: raspberry
- IP address: fe80::6e5:48ff:fe20:5b58%eth0
- SSH user: user
- SSH password: user
Do not power on the Cohda OBU before connecting the antenna!
1. Connect all three antenna cables to the Cohda OBU.
2. Connect the Raspberry Pi and the Cohda OBU using the Ethernet cable.
3. Power on the Raspberry Pi by using the micro USB power supply or a power bank.
4. Power on the Cohda OBU by connecting it to the power supply with the enclosed battery cable. Please check the polarity!
1. Connect the PC to the Raspberry Pi's Wi-Fi network. SSID: ITSRouter
Password: itsrouter
2. Establish a ssh connection to the Raspberry Pi from the terminal:
ssh pi@192.168.1.1
Password: raspberry
3. Run the V2X-Server with:
./v2x_server
To start the server with sample data use:
./v2x_server debug
1. Establish a ssh connection to the Raspberry Pi from the terminal:
ssh pi@192.168.1.1
Password: raspberry
2. Connect to the Cohda OBU using:
ssh user@fe80::6e5:48ff:fe20:5b58%eth0
Password: user
3. To initiate the UDP package redirection to the Raspberry Pi use:
/opt/cohda/test/runtest_monitor.sh 180 192.168.1.1 target
The program is now running and can be cancelled with Ctrl + C.
1. Connect the client device to the Raspberry Pi's Wi-Fi network.
2. Open the V2X-Pilot app. If the app asks for an IP address enter 192.168.1.1
and hit confirm.
Use pyinstaller
to create an executable file for publishing the app:
For Windows:
pyinstaller --onefile --add-data "rsc/etsi_mapem_spatem.asn;rsc" --add-data "graphql_api/schema.graphql;graphql_api" .\v2x_server.py
For Linux:
pyinstaller --onefile --add-data "rsc/etsi_mapem_spatem.asn:rsc" --add-data "graphql_api/schema.graphql:graphql_api" v2x_server.py
This creates a file in the dist
folder. Make sure to provide the asn.1 file in dist/rsc
and the GraphQL schema in dist/graphql_api
before starting the app.
The executeable is generated for the platform and OS it was created on. Therefore the Raspberry Pi release needs to be build on a Linux OS and ARM platform.