Prevent accumulated range sampling drift in observed passages

This commit is contained in:
DCCONSTRUCTIONS
2026-10-10 05:02:18 +03:00
parent 5a68240511
commit 3735f21fc2
2 changed files with 46 additions and 1 deletions
@@ -28,6 +28,7 @@ class ObservedGoals:
self.evidence = None
self.clearance_observation = None
self.clearance_index = None
self.continuation_anchor = None
def observe(self, samples, captured_at, pose, *, frame_id=None, capture_id=None):
if frame_id is not None and frame_id in self.seen_semantics:
@@ -407,7 +408,17 @@ class ObservedGoals:
advance = min(3., remaining)-along
if (along > 0 and advance >= float(self.surface.cell_size[0])
and all(math.dist(before[:2], failed[:2]) > 0.6 for failed in excluded)):
query = before[:2]+advance*continuation
# A range sample is a noisy representative of the chosen
# passage, not the origin of its next lateral coordinate.
# Reusing each snapped point accumulates sampling error
# into metres of drift along an otherwise straight aisle.
anchor = before[:2]
saved = self.continuation_anchor
if (saved is not None and np.array_equal(saved[2], before)
and np.allclose(saved[1], continuation, rtol=0, atol=1e-9)):
anchor = saved[0]
query = anchor + (float((pose[:2]-anchor) @ continuation)
+ min(3., remaining))*continuation
nearby = np.linalg.norm(candidates[:, :2]-query, axis=1)
for index in np.argsort(nearby, kind="stable"):
if nearby[index] > .15:
@@ -420,6 +431,7 @@ class ObservedGoals:
continue
self.evidence['approach_clearance_m'] = (
float(clearance) if math.isfinite(clearance) else None)
self.continuation_anchor = (anchor.copy(), continuation.copy(), selected.copy())
return selected.tolist()
if (0.8 < math.dist(before[:2], pose[:2]) <= 3.5
and math.dist(before[:2], target) < remaining - 0.1
@@ -442,6 +454,9 @@ class ObservedGoals:
observed = self.clearance_observation
obstacles = (observed[1] if observed is not None and 0 <= now-observed[0] <= .8
else np.empty((0, 2)))
# A blocked/replaced passage releases its old lateral reference. This
# memory never overrides current measured support or obstacle checks.
self.continuation_anchor = None
# New and retained goals share one measured world-space representation.
for passages in passage_centres(passage_points, pose, target, geometry, obstacles,
travel_direction=travel_direction):