a project by fos
The Open Source watch Bangle.js 2 has built in GPS, so let's try to use that for offline navigation (i.e. generate a list of waypoints in the Bangle.js App Loader and show the next event (e.g. "Turn left into Example St. in 80 meters").
Goal for this Hackweek
- Find out how to generate a lists of events you know from OpenStreetMap (that left column on their website) via API
- Generate a list of waypoints out of these and upload to watch
- Show the next event in an app on the watch, preferable with an arrow indicating the direction.
- Preferred routing service: GraphHopper (API: https://docs.graphhopper.com/#tag/Routing-API)
- For preparing data for the watch use an embedded Routing Leaflet
- Bangle.js 2 API: http://www.espruino.com/ReferenceBANGLEJS2#l_Bangle_project
Part 1: The webservice
It turned out the [https://www.liedman.net/leaflet-routing-machine/](Leaflet Routing Machine) does support several routing services, but GraphHopper is only supported when installing it locally (as it is using Node.js functionality). Due to that only OSRM routing is supported for now, but that one only supports car routing when using the webservices, and the generated routes are just horrible (as proven when using it in production going to FOSDEM). On the plus side the web service returns very detailed information about the route so it is possible to even calculate the exact degree a turn has - a feature none of the other services seems to provide. Another limitation with GraphHopper is that it requires an API key. This will need some rethinking which service to finally use.
Part 2: Showing information on the clock
For now the routing result JSON has to copied onto the clock manually, but then it will now provide really useful information. It's using a speed based approach to determine when to rumble to give a hint to the user that something will be happening soon. In general the watch will calculate the distance to all the waypoints on the track and show instructions for the nearest one (an arrow for the direction, the street name to turn into or the heading information from street signs, and the distance to the waypoint). The calculation to show instructions for the nearest waypoint is done so that the user may also leave the track. It may also possible to implement tracking / check whether the user is still on the route, but that will require a lot of optimizations and is certainly out of scope for now. When a user reached a waypoint (< 150m distance) and the distance increases again, then the information about the next waypoint on the route will be shown, independent of the distance.
Part 3: Glue code
Depending on which routing API will be used in the end the application will have to be rewritten, but all the core parts proved to be working reliably. Even different speeds (pedestrian, bicycle, car) are supported well. Also still missing is the code to upload the routing data to the watch (i.e. the file handling) and adding meta information to add the application to the official App Loader.
This project is one of its kind!
Be the first to comment!