This repo contains code for a bike simulator that can be connected to the priobike app. This enables to show the priobike app inside with a real bike. A speedsensor and a bike trainer are required.
Photo made at Output DD 2024 where we presented the priobike app with this simulator.
Start a local server via:
SIMULATOR_MQTT_PASSWORD="<password>" python3 run-server.py
Open localhost:8000
in the browser.
In the priobike app. Navigate to internal settings -> "Simulator nutzen" -> accept in Simulator -> confirm in app settings. When using a speedsensor make sure to select "Speed Sensor Daten" in the "Ortung" setting in the internal settings of the app. Then simply select a route and start riding. The simulator will start the ride as soon as the first positions arrive from the app.
App(s):
{"type":"PairRequest", "appID": "123", "deviceName":"abc"}
-> displayed in the simulator (choose device from multiple requests)
Simulator:
{"type":"PairSimulatorAck", "appID": "123", "simulatorID": "456"}
-> needs to be confirmed in app
App:
{"type":"PairAppAck", "appID": "123", "simulatorID": "456"}
App:
{"type": "RouteDataStart", "appID": "123", "simulatorID": "456", routeData: [{lon: 9.993682, lat: 53.551086}, {lon: 9.993686, lat: 53.551085}, {lon: 9.993792, lat: 53.551195}, ...]}
-> sends route information to simulator
App:
{"type":"NextCoordinate", "appID": "123", "simulatorID": "456", "longitude":"10.12345", "latitude":"50.12345", "bearing":"-80"}
-> updates the simulator about the next coordinate
App:
{"type":"TrafficLight", "appID": "123", "simulatorID": "456", "tlID":"456", "longitude":"10.12345", "latitude":"50.12345", "bearing":"-80", "state":"red"}
-> updates the simulator about traffic light information
App:
{"type":"TrafficLightChange", "appID": "123", "simulatorID": "456", "tlID":"456", "state":"yellow", "timestamp":"..."}
-> updates the simulator about traffic light changes
App:
{"type":"StopRide", "appID": "123", "simulatorID": "456", "stats" : "TODO"}
-> updates the simulator about the ride stop
App/Simulator:
{"type":"Unpair", "appID": "123", "simulatorID": "456"}
-> updates the counterpart about unpairing
We highly encourage you to open an issue or a pull request. You can also use our repository freely with the MIT
license.
Every service runs through testing before it is deployed in our release setup. Read more in our PrioBike deployment readme to understand how specific branches/tags are deployed.
Help us improve this documentation. If you have any problems or unclarities, feel free to open an issue.