From e1fa0f8e2d31ca06f85f9892c4a49ed40e69e539 Mon Sep 17 00:00:00 2001 From: DCCONSTRUCTIONS Date: Sat, 10 Oct 2026 04:00:55 +0300 Subject: [PATCH] Admit observed crossing areas before the unknown-road planning boundary --- simulation/ai-polygon/urban_crossing.py | 11 ++++++++--- tests/test_marked_crossing.py | 26 +++++++++++++++++++++++++ 2 files changed, 34 insertions(+), 3 deletions(-) diff --git a/simulation/ai-polygon/urban_crossing.py b/simulation/ai-polygon/urban_crossing.py index c8f07998..af49a981 100644 --- a/simulation/ai-polygon/urban_crossing.py +++ b/simulation/ai-polygon/urban_crossing.py @@ -1,7 +1,7 @@ """Observed crossing-area permission for the static simulation contour. A zebra is an area, not a set of paint islands. Admission retains a bounded -metric footprint after a measured entry stop and observed sidewalk exit. Only +metric footprint after a measured approach stop and observed sidewalk exit. Only current ground returns inside it can override unknown/carriageway semantics. This is not traffic right-of-way: range, body, freshness and object vetoes remain independent. Moving traffic needs a separately qualified gap/occlusion policy. @@ -120,8 +120,13 @@ class MarkedCrossing: if not exit_seen: state['state'] = 'incomplete-crossing' continue - if np.linalg.norm(patch, axis=1).min() > self.geometry['length_m']/2+1.25: - continue + # Semantic permission must be established before native planning + # can approach across the road's unknown-cell inflation boundary. + # Requiring proximity to paint creates a circular precondition: + # motion needs permission, permission needs the forbidden motion. + # The measured footprint, exit and stopped observation bound this + # static-scene exception; it never grants the intervening road or + # replaces current swept-body/support/object admission. if self.stopped_since is None or now-self.stopped_since < self.stop_seconds: return {**state, 'state': 'waiting-for-stop'} # Connect marking to observed pedestrian entry/exit within the same diff --git a/tests/test_marked_crossing.py b/tests/test_marked_crossing.py index c2665c12..d6b919d0 100644 --- a/tests/test_marked_crossing.py +++ b/tests/test_marked_crossing.py @@ -193,3 +193,29 @@ def test_wide_crossing_requires_measured_exit_within_declared_horizon(module): current = module.MarkedCrossing(geometry, observation_range_m=20.) labels[pixels[0][points[:,0]>=16.], pixels[1][points[:,0]>=16.]] = 0 assert not enter(current, data)[1]["admitted"] + + +def test_observed_crossing_can_be_admitted_before_unknown_inflation_boundary(module): + labels, points, pixels, pose = scene() + # The native planner may stop before a painted stripe because the road + # around it is still unknown. Permission must not require first entering + # that denied area. Use an offset entry; no extra ground is supplied. + points[:, 0] += 1.6 + g = gate(module) + mask, state = enter(g, (labels, points, pixels, pose)) + assert state['admitted'] + assert mask[pixels][labels[pixels] == 3].all() + # The permission remains on the reconstructed area, not the approach gap, + # unrelated road, or an object standing on the admitted crossing. + probe = np.array([[1., 0., 0.], [4., 0., 0.], [4., 2., 0.], [4., 0., .5]]) + assert g.ground_mask(probe).tolist() == [False, True, False, False] + + +def test_more_distant_crossing_still_requires_a_measured_stop(module): + labels, points, pixels, pose = scene() + points[:, 0] += 1.6 + g = gate(module) + for index in range(5): + pose[0] = .1 * index + mask, state = g.observe(labels, points, pixels, pose, 10. + .4*index) + assert not state['admitted'] and not mask.any()