Fix: Turning circle u-turn test failures#7394
Merged
DennisOSRM merged 2 commits intoclaude/use-turning-circles-u-turnsfrom Mar 2, 2026
Merged
Fix: Turning circle u-turn test failures#7394DennisOSRM merged 2 commits intoclaude/use-turning-circles-u-turnsfrom
DennisOSRM merged 2 commits intoclaude/use-turning-circles-u-turnsfrom
Conversation
Collaborator
|
@claude[agent] execute the next steps |
…-type mapping The Lua profile was attempting to use obstacle_type[highway] as a table lookup, but Sol2's new_enum() doesn't automatically create string-indexed access. Added an explicit mapping table (highway_to_obstacle_type) to correctly map highway tag values like "turning_circle", "turning_loop", and "mini_roundabout" to their corresponding obstacle type enums. This fixes the issue where turning facilities were not being recognized during route calculation, causing u-turns to use direct u-turn penalties instead of taking advantage of designated turning facilities. Co-authored-by: DennisOSRM <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Five cucumber tests fail where routing should prefer turning facilities (turning_circle, turning_loop, mini_roundabout) for u-turns but instead chooses direct u-turns.
Root Cause
The Lua profile code in
profiles/lib/obstacles.luawas attempting to lookup obstacle types usingobstacle_type[highway]wherehighwayis a string value (e.g., "turning_circle"). However, Sol2'snew_enum()function creates an enum table with named fields (e.g.,obstacle_type.turning_circle) but doesn't automatically support string-indexed lookups (obstacle_type["turning_circle"]).This caused turning facilities to never be added to the obstacle map, resulting in the routing algorithm not recognizing them and applying u-turn penalties even when using designated turning facilities.
Solution
Added an explicit mapping table
highway_to_obstacle_typeinprofiles/lib/obstacles.luathat maps highway tag string values to their corresponding obstacle type enum values:This ensures that nodes with
highway=turning_circle,highway=turning_loop, orhighway=mini_roundaboutare correctly identified and added to the obstacle map during extraction, allowing the routing engine to recognize these facilities and avoid applying u-turn penalties when using them.Changes Made
profiles/lib/obstacles.luahighway_to_obstacle_typemapping table (lines 6-16)obstacle_type[highway]tohighway_to_obstacle_type[highway](line 23)Expected Impact
All five failing cucumber test scenarios should now pass:
Original prompt