Navigation with Maps

Posted on
Page
of 2
/ 2
Next
  • Hey there,

    I was really looking forward to that feature, since I bicycle a lot in traffic and I can miss the navigation voice telling me where to go. Looking at the wiki, that's not implemented yet, I can't find a way to make it, probably due to changes missing in the android app. Just wanted to know if its still being worked on.

  • Yes, sorry about that, it's been something I have really been missing, and it's no my todo list but other things keep jumping in ahead.

    Basically I had a fork of Gadgetbridge which did it but in order to push the navigation images it changes some things I wasn't happy pushing back into the main repo immediately - but then it seems a lot of the message handling in Gadgetbridge got refactored and that broke all my changes - the same notification from Google maps got given a different ID every time it updated :(

    I was hoping we might have some success with https://codeberg.org/Freeyourgadget/Gadg­etbridge/issues/2387 but while I thought that hooked into an OSMAnd API I think it actually required a special OSMAnd build - and it's not like many folks use that for navigation anyway!

    My current plan is just to add some code to parse the Google Maps notifications inside Gadgetbridge and pull out the needed information, then to push that to the Bangle. It should be relatively inoffensive and easy to contribute to Gadgetbridge - although it's likely to need contributions from non-english speaking countries to ensure it can parse the data correctly.

  • Actually that gadgetbridge OSMAnd branch should use the OSMAnd api, but they didn't like the binary distribution of it so they copied only the code they needed instead of using the library (there might be a point in that as it's 2MB)
    That library is an external OSMAnd library and should be relatively stable as all OSMAnd plugins rely on it and it works with the standard OSMAnd version.

  • Ahh, interesting thanks! I didn't realise that was why - I wonder whether OSMAnd could slim down the API at all...

    I have just released a new Gadgetbridge on the Play store (as long as you've enabled testing at https://microcosm.app/out/6TE9i) and that has the Google Maps parser in.

    If you update your Bangle.js apps (Android and Messages UI) you should now find navigation works.

    Working out the directions is a little fraught as the only thing we can do is to look at the picture, so right now it only does straight, left and right - but if someone goes for a drive with navigation on and Gadgetbridge set to log to a file, it should be possible to dig out the other images it doesn't recognise and I can fix those up - I just haven't had a chance yet.

  • I think their pebble integration still works, that basically sends their voice output as pebble intents, so I guess that could still be used:
    https://github.com/osmandapp/OsmAnd/blob­/2d3fe242aed291233ccda9bcf091230dc0ccf11­e/OsmAnd/src/net/osmand/plus/voice/JsTts­CommandPlayer.java#L36

    That kind of works but only shows the route changes, what I did was make an small app with the OSMAnd api that converts the route updates to intents to be sent to the watch, so I can display the distance to the next turn + the one after that on the watch and buzz when the turn is imminent. This works quite ok for walking and biking, only seems to loose connection to OSM when you stand still for a while so you need to restart the app.

  • I have used the OsmAnd Pebble Integration by just filtering normal notifications in GadgetBridge. Watch buzzes with a new message whenever Osmand would have done some voice output. That worked well enough for walking around in areas with street name signs and when I had at least an rough idea of my route it even worked fine for biking. Normal OsmAnd notifications on the Bangle are completely useless as they are updated much too often (a notification every few meters).

  • I've been testing this out and there's a pretty big issue with how maps is sending the distance values when using imperial units.

    It will send the distance value to bangle.js in meters, which it's supposed to, until it gets to 0.1 miles at which point maps decides to send the distance value directly in feet instead.

    Now when the locale file on the bangle.js sees this new value in feet it still thinks it's working with meters and the distance becomes inaccurate as a result.

    I've tried getting the log data from gadgetbridge while using navigation, but it only showed one single nav message at the beginning of my drive with a distance of 0 and that's it. The navigation ran the whole trip on my phone and the watch so I don't know why there weren't more.

    I was also testing some formatting changes in the locale file to make it use one decimal place at less than 10 miles and convert to feet when less than 0.1 miles (this is about ~500ft or 152.4 meters which is when maps changes from miles to feet). This works great and makes the distances match exactly what is shown on the phone (except the bug with the units switching), but I'm thinking this may not be the right place for this code. Perhaps it would be better placed in the messagegui app and could be made compatible with all locales?

    distance: (n) => {
        var miles = n / 1609.34;
        var dp = miles < 10 ? 1 : 0;
        return n < 152.4 ? Math.round(n * 3.28084) + "ft" : (miles < 10 ? miles.toFixed(1) : Math.round(miles)) + "mi";
      },
    
  • This is great! I admit that when I first got my BangleJS 2 I was quite bummed out that navigation didn't work. I was really looking forward to cycling around town without having to check my phone for directions all the time.

    I'd be happy to go for a drive and log images

  • That's great, thanks!

    @stweedo maybe you could take a screenshot of your phone's notification screen when it's showing the distance in feet? Does it just say something like 234 ft?

    Gadgetbridge parses the notification in https://codeberg.org/Freeyourgadget/Gadg­etbridge/pulls/3136/files#diff-3dacbc2d2­b6a5f9fe4a6ea7f82994629bf3fb71a and right now it doesn't handle feet - tweaking it should be easy

  • Going from memory, but the phone will show ft starting at 500ft and decrement down 50ft until it reaches 0ft.

    On the bangle with the code snippet I posted above in my locale file, it will switch back to 0.3mi starting after 0.1 mi instead of switching to ft like on the the phone, then when it gets to 0.1mi on the watch again it switches to ft but at this point the phone will be at 150ft maybe . It is exactly 3.28084 times more than what it should be due to the meter->ft conversion.

    It's also worth mentioning there were some weird instances where it would read one less mile on the watch than the phone and at other times it would match perfectly, albeit with a slight delay in both cases.

  • Well, I just added handling for 'ft' as a distance unit, so hopefully that one is solved (or will be when I push the next Play Store release)

  • Awesome! The navigation messages is a really nice feature to have for sure. Works so much better than having your phone open the whole time during a trip.

    I look forward to testing it out

  • I was able to test the navigation out using a nightly build with the newest fixes and the feet work correctly now except for a very minor rounding error where the watch will show 49ft instead of 50ft for example. Besides that it works very well now.

    The roundabout also works but will need to reflect which side of the road we drive on and maybe a little more dithering or removal of the opposite side of the roundabout that wasn't used to make it easier to distinguish the path.

    I also was able to grab some of the new icon images after I remembered to turn logging back on. I missed a few others before that.

    00000000000000000000000000000000
    00000000000000000000011100000000
    00000000000000000011111111100000
    00000000000000000111111111110000
    00000000000000001111000001111000
    00000000000000001110000000111100
    00000000000000011100000000011100
    00000000000000011100001000001100
    00000000000000011000011100001110
    00000000000000011000011110001110
    00000000000000011000011100001110
    00000000000000011100000000001100
    00000000000000011100000000011100
    00000000000000001110000000011100
    00000000000000001110000000111000
    00000111100011000111000000111000
    00000111100011100111000001110000
    00000111111111100011100011110000
    00001111111111110011110011100000
    00001111111111111001110111000000
    00001111100011111000111110000000
    00011111100011111100011110000000
    00011111100011111100011100000000
    00011111111111111110001000000000
    00111111111111111110000000000000
    00111111100011111110000000000000
    00111111100011111111000000000000
    01111111100011111111000000000000
    00000000000000000000000000000000
    00000000000000000000000000000000
    00000000000000000000000000000000
    00000000000000000000000000000000
    
    00000000000000000000000000000000
    00000000000000000000000000000000
    00000000000000000000000000000000
    00000000000000000000000000000000
    00000000000000001111110000000000
    00000000000000111111111100000000
    00000000000001111111111110000000
    00000000000011111000111111000000
    00000000000111100000001111100000
    00000000001111000000000111100000
    00000000001111000000000011110000
    00000000001110000000000011110000
    00000000001110000000000001110000
    00000000001110000000000001110000
    00000000001110000000000001110000
    00001100001110001100000001110000
    00011110001110011110000001110000
    00001111001110111110000001110000
    00001111101111111100000001110000
    00000111111111111000000001110000
    00000011111111110000000001110000
    00000001111111100000000001110000
    00000000111111000000000001110000
    00000000001110000000000001110000
    00000000001100000000000001110000
    00000000000000000000000001110000
    00000000000000000000000001110000
    00000000000000000000000001110000
    00000000000000000000000000000000
    00000000000000000000000000000000
    00000000000000000000000000000000
    00000000000000000000000000000000
    
    
    00000000000000000000000000000000
    00000000000000000000000000000000
    00000000000000000000000000000000
    00000000000000001000000000000000
    00000000000000011100000000000000
    00000000000001111110000000000000
    00000000000001111111000000000000
    00000000000011111111100000000000
    00000000001111111111110000000000
    00000000011111011111111000000000
    00000000011110011101111100000000
    00000000111100011100111100000000
    00000000011000011100011000000000
    00000000000000011100000000000000
    00000000000000011100000000000000
    00000000000000011110000000000000
    00000000000000011110000000000000
    00000000000000011111000000000000
    00000000000000001111100000000000
    00000000000000000111110000000000
    00000000000000000011111000000000
    00000000000000000001111000000000
    00000000000000000000111100000000
    00000000000000000000011100000000
    00000000000000000000011110000000
    00000000000000000000001110000000
    00000000000000000000001110000000
    00000000000000000000001110000000
    00000000000000000000000000000000
    00000000000000000000000000000000
    00000000000000000000000000000000
    00000000000000000000000000000000
    
    
    00000000000000000000000000000000
    00000000000000000000000000000000
    00000000000000000000000000000000
    00000000000001111111000000000000
    00000000000011111111110000000000
    00000000000111111111110000000000
    00000000001111100001111000000000
    00000000001111000000111100000000
    00000000011110000000111100000000
    00000000011110000000011100000000
    00000000011110000000011100000000
    00000000011110000000111100000000
    00000000001111000000111100000000
    00000000001111100001111000000000
    00000000000111110011110000000000
    00000000000011110011110000000000
    00000000000011110010000000000000
    00000000000011110000000000000000
    00000001100011110001100000000000
    00000011110011110011110000000000
    00000001111011110111110000000000
    00000000111111111111100000000000
    00000000011111111111000000000000
    00000000001111111110100000000000
    00000000000111111101100000000000
    00000000000011111011100000000000
    00000000000001110011100000000000
    00000000000000100011100000000000
    00000000000000000000000000000000
    00000000000000000000000000000000
    00000000000000000000000000000000
    00000000000000000000000000000000
    
    // My attempt at mirroring them
    "LHD": [
        "00000000000000000000000000000000",
        "00000000111000000000000000000000",
        "00000111111111000000000000000000",
        "00001111111111100000000000000000",
        "00011110000011110000000000000000",
        "00111100000001110000000000000000",
        "00111000000000111000000000000000",
        "00110000010000111000000000000000",
        "01110000111000011000000000000000",
        "01110001111000011000000000000000",
        "01110000111000011000000000000000",
        "00110000000000111000000000000000",
        "00111000000000111000000000000000",
        "00111000000001110000000000000000",
        "00011100000001110000000000000000",
        "00011100000011100011000111100000",
        "00001110000011100111000111100000",
        "00001111000111000111111111100000",
        "00000111001111001111111111110000",
        "00000011101110011111111111110000",
        "00000001111100011111000111110000",
        "00000001111000111111000111111000",
        "00000000111000111111000111111000",
        "00000000010001111111111111111000",
        "00000000000001111111111111111100",
        "00000000000001111111000111111100",
        "00000000000011111111000111111100",
        "00000000000011111111000111111110",
        "00000000000000000000000000000000",
        "00000000000000000000000000000000",
        "00000000000000000000000000000000",
        "00000000000000000000000000000000",
    
    
        "00000000000000000000000000000000",
        "00000000000000000000000000000000",
        "00000000000000000000000000000000",
        "00000000000000000000000000000000",
        "00000000001111110000000000000000",
        "00000000111111111100000000000000",
        "00000001111111111110000000000000",
        "00000011111100011111000000000000",
        "00000111110000000111100000000000",
        "00000111100000000011110000000000",
        "00001111000000000011110000000000",
        "00001111000000000001110000000000",
        "00001110000000000001110000000000",
        "00001110000000000001110000000000",
        "00001110000000000001110000000000",
        "00001110000000110001110000110000",
        "00001110000001111001110001111000",
        "00001110000001111101110011110000",
        "00001110000000111111110111110000",
        "00001110000000011111111111100000",
        "00001110000000001111111111000000",
        "00001110000000000111111110000000",
        "00001110000000000011111100000000",
        "00001110000000000001110000000000",
        "00001110000000000000110000000000",
        "00001110000000000000000000000000",
        "00001110000000000000000000000000",
        "00001110000000000000000000000000",
        "00000000000000000000000000000000",
        "00000000000000000000000000000000",
        "00000000000000000000000000000000",
        "00000000000000000000000000000000",
    
    
        "00000000000000000000000000000000",
        "00000000000000000000000000000000",
        "00000000000000000000000000000000",
        "00000000000000010000000000000000",
        "00000000000000111000000000000000",
        "00000000000001111110000000000000",
        "00000000000011111110000000000000",
        "00000000000111111111000000000000",
        "00000000001111111111110000000000",
        "00000000011111111011111000000000",
        "00000000111110111001111000000000",
        "00000000111100111000111100000000",
        "00000000011000111000011000000000",
        "00000000000000111000000000000000",
        "00000000000000111000000000000000",
        "00000000000001111000000000000000",
        "00000000000001111000000000000000",
        "00000000000011111000000000000000",
        "00000000000111110000000000000000",
        "00000000001111100000000000000000",
        "00000000011111000000000000000000",
        "00000000011110000000000000000000",
        "00000000111100000000000000000000",
        "00000000111000000000000000000000",
        "00000001111000000000000000000000",
        "00000001110000000000000000000000",
        "00000001110000000000000000000000",
        "00000001110000000000000000000000",
        "00000000000000000000000000000000",
        "00000000000000000000000000000000",
        "00000000000000000000000000000000",
        "00000000000000000000000000000000",
    
    
        "00000000000000000000000000000000",
        "00000000000000000000000000000000",
        "00000000000000000000000000000000",
        "00000000000011111110000000000000",
        "00000000001111111111000000000000",
        "00000000001111111111100000000000",
        "00000000011110000111110000000000",
        "00000000111100000011110000000000",
        "00000000111100000001111000000000",
        "00000000111000000001111000000000",
        "00000000111000000001111000000000",
        "00000000111100000001111000000000",
        "00000000111100000011110000000000",
        "00000000011110000111110000000000",
        "00000000001111001111100000000000",
        "00000000001111001111000000000000",
        "00000000000001001111000000000000",
        "00000000000000001111000000000000",
        "00000000000110001111000110000000",
        "00000000001111001111001111000000",
        "00000000001111101111011110000000",
        "00000000000111111111111100000000",
        "00000000000011111111111000000000",
        "00000000000101111111110000000000",
        "00000000000110111111100000000000",
        "00000000000111011111000000000000",
        "00000000000111001110000000000000",
        "00000000000111000100000000000000",
        "00000000000000000000000000000000",
        "00000000000000000000000000000000",
        "00000000000000000000000000000000",
        "00000000000000000000000000000000",
    
    
        "00000000000000000000000000000000",
        "00000000000000000000000000000000",
        "00000000000000000000000000000000",
        "00000000000000010000000000000000",
        "00000000000000111000000000000000",
        "00000000000001111110000000000000",
        "00000000000011111110000000000000",
        "00000000000111111111000000000000",
        "00000000001111111111110000000000",
        "00000000011111111011111000000000",
        "00000000111110111001111000000000",
        "00000000111100111000111100000000",
        "00000000011000111000011000000000",
        "00000000000000111000000000000000",
        "00000000000000111000000000000000",
        "00000000000001111000000000000000",
        "00000000000001111000000000000000",
        "00000000000011111000000000000000",
        "00000000000111110000000000000000",
        "00000000001111100000000000000000",
        "00000000011111000000000000000000",
        "00000000011110000000000000000000",
        "00000000111100000000000000000000",
        "00000000111000000000000000000000",
        "00000001111000000000000000000000",
        "00000001110000000000000000000000",
        "00000001110000000000000000000000",
        "00000001110000000000000000000000",
        "00000000000000000000000000000000",
        "00000000000000000000000000000000",
        "00000000000000000000000000000000",
        "00000000000000000000000000000000"
    };
    

    A couple things I noticed:

    1. There are lane indicator icons that show you what lane you should be in next for roundabouts and exits, it would be really useful to be able to see those as well, even if it is just briefly.
    2. Long street names or multiple road names that are combined into one overflow the width of the screen. Is there a certain way this should be handled? Right now they are combined with / and sometimes a single road can have 3 names combined which can be quite lengthy

    Everything else seems to work great as far as I can tell.


    1 Attachment

    • img.jpg
  • Thanks! I'll try and get those added.

    and maybe a little more dithering

    I think I fixed that this morning!

    There are lane indicator icons that show you what lane you should be in

    Yes, those would be great! Were you able to get icons for those? I'd have to add new enums in NavigationSpec for those but I guess that'd be easy enough.

    Long street names... Is there a certain way this should be handled?

    It'd be great if you could drag some examples out of the logs and maybe we could use them for testing?

    But I'd imagine that just replacing all / with a newline (\n) might have the desired effect?

  • Were you able to get icons for those?

    I didn't get the icons for the lane indicators but I did snag some screenshots on my phone. We'll have to scrape/parse this other icon container too. It's also used to display the turn coming up next I believe.

    For the names, an example I noticed was like this below where Main St flows into Centerpoint Dr after it divides into one way streets but it is also an alternate route for the interstate. So it's one road sharing names, most likely this is an edge case.
    Main St / I-29 ALT / Centerpoint Dr

  • Ok, just pushed some changes so it splits / onto newlines - that should help I hope

    Gadgetbridge master now has the new icons in, but it was a bit too late to go in the testing release I put out today

  • Great, that was fast!

    There was just one other thing that may need to be implemented yet. Formatting the distance to match what maps shows.

    In my case it starts showing miles with 1 decimal place at less than 10 miles and switches to 500 feet after 0.1 miles.

    This is how the distance is currently formatted in the locale file on the watch. This starts showing feet at < 1 mile.

    distance:(n,dp)=> n<1609.34?round(n/0.3048,dp)+"ft":round(­n/1609.34,dp)+"mi",speed
    

    And this is how it needs to be configured in my case for it to closer match the distance formatting of maps.

        distance: (n) => {
            var miles = n / 1609.34;
            var dp = miles < 10 ? 1 : 0;
            return n < 152.4 ? Math.round(n * 3.28084) + "ft" : (miles < 10 ? miles.toFixed(1) : Math.round(miles)) + "mi";
          },
    

    So we will need to figure out a way to properly format the distance values based on the users locale. Can this be added to the interface.html of locale?

  • Actually something like this would probably be better, but I still need to test it.

    distance:(n, dp) => {
            if (dp === undefined) {
                var miles = n / 1609.34;
                dp = miles < 10 ? 1 : 0;
            }
            return n < 152.4 ? round(n * 3.28084) + "ft" : round(n / 1609.34, dp) + "mi";
        },
    
  • I feel like this is a bit of a non-issue. Why does that have to match the maps app exactly? It's still showing the same distance, just with different units in some cases?

    The problem is you'll change it for you for this one use-case in the US, but then for other locales they will have different rules - in fact there may be different rules for different countries on google maps too which we might have to emulate.

    And if you change it globally, it'll probably annoy some people. I mean, if I'm walking and logging my walk, probably I'd rather see the distance I've walked in feet up to around a mile? If after 0.1 mile it suddenly just changed to say 0.1 and stayed there until it went to 0.2, it would be pretty useless IMO.

    So if you really think it matters, maybe we should file an issue with Gadgetbridge to see if they can just push the distance as a String, rather than an number? There hasn't even been an official release yet so that might be a more sensible option?

  • Yes, you're right. I completely understand that it will be different for everyone, and it's not an issue for me to maintain my own custom locale file either.

    Why does that have to match the maps app exactly?

    When I'm driving having the watch start showing feet at 1 mile is a little unusual, and they change in 0.1 mi increments because that is how maps sends it (presumably as 160.9344 meters?) until it reaches 500ft.

  • Yes, it is a bit of a pain - as you say, custom locale might be the best idea for now.

    But I just realised that the only other navigation watch (PineTime) actually converts the number to a string (badly!) so I think having a string in the NavigationSpec is probably better, and would solve all these issues.

    I'll try and do a PR for it when I get a moment next week

  • Thanks, Gordon.

    And that does sound a lot simpler and eliminates the need to convert units, maintain settings, follow regional variances, as well as variations in whether you're walking, biking, driving, on the train/bus... Letting all of that be handled by maps itself seems to make the most sense in all cases.

  • Thanks for the quick implementation!

  • Someone on reddit:

    Google maps: watch buzzez every second?

    Hi reddit I had my watch connected and started Google maps navigation. The watch then got into a frenzy of vibrations, with nothing visible on screen my hand was shaking all the time. Anyone experienced this and has a solution? Only thing I can do right now is disconnected before any maps activities...

    https://www.reddit.com/r/Banglejs/commen­ts/14aojr5/google_maps_watch_buzzez_ever­y_second/

  • Thanks - just answered there. Does anyone here see that kind of problem?

    I get the 'unread message' vibrations (I'll have a look at that) but otherwise nothing that would be considered 'a frenzy'

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

Navigation with Maps

Posted by Avatar for Poolitzer @Poolitzer

Actions