railnova / osrm-train-profile

A train profile for OSRM
BSD 2-Clause "Simplified" License
24 stars 17 forks source link

Angles and speeds at turning always zero #7

Open tomvanenckevort opened 4 years ago

tomvanenckevort commented 4 years ago

Originally posted by @tomvanenckevort in https://github.com/railnova/osrm-train-profile/issues/6#issuecomment-599099898

So I have been playing around with this a bit more and decided to have a look at the OSRM tile service to plot the various ways, speeds and angles.

But when I do that all the speeds and angles displayed at turnings seem to be set to zero: image

I'm not really sure if that is a problem with the OSM data or the way OSRM has processed the data though?

For reference, I'm using the latest basic.lua profile from this repo and I run the following commands for OSRM:

C4ptainCrunch commented 4 years ago

Indeed, the turn processing function is very crude for now (see code). We only refuse truns that are too sharp and only add a time penalty on u-turns.

image Debug map

How would you suggest to improve this ? :slightly_smiling_face:

tomvanenckevort commented 4 years ago

Yes, I noticed the angle checks in the profile. While I think that should work fine, when I noticed the angles displayed on the debug map as zero degrees it got me thinking that it would match all of those turns all the time.

So for example: image

The green route here would be fine, but I would want to avoid the red route where it takes a very sharp turn. I'm guessing it thinks that turn is zero degrees as well (based on the zero values displayed on the debug map here), so therefore the profile would accept this currently as a valid turn in the route, even though the actual turn is more than 30 degrees.