-
Notifications
You must be signed in to change notification settings - Fork 126
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
Add "DIVIDE" command and new "maxslope" and "maxslopecost" parameters #642
Conversation
…is makes it possible to penalize very steep path sections
This merge request partially solves #617 as it introduces the possibility of two different elevation penalties depending on the slope of the road. |
I have also missed a 'div' operator a few times myself, but I assumed it was left out on purpose, so I would like to get @abrensch's opinion on this. As for the maxbuffercost logic, I'm not yet sure this is the right way to go, but the concept is interesting! By looking at the way you designed your profile I was wondering if it maybe was enough to also allow the usage of the |
Yes, I assume the 'div' operator was left out on purpose for performance reasons. Nevertheless it was not possible to create a physics based profile without the operator. That's why I added it. At least on a server or normal PC, even very long routes are possible. About the |
I don't see a performance risk on the When you add something like this to your profile, it will work without exception.
It just produces an infinity variable.
The result in error log is:
Result: |
I thought about something along the lines of this:
Here is a test profile if you want to play around with it. But it sadly does not work as well as I thought it would. |
I have added that error handling. Thanks for suggesting!
Very interesting approach. But I do not see any way to (soft) limit the maximum allowed slope of a route. At least to my understanding, one still needs the elevation height of the segment which is not directly available. |
You do that by reducing the |
I already do that. But to actually limit to a maximum slope, the exceeding elevation must be penalized more heavily. |
What I was trying to say is that in my test profile (which is designed to work on a regular BRouter instance without the contents of this pull request) you can also use
My test profile does this by increasing the
I wonder if we could add a slope penalty based directly on the incline that we already calculate in StdPath?
|
I've been playing around with it a bit more and I have to say that your code works really well!
To my understanding, you don't have to, because you can set
Here's a little hot-rodded code snippet that illustrates the idea: quaelnix@a00d992 The syntax is straightforward. "maxupslope" and "maxdownslope" define the threshold values for the maximum permissible inclines and declines above which the additional penalties becomes effective.
The remaining problem seems to be, that both of our ideas lack the 'fine-grained' part in order to truely solve #617. |
@simdens, I spent some more time with this pull request and the more I think about it, the more I like it. It is simple, yet very powerful and gets us a fair bit closer to solving #617, while sticking to existing concepts and the performance overhead should be reasonably small. @afischerdev, what do you think about it? |
Sorry. Currently on a business trip. Will write some more comments in a week. |
Looks good to perfekt for me.
Results - forward / revers - show what was expected. Blue the route without, red with activated params Also speed check still works . |
One more test: |
And an addtional idea: Sample: Add an incline value to message class and add it like this
|
I finally understand. Yes, that might be a way to linearly increase cost depending on slope. Simple and easy :-)
What do you mean with this suggestion? And what is the advantage of this? |
@simdens, I think the idea is to enrich the json output (sent to e.g. BRouter-Web) with incline values, but I don't think this will work well, as the average incline of a way segment, which can be several kilometers long, is not very informative. The only remaining issue I have with this pull request is that I dislike the nomenclature. |
First off: Thanks a lot for working on a (partial) solution for #617, @simdens! :) Regarding the new Based on the link to #617 I was under the impression that the (Minor bikeshed: Would it be better to avoid the abbreviation and spell out For "downhillmaxbuffercost" and "uphillmaxbuffercost", I think it would be good to see some documentation that includes an annotated example. The documentation could be added to the wiki once the PR has been merged. |
Agree, documentation is missing. I will include an updated profile_developers_guide.md to the pull request ASAP. About the naming:
@quaelnix What are your thoughts about the naming? I'd like to agree first here before changing in the code. |
@quaelnix About your commit 6a84490: I like the new clean code style! Well done! Nevertheless, I would prefer some more (ok, to be honest, a lot more) comments to make it easier to understand the code. I always find it hard to understand even my own code after some time and thus add a lot of comments everywhere in the code. Until now, that helped me a lot to understand the code faster when maintaining it. |
I like it.
The problem is that both
The split point is not the size of the buffer, but the slope, which is implicitly defined by the bufferreduce logic.
Ok, but wouldn't it make more sense in this case to make the variable names more meaningful instead?
->
This is true yet misleading. The
|
@quaelnix |
- Allow to set both the maxslope and the maxslopecost in the way context separately for uphill and downhill - New names for the new commands that better reflect what they actually do
@afischerdev, yes, I think it will make a lot of users very happy, and if we see the need for it, we can always expand it later. We should probably use 'Squash and merge' to compress all the minor changes into a single commit that is properly attributed to @simdens who came up with this awesome idea. |
Now had the time to test the current version. Looks good to me. Even though the A small typo is still in |
The idea behind this was that you can now set the thresholds in the way context separately for uphill and downhill depending on the properties of the way. You can now create mountain bike profiles with like 4 lines of code where the profile automatically selects good (boring) paths for climbing up the hill and bad (fun) paths for racing down the hill. |
Ah. Understand. Sounds like a great idea. I have to think about the possibilities and may have to extend my profile :-D |
If someone is interested about the kind of profiles possible with this change: Thanks a lot for your work to make this possible. |
I am still wondering if we should rename |
Your profile contains some sexy shit! I'll definitely have to take a closer look at it! PS: BRouter expects |
Thanks for the hint! I've fixed it :-) |
I understand your concerns. But I don't like very long names for parameters and I do not have the creativity to find a better short one. To be honest, I'd go for the current parameter names. |
The |
🙈 yes. I just noticed in that second. Sorry for my stupid question and thanks for your very quick answer! |
No worries, this also caught me in surprise a while ago. |
Finally included the speed limitation to the "Long Distance" profile thanks to the configurable |
Hi everyone, these "slope" parameters are already present in locus and Brouter, are they still under development or will they never be implemented, because they would be perfect for my needs. |
@LupinSun, you can try them out at: https://brouter.de/brouter-test/ PS: The test area is currently limited to Germany and there are no pseudo tags on this server. |
Thank you, I will wait for the test to be extended to Italy. Where can I find news about developments and changelogs so that I can be aware of new features and future developments? |
Sounds reasonable to me. |
@quaelnix |
To extend the functionality an additional "DIV" command and two additional parameters are defined. An example instance can be tested under Brouter-Web Dev Instance with fastbike-longdistance.brf profile.
Reasoning
"DIV" command:
The profile can compute constants within the global context based on physical values like systemweight or nominal power.
"downhillmaxbuffercost" and "uphillmaxbuffercost"
These parameters allow to increase the uphill or downhill penalty if the buffer exceeds the maximum buffer value. This makes it possible to increase the penalty for very step hills. i.e. for uphills which are too steep for the given gear ratio. See the fastbike-longdistance.brf profile for reference.