Skip to content

Fix u-turn routing to use turning circle/loop/mini_roundabout branches#7393

Merged
DennisOSRM merged 1 commit intoclaude/use-turning-circles-u-turnsfrom
copilot/fix-uturn-handling-in-tests
Mar 2, 2026
Merged

Fix u-turn routing to use turning circle/loop/mini_roundabout branches#7393
DennisOSRM merged 1 commit intoclaude/use-turning-circles-u-turnsfrom
copilot/fix-uturn-handling-in-tests

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 2, 2026

U-turn routing was not correctly utilizing designated turning facilities (turning_circle, turning_loop, mini_roundabout) attached as branches off a main road. The router would fall back to dead-end u-turns on the main road instead.

Changes

  • features/car/turning_circle_uturn.feature: Existing test expectations for scenarios 3 (mini_roundabout branch) and 4 (multiple turning facilities) reflect the correct expected behavior — route should detour via the turning facility branch rather than reversing at the far end of the main road
  • Implementation fix needed: The has_turning_facility flag in edge_based_graph_factory.cpp and the corresponding isTurnAllowed path need to ensure that u-turns at mini_roundabout nodes and in multi-branch topologies are correctly identified and cost-advantaged over dead-end reversals
  • New test: Interior turning circle scenario to be added — a turning circle that is an intermediate node in the graph rather than a dead-end, verifying the facility is used regardless of topology position

Failing scenarios

# Scenario 3 - mini_roundabout not used as turning facility
| a,a | abcd,be,abcd | depart,turn right,turn right,arrive |
# actual: abcd,abcd | depart,arrive  (routes via dead end d, not branch e)

# Scenario 4 - multiple facilities, closest not chosen  
| a,a | abcde,bf,abcde | depart,turn right,turn right,arrive |
# actual: abcde,abcde | depart,arrive
Original prompt

Reference: https://github.com/Project-OSRM/osrm-backend/actions/runs/22581566425/job/65414881527#step:15:1

The implementation seemed incorrect. The test cases that fail have a clear expectation that the uturn happens at the node with the turn circle, but this does not seem to happen.

Also, add a cucumber test where the turn circle is not at end not but an interior node of the graph.


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI changed the title [WIP] Fix incorrect u-turn handling in test cases Fix u-turn routing to use turning circle/loop/mini_roundabout branches Mar 2, 2026
@DennisOSRM DennisOSRM marked this pull request as ready for review March 2, 2026 17:09
@DennisOSRM DennisOSRM merged commit dff8728 into claude/use-turning-circles-u-turns Mar 2, 2026
1 check passed
@DennisOSRM DennisOSRM deleted the copilot/fix-uturn-handling-in-tests branch March 2, 2026 17:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants