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 · 4 comments · May be fixed by #5956 or #5985
Open

U-turns not prevented at split edges #5955

hbruch opened this issue Jul 8, 2024 · 4 comments · May be fixed by #5956 or #5985
Labels
New Feature Stale This issue is stale, no activity for 90 days. Remove stale label or comment within 30 days.

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
Copy link

This issue is stale because it has been open 90 days with no activity. Remove stale label or comment or this will be closed in 30 days

@github-actions github-actions bot added the Stale This issue is stale, no activity for 90 days. Remove stale label or comment within 30 days. label Oct 24, 2024
@miklcct
Copy link
Contributor

miklcct commented Nov 20, 2024

Does it only affect cars? If I am driving a bike, I want to be able to U-turn to avoid these restrictions.

@github-actions github-actions bot removed the Stale This issue is stale, no activity for 90 days. Remove stale label or comment within 30 days. label Nov 21, 2024
hbruch added a commit to mfdz/OpenTripPlanner that referenced this issue Dec 20, 2024
hbruch added a commit to mfdz/OpenTripPlanner that referenced this issue Dec 20, 2024
Copy link

This issue is stale because it has been open 90 days with no activity. Remove stale label or comment or this will be closed in 30 days

@github-actions github-actions bot added the Stale This issue is stale, no activity for 90 days. Remove stale label or comment within 30 days. label Feb 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
New Feature Stale This issue is stale, no activity for 90 days. Remove stale label or comment within 30 days.
Projects
None yet
2 participants