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

More fine-grained penalization of ascents and descents #617

Open
sjakobi opened this issue Aug 21, 2023 · 5 comments
Open

More fine-grained penalization of ascents and descents #617

sjakobi opened this issue Aug 21, 2023 · 5 comments

Comments

@sjakobi
Copy link

sjakobi commented Aug 21, 2023

Two examples with penalties on a scale of 1–10. The bike should be assumed to be a moderately loaded trekking bike.

Example 1: highway=secondary with surface=asphalt and smoothness=good:

Incline Penalty Note
-∞ – -25% 10 Very Dangerous: Brakes may be insufficient or overheat
-25% – -20% 7 Still dangerous
-20% – 12% 5 Somewhat dangerous, danger of overheating brakes on longer stretches
-12% – -2% 2 Good: The descent helps reduce the difference in speed between my bike and the car traffic
-2% – +2% 4 Uncomfortable difference in speed with the car traffic
+2% – +10% 6 Very uncomfortable
+10% – +15% 8 Dangerous: The swaying bike may get too close to the overtaking cars
+15% – +∞ 10 I'd rather not push my bike on a highway=secondary

Example 2: highway=track with tracktype=grade2, surface=compacted and smoothness=bad:

Incline Penalty Note
-∞ – -15% 10 Very Dangerous: Tires may lose traction; potholes could throw me off the bike
-15% – -7% 8 Still dangerous
-7% – -3% 4 Somewhat dangerous
-3% – 0% 3 Need to reduce speed due to potholes / large gravel
0% – +3% 2 Comfortable
+3% – +10% 5 Somewhat exhausting
+10% – +15% 7 Rear tire may lose traction
+15% – +20% 9 Pushing
+20% - +∞ 10 Shoes may lose traction during pushing

Current state of BRouter

AFAIK it's currently impossible to express cost functions of this shape in BRouter. downhillcost, downhillcutoff, uphillcost and uphillcutoff are all constants. Therefore downhillcostfactor and uphillcostfactor can't vary for different inclines.

Motivation

I think that fine-grained penalization of inclines would help cyclists to use the road network more effectively and safely. Someone with narrow road tires may prefer taking a moderate ascent on a grade2 track rather than on a primary highway. Most cyclists would probably prefer to avoid steep descents (say -15% and steeper) entirely.

I don't know how this feature should be designed or implemented, but I think it would be a great improvement! :)

(Related / background: poutnikl/Brouter-profiles#29, related earlier issue: #22)

@quaelnix
Copy link
Collaborator

AFAIK it's currently impossible to express cost functions of this shape in BRouter.

Yes, there is currently no way to directly relate the cost factor to the (internally calculated) slope of a way segment.

Therefore downhillcostfactor and uphillcostfactor can't vary for different inclines.

Correct, but they can at least vary for different types of ways, see: Allow hill cost and hill cutoff in way context

@lukasmericle
Copy link

there is currently no way to directly relate the cost factor to the (internally calculated) slope of a way segment

It would be very useful to simply expose the slope in a named variable for use in scripts. For instance, the energy spent when walking/hiking is nonlinear vs the slope, so calculating energy-based costs is impossible. Maybe there is some hack or workaround I am missing?

Should I make a new issue on this repo to request this specifically so it can be labeled and tracked?

@quaelnix
Copy link
Collaborator

quaelnix commented Dec 4, 2023

@lukasmericle, I don't think there is an easy way to achieve this, as the slope along the way segments (up to several kilometers long) on which the profile script operates is generally not constant.

@lukasmericle
Copy link

lukasmericle commented Dec 4, 2023

Is it possible to infer the slope of a way segment from the two nodes at its endpoints? Do we have access to lat/lon/elevation of those nodes?

If not, are there other routing engines you're aware of that do expose this kind of information? Thanks

@quaelnix
Copy link
Collaborator

quaelnix commented Dec 5, 2023

Is it possible to infer the slope of a way segment from the two nodes at its endpoints?

Yes, but then you get the "plain ascend" of this segment and neither the maximum nor the minimum slope.

are there other routing engines you're aware of that do expose this kind of information?

I don't know, sorry. But you can already soft limit the max slope in BRouter like this:

assign downhillcost switch consider_elevation 40 switch avoid_steep_inclines 80 0.0
assign downhillcutoff switch and not consider_elevation avoid_steep_inclines 8 1.5
assign uphillcost switch consider_elevation 80 switch avoid_steep_inclines 160 0.0
assign uphillcutoff switch and not consider_elevation avoid_steep_inclines 8 1.5

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