-
Notifications
You must be signed in to change notification settings - Fork 795
Clamp grades on bridges and tunnels #5728
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
base: master
Are you sure you want to change the base?
Conversation
patches a bug where elevation is not corrected properly in elevation builder on consecutive connected bridges/tunnels. Since we "fix" the elevation returned along routes for these cases, this patch should fix cases where routes detour around these bridge/tunnel cases due to extreme weighted grade.
src/mjolnir/elevationbuilder.cc
Outdated
| if (max_up_slope > 3.0f) { | ||
| max_up_slope = 3.0f; | ||
| } | ||
| if (max_down_slope < -3.0f) { | ||
| max_down_slope = -3.0f; | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit:
| if (max_up_slope > 3.0f) { | |
| max_up_slope = 3.0f; | |
| } | |
| if (max_down_slope < -3.0f) { | |
| max_down_slope = -3.0f; | |
| } | |
| max_up_slope = std::min(3.0f, max_up_slope); | |
| max_down_slope = std::max(-3.0f, max_down_slope); |
kevinkreiser
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
while im certain there are tunnels/bridges who are steeper than +-3%, we cant know what they really are so this seems reasonable to me!
|
We don't really know the elevation along bridges or tunnels. Just trying to prevent extreme weighted grades due to reading elevation "above" a tunnel or "below" a bridge. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like a reasonable and easy solution. Do you think this could be improved some time in the future by using actual routes through the tunnel (assuming its not a network of tunnels but rather one coherent path) and calculating the elevation diff between one side and the other? (a naive question perhaps, I've never looked at the elevation builder code before)
|
Elevation builder "corrects" elevation on single bridge/tunnel edges by looking up elevation at each end and doing a linear interpolation between the 2 ends. This, of course, makes the bridge "flat" but removes the issue of elevation falling to the water below a bridge or rising to the hill above the tunnel (both of which are usually worse than incorrectly making the bridge/tunnel flat). |
Clamp grades and weighted grades to +/- 3% on bridges and tunnels. Thispatches a bug where elevation is not corrected properly in elevation builder on consecutive connected bridges/tunnels. Since we "fix" the elevation returned along routes for these cases, this patch should fix cases where routes detour around these bridge/tunnel cases due to extreme weighted grade.
Issue
fixes #5708
Tasklist
Requirements / Relations
Link any requirements here. Other pull requests this PR is based on?