Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Short way routing - weird unnecessary turns - not enough penalty for turns #21424

Open
4 tasks done
abclop99 opened this issue Nov 23, 2024 · 11 comments
Open
4 tasks done
Assignees
Labels
Milestone

Comments

@abclop99
Copy link

Routing engine

  • OsmAnd's in-app offline routing
  • Any online routing provider (YOURS, openrouteservice, OSRM, etc.)

Routing Profile

Routing profile: Car
Restriction: None?

Enabled:

  • Fuel-efficient way
  • Consider temporary limitations
  • Minimal distance to recalculate route: 120m
  • In case of reverse direction

Start and end points

An example route on openstreetmap.org.

Example route on osmand.net

Any route that goes through that intersection in that direction has the same problem.

Actual route

The actual route turns onto Leitrim Road then turns immediately back onto River Road.

Screenshot of actual route in the app

It also shows up on osmand.net with "Short way" enabled

image

Expected route

The route should go straight through the intersection along River Road as on openstreetmap.org.

Also works properly on osmand.net without "Short way" enabled.

image

Maps you used (online or offline)

  • Offline maps offered within the OsmAnd app for download.
    • 2024-11-23 10:30
  • Online (tile / raster) maps

Your Environment

Device : HWBLA
Brand : HUAWEI
Manufacturer : HUAWEI
Model : BLA-L29
Product : BLA-L29
Build : BLA-L29 [10.0.0.159](http://10.0.0.159/)(C605E4R1P3)
Version : 10
App Version : OsmAnd~
Apk Version : 4.8.6 480603

Anything else?

No response

@Sonwon1
Copy link

Sonwon1 commented Nov 24, 2024

I have seen this behavior more than once with Osmand. It is usually a map problem. I suggest again that the routing algorithm incorporate some common sense to see if the route makes sense.

Google maps does not exhibit this behavior, maybe they have better maps?

@mdykierek
Copy link

My guess is - the straight ahead is 60km/h.
The links don't have speed limits and the short section on the right is 80 + maybe traffic lights penalty is too big to make sense there.
I don't know if the routing takes penalty for taking turns, especially left turns (for right hand drive and the other way around for left).

@yuriiurshuliak
Copy link

The bug has been confirmed. Here's how you can consistently reproduce the behavior:

  1. Build a route in the Car profile using these coordinates:
    • Start: 45.29093, -75.69393
    • End: 45.29246, -75.69411
  2. Observe that the route is built correctly when the "Short way" option is not enabled. This aligns with the expected behavior, as seen in this example: Correct Route.
  3. Enable the "Short way" option and rebuild the route.
  4. Notice that the route now includes unnecessary detours via Leitrim Road and back to River Road, as shown here: Route with Detour.

The issue appears to be specifically linked to the "Short way" routing option.

"Short way" is disabled "Short way" is enabled

@Sonwon1
Copy link

Sonwon1 commented Nov 26, 2024

That explains why I see this bug so often. I use the shortest way routing so routing will take more interesting roads.

@vshcherb vshcherb changed the title Routing weird unnecessary turns through an intersection Short way routing - weird unnecessary turns - not enough penalty for turns Nov 27, 2024
@vshcherb
Copy link
Member

It looks like not enough penalties for turns in shortway somehow. But there is a penalty for traffic signals 5 seconds

@vshcherb vshcherb added this to the 4.9-backend milestone Nov 27, 2024
@vshcherb vshcherb assigned RZR-UA and ivanPyrohivskyi and unassigned RZR-UA Nov 27, 2024
@mdykierek
Copy link

To be honest, the penalty of 5 seconds for traffic signals is surprisingly low to me. No traffic lights switch every 20 seconds.
The probability of arriving at traffic signals at red would be close to 50%. The time to stay put at red would be close to 50% of the time, too.
I wonder if the left turn at this intersection is allowed in the end. It's probable that there should be no left turn.

@mdykierek
Copy link

If someone can confirm the no-left-turn restriction (no street-level available and aerial are inconclusive), I will fix the map.

@vshcherb vshcherb assigned RZR-UA and unassigned ivanPyrohivskyi Nov 27, 2024
@RZR-UA
Copy link
Contributor

RZR-UA commented Nov 29, 2024

The very similar old Issue is found: #17641

Technically, we do not consider any penalty for turns in the short_way mode. Ref: GeneralRouter - calculateTurnTime - shortestRoute.

Additionally, penalty_transition could help, but in this case, the difference between secondary and secondary_link is zero (15-15 = 0). Ref: routing.xml lines 759-760 (penalty_transition - short_way).

It seems that short_way's traffic_signals penalty of 5 seconds is useless in this case and should be set to 0.

We're working on the fix and tests.

@mdykierek
Copy link

You know your product best, but no penalty for traffic lights... + in the app I see that the mode is called "fuel efficient". Standing at traffic lights in not fuel efficient at all.
The intersection needs "no left turn" anyway. Let me know when I can fix the map (OsmAnd fix confirmed).

@RZR-UA
Copy link
Contributor

RZR-UA commented Nov 29, 2024

@mdykierek, I already saved the OSM data for this intersection for our tests and fixes so that you can safely apply your fixes (fixing traffic_signals direction and "no-left-turn" is a good idea there if it fits the road).

The question about penalties in the "fuel efficient" mode (short_way, actually) is open for discussion. If your car is equipped with a start-stop system, a zero penalty for traffic_signals is reasonable.

If not equipped... Yeah, we could apply the smaller values of turn penalties, but any penalties for the turns might break the whole idea of searching for the shortest way. Imagine you are a cyclist and want to search for the shortest way, literally.

@vshcherb, please share your opinion. Would we try other options and check how the routing tests will be affected?

@mdykierek
Copy link

Good points. Yet left turns (assuming right side traffic) are always slower and less safe than straight and right. Always involve yield the opposite traffic. I bet there are lots of variables e.g. should paths (non-public) roads follow the same rules, should profile /e.g. bicycle/ affect these rules? For sure I don't know enough to play the smart guy. Keep the good work!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

7 participants