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

U-turns not prevented at split edges #5955

Open
hbruch opened this issue Jul 8, 2024 · 1 comment · May be fixed by #5956 or #5985
Open

U-turns not prevented at split edges #5955

hbruch opened this issue Jul 8, 2024 · 1 comment · May be fixed by #5956 or #5985

Comments

@hbruch
Copy link
Contributor

hbruch commented Jul 8, 2024

Is your feature request related to a problem? Please describe.
As a driver, I usually don't want to perform a U-turn. OTP's SimpleIntersectionTraversalCalculator currently provides costs for safe and accrossTraffic turns, but not for U-turns.

EDIT: U-turns are currently usually prevented by an isReverse check in StreetEdge.doTraverse() and state dominance checks. However, this fails under some very special conditions, e.g. when an edge is split by a linked transit stop and the dominance check allows visiting a vertex multiple times because the vertex is close to the request origin/destination. Splitting currently introduces two distinct split nodes so the isReverse check does not recognize the split forward/backward edges as reversed (see comment below).

Goal / high level use-case
Preventing U-turns.

Describe the solution you'd like
I suggest to add costs for U-turns (e.g. between 170 and 190 degrees) in SimpleIntersectionTraversalCalculator.
I suggest to use the same split vertex for forward and backward edge.

Describe alternatives you've considered

  • Add an additional, custom IntersectionTraversalCalculator as Sandbox Feature, which would need an extension of IntersectionTraversalCalculator.create to be included.
  • EDIT: extend isReverse check to handle special case of split vertices with same coords but different IDs. This has the downside that this check will happen in a performance critical section of the routing algorithm.
  • EDIT: add costs for U-turns (e.g. between 170 and 190 degrees) in SimpleIntersectionTraversalCalculator. Turning across traffic already has an additional cost while doing a U turn has not.

Additional context
The city of Aachen, Germany wants to inform their citizen about upcoming super block turn restrictions. For this use case, a custom OSM extract was generated, which contains these restrictions. Evaluating these restrictions, OTP's routing circumvents some of them suggesting U-turns:

grafik
@hbruch hbruch linked a pull request Jul 8, 2024 that will close this issue
@hbruch
Copy link
Contributor Author

hbruch commented Jul 9, 2024

As discussed in todays developer meeting, the above routing behavior looks like a bug that should already be addressed in

if (backEdge != null) {
// No illegal U-turns.
// NOTE(flamholz): we check both directions because both edges get a chance to decide
// if they are the reverse of the other. Also, because it doesn't matter which direction
// we are searching in - these traversals are always disallowed (they are U-turns in one direction
// or the other).
// TODO profiling indicates that this is a hot spot.
if (this.isReverseOf(backEdge) || backEdge.isReverseOf(this)) {
return null;
}

However, this apparently seems not to work in case of split edges, where forwardEdge and backwardEdge are split by different splitNodes:

image

@hbruch hbruch changed the title Costs for car U-turn U-turns not prevented at split edges Jul 24, 2024
hbruch added a commit to mfdz/OpenTripPlanner that referenced this issue Jul 25, 2024
hbruch added a commit to mfdz/OpenTripPlanner that referenced this issue Jul 25, 2024
hbruch added a commit to mfdz/OpenTripPlanner that referenced this issue Jul 25, 2024
@hbruch hbruch linked a pull request Jul 25, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant