osmandapp / OsmAnd

OsmAnd
https://osmand.net
Other
4.48k stars 995 forks source link

Avoid loop in the announcement of Route Recalculation #20205

Open EssBee59 opened 4 weeks ago

EssBee59 commented 4 weeks ago

Describe the idea (required)

Hello! In very special cases the announcement of route recalculation loops: (many defects describing a very similar problem exist)

-The message is repeated continuously (no delay between 2 messages) -Worst: Also after the recalculation stopped (the deviation do not longer exists) the annoucement continues, some times for minutes (the only solution is to stop and restart the navigation) (the voice Messages are probably queued during the "deviation" period - it seems, this do not happend when using Osmand-calculation, as it is much slower as with Brouter)

Example of loop case:

Setting: -Osmand Android version (also tested with version 4.8.0) -Bike profile -The profile is using the Brouter for route calculation (the recalculation is with Brouter much faster as using the Osmand calculation, this is important to try to reproduce!!!!) -"recalculate route by deviation" is ON -"Minimal distance to recalculate route" (ROUTE_RECALCULATION_DISTANCE) = 20m -"Voice prompts" is ON -"Announce route recalculation" is ON

How to reproduce it: -Go to a position where the distance to the next highway is greater 20 m. (it is the same situation as underway when you get outside an highway...or the track is not known in OSM, or...) -Mark a destination somewhere and start the navigation...

==> the loop "route recalculation" starts!

The idea is to introduce a minimum delay between 2 voice-messages of that kind.

Tell us about the expected behaviour (required)

The message will not be announced continiously and (most important) messages will NOT be queued!

Tell us about alternatives you've considered (required)

I need a voice announcement in case of deviation from route (option screen on/off)

A workaround would be to activate the announcement of "deviation from route" instead of "route recalculation" in the voice prompts. But an other problem was found there (https://github.com/osmandapp/OsmAnd/issues/20187)

Context (optional)

I tested (for me successfully) a very simple change in "RouteRecalculationHelper.java". (see "change essbee" in the code) RouteRecalculationHelper.java.txt

The loop occurs only in a very special case, but it is disturbing, it would be nice to get rid of it. Thank for your help

yuriiurshuliak commented 3 weeks ago

As I understood, in specific situations, the announcement of route recalculation loops continuously. Please clarify whether this error can be related to the fact that you are using Brouter? Try to change the routing algorithm and bind the track to the road: Menu > Settings > Driving > Navigation settings > Route Parameters > Development > Routing algorithm.

Also, can the fact that you have your own compiled version of the application affect it? Have you tried that, and does this bug reproduce on the release version?

Please also explain why the distance should be exactly to the next highway? How does it affect the issue?

And also specify why you chose the minimum distance of 20m? Perhaps if you choose 50m, this error will not be reproduced.

EssBee59 commented 3 weeks ago

Hello,

I agree, the route reclaculation is much faster using the Brouter. As example in my test on a route of 6 km: -Osmand (standard bike profile) needs nearly 3 seconds -Brouter (Trekking) needs only 30 milliseconds

And this impact the behaviour! Using Osmand routing, the loop also exists, but somtimes a short delay occurs between 2 messages. AND of course no messages are queued!

The problem occurs with the standard/release Osmand version that I am using on the bike. (I compiled an own version to test my changes) If I right remember, many issues exist on the same subject

==> Please also explain why the distance should be exactly to the next highway? How does it affect the issue?" no, this is only to reproduce the problem: If the distance to the next highway is > the min distance to recalc, we have the situation where the loop occurs.

20 m or 50 m: same problem...of course, if min distance to recalc is 50, to reproduce the loop the next highway should be > 50m away!

Note: Also if the loop in his worst form only occurs when using the Brouter, I think there is no risk to wait 12 seconds between 2 recalc announcements? I so, please consider my suggested change!

Regards