valhalla / valhalla

Open Source Routing Engine for OpenStreetMap
https://valhalla.github.io/valhalla/
Other
4.43k stars 674 forks source link

Question: Motorcycle road curvature as option for route calculation #3615

Open git-bone opened 2 years ago

git-bone commented 2 years ago

hi is it possible for motorcycle profile to prefer using curvy roads? I saw a merge from a couple of years ago where curvature was calculated, but I'm not sure if is is also possible to have Valhalla use it in the motorcycle profile?

nilsnolde commented 2 years ago

ha, we discussed that very recently in fact. curvature is available, but not used yet. apparently it was added for exactly that use case. we also had an enquiry to add that so I think this should be available within 2022

git-bone commented 2 years ago

Great! I'd like to replace pgrouting with valhalla in my app as it performs so much faster. Custom costing is a lot easier in pgrouting though. I'm not that familiar with c++ but is there anything I can do to help?

dnesbitt61 commented 2 years ago

I will say that the curvature settings on edges was only briefly tested using the demo server right click (locate call with pop up showing edge and node attributes). It looked reasonable at the time, but this uses a single value to represent curvature along what can be a long edge with various straight and curved sections mixed in. So I would expect some tuning of the curvature assignment may be required. Also, with costing it is much easier to penalize features and push routes away from certain roads. Favoring roads is not as effective and one has to be aware that highly favorable weightings can impact A* in unwanted ways. To be fully effective one may have to penalize straight roads in order to actually draw routes toward curvy roads.

nilsnolde commented 2 years ago

thanks for your thoughts @dnesbitt61 ! I also didn't think about it in detail yet, it was mentioned in my last meeting that they'd like to think in that direction. we'll try to come up with a design when it's getting closer. also I'm pretty sure that https://kurviger.de (they're co-maintainers on graphhopper) does exactly that and I hope (but didn't check yet) that that part of the code is open.

git-bone commented 2 years ago

I think that when combining curvature (penalizing roads with lower curvature?) and different costing per road type as the motorcycle profile already does, it should be possible to get interesting results.

@dnesbitt61 Would it be possible for me to try the version that was used in that demo? If I can try that on Germany/Netherlands/Belgium, I'm quite familiar with the roads here, and what I would see as curvy roads in my route. I could also compare with my pgrouting solution and kurviger. Btw, any differences would not mean one is worse or better than the other.

dnesbitt61 commented 2 years ago

the demo doesn't have any use of curvature in the costing methods (for motorcycle or otherwise). What the demo has is the ability to right click on a location and see attributes for the nearest road (including curvature). I simply used that for testing by clicking on different roads and seeing if the curvature value (0-15) made sense. Not a very extensive test, for sure. Sorry for any misunderstanding.

git-bone commented 2 years ago

I added 'use_curvature' as a costing option in a local branch. Together with avoiding highways it is giving interesting results. Needs more tweaking though and I'm still figuring out the costing formulas in valhalla and the impact the curvature factor needs to have.

Max-Leopold commented 3 months ago

Hey, just wondering if anything ever came out of this?