osmandapp / OsmAnd

OsmAnd
https://osmand.net
Other
4.72k stars 1.03k forks source link

On overlapping track: if route is recalculated closer to finish, then route suggests to go over already visited part #15013

Open C6competition opened 2 years ago

C6competition commented 2 years ago

Consider a track is planed as a round trip (start/finish at the same location). May be at some place you have to use the same road in both directions to route the track (have to go through canon etc.).

Navigation on this track is no problem, as long as you don't start navigation on that part of the road, which used in both directions. On this part of the track there are 2 ways to get to the finish: along and a short one. The difference is made by the driving direction!

Starting navigation on this road will always send You the long way, no matter, which direction you drive!

In practice the bug is easy to generate: You stop navigation of the track on the road, which is used in both directions and then start navigation here again. You will always be send onto the long way to the finish, no matter, which direction you drive.

For testing with a bicycle, I generated a small track, which I added below. The actual position is about in the middle of the double used road.

Drive direction join track.zip

Bycicle Test

Although You can drive both directions to go with the track, no matter which direction You drive, You get always advised to drive the pink direction.

To make sure it's not depending on the short distances in this example, I used this track to test on longer distances:

Route 1_2 Goldbeck 205 Km.ZIP

Route 1_2 Goldbeck

Even after 15 km driving on the short way, the navigation advises you still how to drive on the long way (pink direction)! In addition every once in a while it tells you "you left the route for xx km ..." .The system doesn't notice I am driving into the other direction!

P.S. By the way, at the end of the anouncement "You left the route for xx km ..." it is always said " You are back on the route " I asume it should be " Go back to the route "

Your Environment

OsmAnd Version: 4.2.7 Android/iOS version: 10 Device model: Blackview 9900

scaidermern commented 2 years ago

I think I've encountered this bug already in OsmAnd 4.1.x but haven't tried to reproduce it. This was also with a track that contained a part to be used in both directions and a loop at the end.

C6competition commented 2 years ago

In the meantime I did another test drive on this track to verify the problem. Route 1_2 Goldbeck 205 Km.ZIP

Route 1_2 Goldbeck (2)

Everything seemed to be okay, as long as I drove on the first half of the track.

When in the 2. half of the track I entered the village Welsede/Amelgatzen (that's where fwd and reverse is overlapping), the voice anouncements get misterious! To me it sounds like, I get the anouncements for driving into the opposite direction! The arrows in the top left panel, showing where to turn etc. , seemed to show the same as the voice is telling! Although the distance to drive until the end of the track decrements, I had the intention, all advices how to drive are going into the wrong direction. The timing of these advices were wrong as well.

Turnig from Fwd To Rev

Coming to the place (Dehrenberg), where fwd and reverse of the track seperates, it seemed to be okay again.

When fwd and rev of the track overlaps again (Schevelstein) it goes wrong again, but distance to the finsh still decrements! What I noticed here as well, the orientation of the map on the display sometimes changes for a few seconds into the opposite direction (like it would be, when driving the 1. half of the track).

Join-Seperate Fwd-Rev of Track

Furtheron, at his point of the track I had to refuel:

Refueling SwitchToFwd

When I entered my bike again, I noticed the diplay was switched to fwd direction of the track. Analog the distance to go showed me the way from here in fwd direction to the end of the track. It looks like the system has switched back into fwd direction of the track. (probably the petrol station is far enough away from the track to start recalculation!) I ignored everything and continued my way on the reverse direction of the track. Again I get the anouncements and the pictograms in the left panel in the same way, as I would get when driving in fwd direction!

I can't tell exactly when it happened, but it's about the area I marked

SwitchToReturn

Suddenly the orientation of the map turned into reverse direction and the distance to the finish showed the correct distance to the end of the track. Advices how to drive are still wrong. One thing I would like to add: while I was driving reverse direction and the distance to go in the panel was correct, the small arrows on the track pointed into the correct direction.

C6competition commented 2 years ago

I did some more investigations in simulation mode at home

Track used is again Route 1_2 Goldbeck 205 Km.ZIP

I simulated a startpoint in Deitlevsen on the K42 On the top panel the road to go is correctly displayed (K41 Deitlevser Str)

screenshot 6

The turn by turn list looks like this

screenshot 7

After entering the K41 the display is still correct

screenshot 8

300m more everything fine

screenshot 9 1

About 400 meters further on, suddenly everything changes, except the distance to the finish is still correct!

screenshot 9

The road name on top is not more correct! This road (Bergkirchener Strasse) is at the end/beginning of the used track! As well the indications in the left panel are not more correct!

A look at the turn by turn list shows, this has changed screenshot 10

Another screenshot further down the road shows why now all advices how to drive are wrong I guess they are from a part of the track at the beginning or end. The system locks itself onto another part of the track

screenshot 11

screenshot 13

screenshot 14

Zirochkabila commented 2 years ago

OsmAnd~ 4.3.0#13714mqta, released: 2022-08-16 - was able to reproduce according to the last example of the user. The name of the track, in the upper panel, and the turn indicators, in the left panel, do not correspond to reality.

Zirochkabila commented 2 years ago

Regarding the interrelation between track navigation and your actual location - when you select track navigation, the app automatically guides you along the track route from your actual location to the finish line without taking into account that traffic may occur in another direction (that happens on routes with one road in both directions

C6competition commented 2 years ago

Yes, that’s what I am expecting as well:

If I start navigation on a road with a track in one direction, I get guided to the end of the track in this direction!

If I start navigation on a road with a track in both directions, I get guided to the end of the track, but this time the guiding direction is depending on the direction I’m driving.

Zirochkabila commented 2 years ago

Remark - about the first question about the circular route. I think that the behavior of navigation is quite logical because when you navigate after the GPX track, the application believes that you have to follow the planned route, and therefore does not reroute the route on the short road, and continues to navigate on the one that was recorded track.

C6competition commented 2 years ago

This may all sound a little bit abstract, but let me give a realistic example.

You have a track through the alpes, where the track runs through a canon on a road A into a valley. Inside the valley you have a loop with distance of lets say 100 km. To get out of the valley, You will be guided back to road A, but in opposite direction. In a restaurant/hotel at this road A You do a break(stay over night etc.). After the break You start Your navigation system again, to continue with the track. But the software will guide You through the valley again, even if You drive the other direction!

I had this scenario already with other systems, most react the same way. After a few hundred meters/seconds driving into the opposite direction, they always adapt the guiding instructions to the driving direction.

Don't missunderstand, highest priority is always the direction of the route, I don't want to have it recalculated! In the case, You are in a section of a road, which is used by the track in both directions, then THAT direction from the track has to be used for navigation, which is identical to the driving direction.

In other words, to make it simple. You are on a section of a road, which is used from the selected track in both directions. Every time You change Your driving direction inside this section, the navigation software has to change the guiding direction after driving a few hundred meters/seconds as well!

Another system even shows a split arrow into both directions, when You join a road, where the track is possible to follow into both directions. Would be a nice feature to have the same....

scaidermern commented 2 years ago

This is a perfectly valid example. People use tracks that cover multiple days, especially when hiking or cycling. These tracks may very well contain loops. It must be possible to continue these tracks from any point in any direction. Of course it should take some time/distance until OsmAnd decides to skip the longer remaining part and starts to follow the shorter remaining part.

Zirochkabila commented 2 years ago

I tried to reproduce the case by the example described above - it could not be reproduced, the route is rerouted to the finish, by the shortest path. As you can see in the added screenshot - the route goes both ways. The testing was done on the latest beta version of the application - try to install the beta version and check it out.

https://user-images.githubusercontent.com/104760013/185615884-9de457dc-1883-4151-84b6-ce1bc816ec92.mp4

C6competition commented 2 years ago

Hallo @Zirochkabila

Today I made a real test with bicycle. The version I used is OSMAND Nightly 4.3.0#34514m

The track I used is Sun 21 Aug 2022.zip

Everything went normal as always.

I nearly drove through the whole loop and was close to the junction point Ellerbusch / Gerader Weg and made these screenshots

As soon as I passed the junction point the guiding switched to go through the loop again! The following things I tryed:

drive on until close to finish....the distance to finish incremented turned the bike drove other direction ... the distance to finish decremented restarted the navigation in both directions ... nothing changed compared to the above

Sorry, but this version is even worther then original one

vshcherb commented 2 years ago

If you start navigation (not pause/continue), OsmAnd takes all Nearest Points (radius 50m) and among all of them it takes First by order point to start navigation. We consider It's correct behavior and it was changed - https://github.com/osmandapp/OsmAnd/issues/14126

Other issues

https://github.com/osmandapp/OsmAnd/issues/12658 https://github.com/osmandapp/OsmAnd/issues/9209

Zirochkabila commented 2 years ago

Description

The route is reversed and (when the GPX track is attached to the road) comes back in a circle, as well as the bug mentioned in https://github.com/osmandapp/OsmAnd/issues/15118

Log and GPX.zip

Steps to reproduce

Select GPX > Edit track > Options > Attach to the roads > Save > Select GPX > Navigation > Settings > Simulate navigation > Realistic simulation > Start

Actual result

Changing the route during recalculation

Expected result

The route is built based on GPX data

Your Environment

OsmAnd Version: OsmAnd~ 4.3.0#13774mqta, released: 2022-09-13 and release version too Android/iOS version: Android 12 Device model: POCO X3 NFC

C6competition commented 2 years ago

15118

It looks like I touched another issue by doing the test above.......

C6competition commented 2 years ago

I would like to come back to @Zirochkabila comment with reference #14126 six days ago:

I see. This seemed to be a good way, to find on a track the startpoint for navigation. In addition to that, we need a way to detect the driving direction of the user, when he enters the track.

If You allow, I would like to make a suggestion. Therefore I made a small scetch for easier understanding.

Osmand Trackpoints

The function looks like this:

While driving on an active track, you pass the virtual pink points S1, S2, S3... and so on. These S-points are generated by driving a defined distance. This distance (not critical) must be greater, than the distance between the trackpoints(which I asume are relative const). Everytime you have driven this distance (reach next S-point), you look for trackpoints, which are inside the circle around the S-point (radius not critical, but should be greater, than the distance between 2 S-points). You filter the lowest (F_Index) and highest (R_Index) index from these found trackpoints.

If the lowest index is bigger than the last F_Index, increment counter F_Cnt by 1. If the lowest index is smaller than the last F_Index, decrement counter F_Cnt by 1. If no index found, decrement counter F_Cnt by 1.

If the highest index is bigger than the last R_Index, increment counter R_Cnt by 1. If the highest index is smaller than the last R_Index, decrement counter R_Cnt by 1. If no index found, decrement counter R_Cnt by 1.

Let's asume, the counters are limited to value 0...3

The min value 0 of the counter is fixed. The max value 3 of the counters, muliplied with the distance between the trackpoints, gives the distance, which tells, when the user is driving into other direction.

NON OVERLAPPING TRACK

If You follow an none overlapping track in FWD (green)direction this will happen:

The counter F_Cnt for the F_Index will increment up to 3 and stay there. The counter R_Cnt for the R_Index will increment up to 3 and stay there.

The F_Cnt > 0 tells you the user is driving in correct direction: Nothing to do

If You follow an none overlapping track in REV (blue)direction this will happen:

The counter F_Cnt for the F_Index will decrement to 0 and stay there. The counter R_Cnt for the R_Index will decrement to 0 and stay there.

The F_Cnt = 0 & R_Cnt = 0 tells you the user is driving in reverse direction: Stop navigation advices

OVERLAPPING TRACK

If You follow an overlapping track in FWD direction this will happen:

The counter F_Cnt for the F_Index will increment to 3 and stay there. The counter R_Cnt for the R_Index will decrement to 0 and stay there.

The F_Cnt > 0 tells you the user is driving in correct direction: Nothing to do

If You follow an overlapping track in REV direction this will happen:

The counter F_Cnt for the F_Index will decrement to 0 and stay there. The counter R_Cnt for the R_Index will increment to 3 and stay there.

The F_Cnt = 0 & R_Cnt = 3 tells you the user is driving in opposite direction: Switch navigation to reverse trackpoints (flipflop)

Keep in mind, when You have switched to reverse trackpoints, all variables are working now in opposite way. So if the user changes the driving direction again, the trackpoints have to be switch to FWD again.

If You leave the track too far(gas station etc.), the counters are down to zero (navigation advices are stopped), but the last driving direction is still unchanged. After returnig to the track with same direction, the navigation advices could go on. Returning in other direction, will be synchronized after 3 increments on the counter.

As I said at the beginnig, this is only my suggestion! I don't know the structure of Your software, which might give other/easier solutions. But if You want more explanation/details about this, don't hesitate to contact me.

vshcherb commented 2 years ago

To fix it we need to understand initial movement and it's pretty complicated since during start we know only point to start not the direction. So probably we could guess by phone direction but it could be cumbersome for bicycle / pedestrian navigation.

C6competition commented 2 years ago

Yes I agree, at start You don't know the direction to go. One dead You have to die... So start initialy with the direction from the lowest (correction!!!) track index, as You do already now. If you have another hint from pior movement, like in my excample above, use that direction. This seemed to be common practice. All competitors I know, do need a certain amount of movement of the user, until they notice, when user moves into other direction. I think using the phone direction, will only shift the problem. A little bit later you will see, which direction the user is really moving.

Zirochkabila commented 2 years ago

4.2.7 - reproduced

Steps to reproduce

Select Drive direction join track 2 > Navigation > Start > Plugins > OsmAnd development > Settings > Simulate your position > Select Drive directio test

Archive 2.zip

vshcherb commented 2 years ago

It's a known issue but it works correctly if there is no route recalculation