osmandapp / OsmAnd

OsmAnd
https://osmand.net
Other
4.38k stars 989 forks source link

Navigation proposes to turn around - suggest a smarter new way to get to track back #17392

Open DreitTheDragon opened 1 year ago

DreitTheDragon commented 1 year ago

🚀 Safer and smarter wrong way handling suggestion (feature request)

Description

When I get out of suggested track, I'd expect OsmAnd to respect my direction of travel, especially at higher speeds like 40+ km/h and suggest places to turn around in front of me.

Right now OsmAnd is confused and when I get to wrong way, it just recalculates and doesn't care in which direction I drive. Practically all suggestions are leading backwards, in opposite direction than I am driving. I must note I had Economic route turned on and after reading on how broken it was/is, I'll try again with this option turned off.

My opinion is that navigation shouldn't confuse driver. If driver has to turn around, lead driver in forward direction to place where it's safe to do. This could be roundabout or just block of buildings which driver can drive around safely.

Similarly if driver gets on paid road by accident while it's set to avoid them, keep driver going forward and search for closest exit. If driver misses one, search for next one in direction of travel and so on.

Describe the solution you'd like

In my opinion OsmAnd should:

1) Check and respect my direction of travel, especially when I'm going over certain speed (40 km/h?).

2) Find "closest" intersection in direction of travel. If it leads to forbidden roads (private access, paid roads, unpaved road etc), search for next one. "Closest" is relative and depends how long it will take to calculate track, so driver does have time to react. Theoretically it could simply skip first intersection and start on second.

3) On intersection try to turn right if possible and search for way to safely turn around and get back on road where I came from. If it's not possible, try turning left and again search for possible loop. If even that didn't worked, try on next intersection - maybe there simply was no loop on first one. I'd personally prefer turning right, because that way I get out of road with minimum amount of stress and can prepare for getting back.

4) Navigate me without forcing to stop and turn around.

Describe alternatives you've considered

Different algorithm, I just tried to figure out something simple which might work.

Example

Here's one beautiful example where similar steps might work. Notice there are already many options to turn around:

Video_screen-20230528-204911_ffh

OsmAnd~ 4.3.12 from F-Droid

I wanted to show how I'd imagine proper routing but it seems like it's even more broken than I hoped:

I'd expect it to go around that block in second screenshot, because this simply makes no sense. This was done with economic route turned off.

Zirochkabila commented 1 year ago

Recalculate route

DreitTheDragon commented 1 year ago

Recalculate route

I tried setting it to 10 meters in past and it always navigates backwards, that's why I filled this request. I can try setting it to 60 or 120 meters tomorrow when I'll go on same route but don't believe it will help, only delay recalculation.

EDIT: I noticed it happens only in certain cases and elsewhere it works fine, I was probably just unlucky to drive on places where it fails. I'll make videos and send GPX track to describe, as I think there definitely could be space for improvement.

Zirochkabila commented 1 year ago

@DreitTheDragon The behavior you describe has already been fixed https://github.com/osmandapp/OsmAnd/issues/16277 Please install the version from the PlayStore or the nightly https://osmand.net/docs/versions/nightly_versions and try again

DreitTheDragon commented 1 year ago

@DreitTheDragon The behavior you describe has already been fixed #16277 Please install the version from the PlayStore or the nightly https://osmand.net/docs/versions/nightly_versions and try again

Hello, just bought OsmAnd+ on Google Play, recovered settings and tested this track. It acts much better but it seems to completely fail when it thinks I'm not exactly on the road, even if there is no other road around.

(Video is sped up from 0:35 to 0:50) 1:12 - OsmAnd found alternative track. This road is set with access=destination because officially you shouldn't drive thru, but that's not big problem there. Makes sense to use that road in this case.

1:34 - OsmAnd gets lost, switches to original track and struggles to find way until 02:34, almost one kilometer later.

4:20 - alternative track which is OK

Video: https://github.com/osmandapp/OsmAnd/assets/1199166/8dbb2497-5457-4948-b1a5-486c6bf32c21

GPX: 2023-05-28_20-42_Sun.gpx.txt

Destination: 50.42903° N, 15.58276° E

If you project GPX file on map, you can see I was not on the road during that one kilometer when OsmAnd was struggling. When I crossed road (second sharp curve), OsmAnd quickly found new way and used it. It would be interesting to shift coordinates in GPX a little to see if OsmAnd would act correctly if it sees me on road all the time.

image image

Track was recorded on Nokia G22. My previous phone couldn't locate GPS more precisely than with 8 meters error, this one gets to about one meter. Theoretically if OsmAnd uses this error number for routing, it could work perfectly with less precise phone (stick to closest road) and worse with more precise phone (you are definitely not on road). Maybe that error value simply isn't as precise as system says, but I just guess where problem might be.

DreitTheDragon commented 1 year ago

There is second example:

Video: https://github.com/osmandapp/OsmAnd/assets/1199166/475d052d-5893-4067-9bd2-fe5dded8bc10

GPX: 2023-05-21_20-23_Sun.gpx.txt

Destination same as in previous comment: 50.42903° N, 15.58276° E

1:40 - I'd promise that recent F-Droid version (OsmAnd~ 4.3.12) managed to calculate one alternative track here (loop on that other street) and then new track through city almost instantly, meanwhile this recent version (OsmAnd+ 4.4.7) from GooglePlay failed.

3:32 - something happens but it's still struggling, tries to send me back.

3:40 - practically 2 minutes and 1.7 km later it finally figures out new way.

Same as in previous example it seems to start working correctly when GPX track crosses real track on map, going close along track doesn't seem to be enough which is strange to me.

All out of track: image Short crossing: image Bus station where routing started working properly: image

vshcherb commented 1 year ago

If we are talking about osmand offline routing it considers direction of movement! It assigns +5 min extra penalty to move in another direction, in most of the cases this penalty is enough

zipav commented 1 year ago

OsmAnd Nightly 4.5.0#254m, released: 2023-06-20

2023-05-28_20-42_Sun.gpx.txt 2023-05-21_20-23_Sun.gpx.txt

Steps to reproduce:

2023-05-28_20-42_Sun.gpx.txt -In certain parts of the track during navigation recalculation of the route occurred about 2 minutes, only after that the track resumed and sounded a voice prompts, informing about the recalculation of the route (screenshots below), perhaps a delayed response from the voice prompts related to https://github.com/osmandapp/OsmAnd/issues/17376

2023-05-21_20-23_Sun.gpx.txt - Recalculation occurred no more than 20 seconds, these places are shown in the screenshots below:

vshcherb commented 11 months ago

As we understand you used a normal (to destination) navigation (not a gpx navigation), in that case penalty to turn around was to high, as I said above > 5 minutes. But OsmAnd didn't find any better routing without turn around that would be less than 5 minutes.

We understand that in some situations it could be too dangerous even to propose to turn around, so we need to find a smarter algorithm or to put a higher penalty which in some situations (rural areas) will make routing worse

DreitTheDragon commented 11 months ago

I am sorry for so late answer, a lot is happening and I forget about this constantly.

@vshcherb

If we are talking about osmand offline routing it considers direction of movement! It assigns +5 min extra penalty to move in another direction, in most of the cases this penalty is enough

As we understand you used a normal (to destination) navigation (not a gpx navigation), in that case penalty to turn around was to high, as I said above > 5 minutes. But OsmAnd didn't find any better routing without turn around that would be less than 5 minutes.

We understand that in some situations it could be too dangerous even to propose to turn around, so we need to find a smarter algorithm or to put a higher penalty which in some situations (rural areas) will make routing worse

This is very useful information, I wondered how it works but I'm no programmer and hadn't even had idea where to search. Now it makes perfect sense if it's managed only by penalties. I thought there was some higher intelligence behind it, like number of intersections ahead.

I ALSO FOUND OUT that what I was describing wasn't just one but actually TWO problems which appeared at same time!

1) Version in F-Droid took longer to figure out route than version from Google Play as described above, so that was just some software problem.

2) My GPS is completely useless. For some reason I'm at certain position and GPS is happy, shows correct position. Then it randomly jumps for example 50 meters away but still shows about 10 meters accuracy - effectively thinking I'm at completely different place. So now I'm not surprised it is problematic to stick on road. Because my accuracy circle is completely missing road I'm driving on!

I noticed it recently when I tinkered with SCEE and my position was relatively accurate, accuracy reported by phone was about 8 meters. Then suddenly my position skipped about 50 meters away but phone still reported accuracy of 10 meters or so for few seconds, THEN finally figured out it got lost. It took some time (about 15 seconds) before it got back and accuracy area at least slightly touched position where I was really standing.

In that case this can work as great examples:

You can see it even here, in reality I was standing in front of house (more to the left on this picture) and all that random positions on the right side are caused just by GPS acting up. I never got even to the corner of house.

Here it is same, I came from top, stopped on street and let GPS running for a while, it logged this random stuff.

About month ago I was traveling on highway, no buildings around and OsmAnd suddenly started acting up again after longer time (cca two hours) of working properly. So I stopped in village on my way, started screen recording and thanks to it figured out what happened. It simply sees me traveling 90 km/h on road....and then my position suddenly jumps outside of road. Not very far but accuracy area is already out of road, so navigation breaks => it shows gray dashed arrow and shows airline to closest point on closest (correct) road.

Originally I thought it might be worth ticket but after seeing real reason why that happens, there is really no solution to be done in software. It is clearly problem in hardware or Android itself. Maybe it might make sense to propose feature request about usage of phone sensors (accelerometer, gyroscope) to figure out travel direction. That way OsmAnd could temporarily navigate even without proper GPS data. But considering amount of work and how rarely this happens (does this even happen to anyone else?) I'm not sure if it would be worth trying. When I think of it now, probably same thing happened to me about 8 years ago also with OsmAnd but on completely different phone. There were many and many hours of driving with no problem, but then it started to act up for like 15 minutes straight before getting back to normal.

Now I'm not sure what to do with this ticket. Main problem was mostly solved by upgrading to Google Play version but at same time there is mention it could be improved in future versions (if alternative way takes too much time, still go straight ahead instead of turning around). So I guess I should leave it open?

scaidermern commented 11 months ago

2. My GPS is completely useless. For some reason I'm at certain position and GPS is happy, shows correct position. Then it randomly jumps for example 50 meters away but still shows about 10 meters accuracy - effectively thinking I'm at completely different place.

Try to use a different location source: Settings / OsmAnd settings / location source / Android API.

DmitryAlexei commented 11 months ago

You can also have a look at troubleshooting guide for GPS problems: https://osmand.net/docs/user/troubleshooting/general#problem-with-the-gps-connection-android Some advices may help to improve the situation with location accuracy.

Your issue has a milestone status, so in a while, it will be taken to work.