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

uturn incorrectly detected and penalized #4635

Open
fenwuyaoji opened this issue Mar 18, 2024 · 5 comments
Open

uturn incorrectly detected and penalized #4635

fenwuyaoji opened this issue Mar 18, 2024 · 5 comments

Comments

@fenwuyaoji
Copy link

fenwuyaoji commented Mar 18, 2024

Hi, I'm a freshman of Valhalla, I found a case below and am looking for your kind help:

request parameter:
car (auto)
Ideally link:
https://valhalla.openstreetmap.de/directions?profile=car&wps=100.65868142013117%2C13.759098685948903%2C100.66893643970043%2C13.75446497964344

description:
Similar to #3886, Valhalla made a wrong route of car mode according to the u-turn detection and penalty.
Three short ways (964183843, 964183844, 964184744) can make a turn heading to the destination, and all properties of them are the same, except the length. Valhalla detects 964183843 and 964183844 u-turns and adds a cost of 600 to them. This penalty makes 964184744 the best candidate and it looks weird.
My question is: Is there a way to prevent cases like that or improve it?
PS, I notice that the kShortInternalLength is 8m and the destination_only_penalty_ is 600 default, may I know why?

Official result:
image
Wished result:
image

@nilsnolde
Copy link
Member

Hm I’d say it mad the wrong uturn, but it very much seems a uturn would be needed right? Albeit a much “earlier” one as you pointed out. Not sure why that isn’t happening.

@fenwuyaoji
Copy link
Author

fenwuyaoji commented Mar 18, 2024

@nilsnolde Thanks for your response. I've debugged the code and got the cost of each 'uturn'. Valhalla doesn't treat way 964184744 as an uturn actually, because the length of it is larger than 8m I think. That's why it turns at 964184744, the furthest one.

@kevinkreiser
Copy link
Member

kevinkreiser commented Mar 18, 2024

yeah detecting what is and isn't a utrun is trickier than you think. we have another open issue about this in which I made a suggestion for fixing this using updates to the edge label in the issue you linked #3886 (comment)

@fenwuyaoji
Copy link
Author

@kevinkreiser Yes, yes, I understand it's a tough challenge, and I know we can't fix all bad cases. Appreciate your great work and your response, let me figure out whether we can do some work to help this issue.

@fenwuyaoji
Copy link
Author

fenwuyaoji commented Mar 20, 2024

How about we set kTCUnfavorableUturn as a param in cost_options? so that we can adjust it more dynamically.

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

No branches or pull requests

3 participants