Update turn penalty function to better fit some measured data. #2849
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR modifies the existing
car.lua
turn function to attempt to better model car turning penalties.I went out driving and measured a bunch of turning movements:
The key observations from the sample data were:
Our existing turn function only accepts an angle value. This PR updates the turn function (and default parameters) for the
car.lua
profile to attempt to get a slighly better fit. In general, turns >90 degrees should have significantly higher penalties (2x or more), and shallower angle turns should have smaller penalties. There is a left/right bias still, shallow-angle left turns (in right-driving countries) do incur an extra cost.As can be seen on the plot above, turns that traverse intersections with traffic control (lights and stop signs) incur a higher penalty than those that do not. At this stage we don't have that data available to the turn function, so this change is incomplete.
This PR is intended as a stepping stone towards #2822 that will pass additional data to the turn function.
Tasklist