abrensch / brouter

configurable OSM offline router with elevation awareness, Java + Android
MIT License
509 stars 122 forks source link

Add turncost for uphill and downhill #493

Open carg0cult opened 1 year ago

carg0cult commented 1 year ago

When cycling, it makes a huge difference whether a turn is uphill or downhill. It would be great if we had separate turncost for uphill, downhill and no hill.

polyscias commented 1 year ago

Turncosts are only calculated for crossings so not for hairpin bends and other bends.

I think that keeping this in mind the difference in uphill versus downhill cost is small, agreed?

quaelnix commented 1 year ago
@polyscias, that's not true. Turncosts are determined each time the direction of travel changes. This continuous road segment does not cross any other way and changing the turncost from 0 to 100 in the "Shortest" profile leads to the following results: turncost=0 turncost=100
Cost  500 566 
poutnikl commented 1 year ago

@polyscias, that's not true. Turncosts are determined each time the direction of travel changes.

I have been once experimenting with an on demand profile for some motorbiker with Costfactor offset and negative turncost. He wanted to prefer winding ways to straight ones. It kind of worked, but it had to be conservative otherwise would occacionally cause routing error if the segment cost got negative.

EssBee59 commented 1 year ago

but it had to be conservative otherwise would occacionally cause routing error if the segment cost got negative.

yes, I had also a very big "surprise" with a profile where the cost got < 1 !!! (0.9)

poutnikl commented 1 year ago

but it had to be conservative otherwise would occacionally cause routing error if the segment cost got negative.

yes, I had also a very big "surprise" with a profile where the cost got < 1 !!! (0.9)

IIRC, segment cost per length < 1 but > 0 did not raise hard error, but -- if occuring regularly -- would confuse the cut off feature of the 2nd pass of routing engine, that is abandoning route variants estimated not to be better than the 1st pass.

The stumble stones were short segments with significant turncost where cost value was not high enough for negative turncost value.