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

maxweight:hgv:conditional or maxweight:conditional is not supported? #4683

Open
SkyTik opened this issue Apr 11, 2024 · 5 comments
Open

maxweight:hgv:conditional or maxweight:conditional is not supported? #4683

SkyTik opened this issue Apr 11, 2024 · 5 comments

Comments

@SkyTik
Copy link

SkyTik commented Apr 11, 2024

I'm trying to work with maxweight restriction between time ranges like this for truck profile

maxweight:hgv:conditional: 2.5 @(06:00-22:00); <2.5 @(06:00-09:00, 16:00-20:00) or maxweight:conditional = 3.5 @ (06:00-08:30,10:30-12:00,16:00-18:00)

but Valhalla does not work with these conditions, I tried to change time, and weight when using profile truck. Is it because of the syntax of conditions or does Valhalla currently not support them?

@nilsnolde
Copy link
Member

No we don’t. There’s an endless amount of those time dependent restrictions. And much crazier combos as well with nested conditionals. I think we could support yours though. I’ll have a look later.

@SkyTik
Copy link
Author

SkyTik commented Apr 11, 2024

I'm working for a Logistics service and willing to contribute to this great project. Can you give me some advice to help me explore your source code and understand the underlying logic?

@nilsnolde
Copy link
Member

That’d be even better:) It’s not too bad, I can try to outline rough steps later, currently traveling. I’m also only 95% sure it’s easily possible at this point.

@SkyTik
Copy link
Author

SkyTik commented Apr 11, 2024

Thanks, let's keep in touch on this issue or you may contact me via my telegram @VuNH_OpsTech when you finish with the guideline.
Wish you a wonderful trip.

@nilsnolde
Copy link
Member

I had a look finally, it'd have interested me too, even though that's also very rare in OSM, but might be a bit more represented in commercial data.

in summary I think the following could work (only thought about it for 15 mins though, so there's a bit of risk):

  • add things to lua/graph.lua to parse out the right tags
  • add a secondary_value or so with width min 14 bits to mjolnir/osmaccessrestriction.h class
  • add logic to mjolnir/pbfgraphparser.cc to process the values (there's some similar logic already) to create osmaccessrestrictions with the new secondary_value
  • over in baldr, add a secondary_value or so into the baldr/accessrestriction.h::AccessRestriction() class and new AccessType for this. the new value's width should also be 14 bits as integer (we divide by 100 when we actually use it, so we can offer 2 decimal places resolution in the API, e.g. "18.03 tons")
  • then finally some code to sif/truckcost.cc & sif/dynamiccost.h to do the right thing with those new access restriction types

generally there's lots of examples of similar stuff in the code, i.e. all the access restrictions and the files above should be enough guidance. this is quite involved tbh, especially if you never had a look at the code before, it'll likely take a steep learning curve. and I can't offer much more assistance short of doing it myself (which you can always request on enquiry@gis-ops.com).

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

2 participants