-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Simulator #351
Simulator #351
Conversation
ad63fef
to
37d653e
Compare
785f8b2
to
390d79e
Compare
b945fa7
to
412339a
Compare
78c6197
to
10abf2a
Compare
60f80de
to
1c658b5
Compare
bdfe834
to
fe39043
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed the code. Still need to test it with the simulator.
@kruegercharles pls check my comments and decide, if changes are necessary or provide a very brief explanation to my questions.
Also check Buttonoverflows after applying my suggestions.
Co-authored-by: Philipp <[email protected]>
Co-authored-by: Paul Pickhardt <[email protected]>
Co-authored-by: Paul Pickhardt <[email protected]>
Co-authored-by: Paul Pickhardt <[email protected]>
ed51185
to
d413797
Compare
How can I fix Button-Overflows? It seems to me like this is a problem of the design of the app. I could change the Button to |
How to use
For the detailed protocol see below.
Use MQTT within terminal
The MQTT-Messages can be send & received via the terminal, if mosquitto is installed.
On MacOS:
brew install mosquitto
Publish
Replace
deviceID
with the deviceID shown in the internal settings. The ID resets whenever the app restarts.Subscribe
No need to use a deviceID.
Communication protocol
Step 1: If the user activated the simulator and then tries to start a ride, a pair request is sent to the simulator.
{"type":"PairRequest","deviceID":"90610","deviceName":"Priobike"}
Step 2: The server has to confirm the pairing.
{"type":"PairStart", "deviceID":"90610"}
Step 3: The app sends the first point of the route to position the simulator at the start of the route.
{"type":"FirstCoordinate","deviceID":"90610","longitude":"9.993682","latitude":"53.551086","bearing":"0.0"}
Step 4: The user has to start to ride.
Step 4.1: The app sends all the points of the route.
[{"type":"RouteDataStart","deviceID":"90610"},{"lon":9.993682,"lat":53.551086},...,{"lon":9.976977980510583,"lat":53.56440493672994}]
Step 4.2: The app sends all the traffic lights on the route.
{"type":"TrafficLight","deviceID":"90610","tlID":"hamburg/333_42","longitude":"9.9861116","latitude":"53.5476128","bearing":"109.60459330886522"}
During the ride:
The app sends an update of the current position once a second.
{"type":"NextCoordinate","deviceID":"90610","longitude":"9.993686","latitude":"53.551085","bearing":"29.79114808786065"}
The app sends updates for the state of the traffic lights whenever an update is detected.
{"type":"TrafficLightChange","deviceID":"90610","tlID":"hamburg/333_42","state":"green"}
The ride ends whenever the simulator or the app sends a StopRide.
{"type":"StopRide","deviceID":"90610"}