validator: judge road-link gaps by lane-boundary contact, not reference-line distance - #107
Merged
Merged
Conversation
geom.road-link-gap compared the two roads' reference-line endpoints and subtracted |laneOffsetA - laneOffsetB| as slack. That proxy breaks whenever the lane offset varies with s or the roads meet at an angle: on a measured real map all ten of its reports were false positives whose lane boundaries in fact touched to 0.000 m. Measure the thing the rule claims to measure instead. At each contact end, build the road's lane-boundary cross section in world coordinates - the centre line (reference line shifted by <laneOffset> at that station) plus the running sum of lane widths outward along the reference-line normal - and report the minimum distance between the two sections. Lane offset is handled by construction, so the slack term is gone. The lane section and the <width> record covering the contact station are the ones evaluated, and a link with no contactPoint takes the nearer of the target's two ends. Comparing minimum distance asks whether the sections touch, not whether they are congruent: lane counts differ across a link at merges, ramps and junction connectors (91 of 156 links on one map), so requiring congruence would trade one class of false positive for another. A road wholly displaced from its neighbour is still reported. Default threshold 0.3 m, down from 0.5, now that the measurement is direct. Mutations still 10/10; no MAP_DEFECT error on any fixture or on the 26-map external corpus. soderleden road 7 keeps its warning: its lanes really are tens of metres from the road it declares as predecessor.
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.
Problem
geom.road-link-gapjudged two linked roads by a proxy: the distance between their reference-line endpoints, minus|laneOffsetA - laneOffsetB|as slack.The proxy breaks whenever the lane offset varies with
s, or the two roads meet at an angle. On a measured real map, all ten of its reports were false positives — the lane boundaries in those cases touched to 0.000 m. It is the same failure mode as the soderleden 66 m case, just with the sign the other way.Fix
Measure what the rule claims to measure. At each contact end, build the road's lane-boundary cross section in world coordinates:
<laneOffset>evaluated at that station,(-sin hdg, cos hdg)— left lanes in+t, right lanes in-t.The gap is the minimum distance between road A's cross section and road B's. Lane offset is handled by construction, so the slack term is gone.
Details:
<width>evaluation picks the record covering the station, sosOffsetspans are respected,contactPointtries both of the target's ends and takes the nearer, rather than inventing a defect the document never asserted.Comparing minimum distance asks whether the two sections touch, not whether they are congruent. That is deliberate: lane counts and widths differ across a link at merges, ramps and junction connectors (91 of 156 links on one measured map), so requiring congruence would trade one class of false positive for another. A road whose lanes are wholly displaced from its neighbour's is still reported.
Default threshold is 0.3 m, down from 0.5, now that the measurement is direct rather than a proxy with slack.
Evidence
swhile the lanes meet exactly — the old rule warned, the new one reports nothing.<width>spans, differing lane counts, a missingcontactPoint, and a caller-supplied threshold.Suite: 438 passed / 6 skipped,
tsc --noEmitclean.