Retain observed passage intent through range crop changes
This commit is contained in:
@@ -349,7 +349,7 @@ class ObservedGoals:
|
||||
offsets = np.linspace(-geometry["width_m"] / 2, geometry["width_m"] / 2,
|
||||
math.ceil(geometry["width_m"] / 0.1) + 1)
|
||||
|
||||
def supported(point):
|
||||
def supported(point, support=permitted, *, source="current-range-and-observed-semantic-memory"):
|
||||
bearing = point[:2]-pose[:2]
|
||||
bearing /= max(np.linalg.norm(bearing), 1e-9)
|
||||
lateral = np.array([-bearing[1], bearing[0]])
|
||||
@@ -357,29 +357,44 @@ class ObservedGoals:
|
||||
# Bind each lateral query to measured, permitted ground at its own
|
||||
# height. Do not copy the centre elevation across a cross-slope or
|
||||
# project a sidewalk label through an overhang onto another floor.
|
||||
distances = np.linalg.norm(across[:,None,:]-permitted[None,:,:2],axis=2)
|
||||
distances = np.linalg.norm(across[:,None,:]-support[None,:,:2],axis=2)
|
||||
nearest = np.argmin(distances,axis=1)
|
||||
if np.any(distances[np.arange(len(across)),nearest] > .15):
|
||||
return False
|
||||
keys = [tuple(cell) for cell in self.surface.cell_keys(permitted[nearest])]
|
||||
keys = [tuple(cell) for cell in self.surface.cell_keys(support[nearest])]
|
||||
self.evidence = {
|
||||
"source": "current-range-and-observed-semantic-memory",
|
||||
"source": source,
|
||||
"goal": point.tolist(),
|
||||
"oldest_surface_age_seconds": max(now - allowed[key] for key in keys),
|
||||
"authority": "intent-only; native swept-obstacle-and-support-admission-required",
|
||||
}
|
||||
return True
|
||||
|
||||
# A lens switch cannot replace a currently measured, permitted goal.
|
||||
# A new prohibition, missing current range or changed corridor can.
|
||||
# A selected passage is a spatial intention, not a fresh sensor return.
|
||||
# Retain its actually observed surface through a changing range crop.
|
||||
# Current geometry still owns every native obstacle/support admission;
|
||||
# this memory never enters that physical terrain or renews a timestamp.
|
||||
remembered = np.array([point for key, point in self.measured.items()
|
||||
if key in allowed], dtype=float).reshape(-1, 3)
|
||||
if len(remembered):
|
||||
local = np.linalg.norm(remembered[:, :2]-pose[:2], axis=1)
|
||||
remembered = remembered[(local <= 6.) & (np.abs(remembered[:, 2] -
|
||||
(pose[2]-geometry['body_contact_height_m'])) <= geometry.get('max_step_m', .1)
|
||||
+ local*math.tan(math.radians(geometry['max_slope_degrees'])))]
|
||||
if candidate_mask is not None:
|
||||
remembered = remembered[candidate_mask(remembered)]
|
||||
passage_points = np.concatenate((permitted, remembered))
|
||||
retain = None
|
||||
if prior is not None:
|
||||
before = np.asarray(prior, dtype=float)
|
||||
matched = np.linalg.norm(candidates - before, axis=1) <= 0.15
|
||||
if (math.dist(before[:2], pose[:2]) > 0.8 and matched.any()
|
||||
cell = tuple(self.surface.cell_keys(before[None])[0])
|
||||
matched = np.linalg.norm(passage_points - before, axis=1) <= 0.15
|
||||
if (0.8 < math.dist(before[:2], pose[:2]) <= 3.5
|
||||
and math.dist(before[:2], target) < remaining - 0.1
|
||||
and cell in allowed and matched.any()
|
||||
and all(math.dist(before[:2], failed[:2]) > 0.6 for failed in excluded)
|
||||
and (candidate_mask is None or candidate_mask(before[None])[0])
|
||||
and supported(before)):
|
||||
and supported(before, passage_points, source="retained-observed-passage")):
|
||||
retain = before
|
||||
horizon = min(remaining, 3.5)
|
||||
retained_clearance = (self.approach_clearance(
|
||||
@@ -395,20 +410,8 @@ 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 sensor crop edge is not a passage boundary. Preserve the spatial
|
||||
# extent of still-positive measured surface cells when choosing intent.
|
||||
# Current range above still owns candidate selection/lateral support;
|
||||
# this memory cannot certify a drive goal or admit any motion.
|
||||
remembered = np.array([point for key, point in self.measured.items()
|
||||
if key in allowed], dtype=float).reshape(-1, 3)
|
||||
if len(remembered):
|
||||
distance = np.linalg.norm(remembered[:, :2]-pose[:2], axis=1)
|
||||
remembered = remembered[(distance <= 6.) & (np.abs(remembered[:, 2] -
|
||||
(pose[2]-geometry['body_contact_height_m'])) <= geometry.get('max_step_m', .1)
|
||||
+ distance*math.tan(math.radians(geometry['max_slope_degrees'])))]
|
||||
if candidate_mask is not None:
|
||||
remembered = remembered[candidate_mask(remembered)]
|
||||
passage_points = np.concatenate((permitted, remembered))
|
||||
# Retained measured extent supplies the passage boundaries. New goals
|
||||
# still require current range support, independently of prior retention.
|
||||
for passages in passage_centres(passage_points, pose, target, geometry, obstacles):
|
||||
for passage in passages:
|
||||
distance = np.linalg.norm(candidates[:, :2]-passage['xy'], axis=1)
|
||||
|
||||
@@ -589,9 +589,9 @@ class ComposedInference:
|
||||
calibration = inputs["source.camera.calibration"]
|
||||
if observed_goals is not None:
|
||||
# Every lens contributes to the same causal surface memory.
|
||||
# The current range packet must still measure the proposed goal.
|
||||
# This is a newly assessed spatial intent, not a timestamp renewal
|
||||
# of the previous image-space goal during a survey.
|
||||
# New destinations need current range; an observed passage can
|
||||
# retain its intent across a changing crop without renewing its
|
||||
# evidence. Native live body/support admission remains separate.
|
||||
return observed_goals.choose(
|
||||
inputs["source.lidar"], inputs["source.pose"], target,
|
||||
None if prior_was_approach else prior, excluded, self.geometry,
|
||||
|
||||
Reference in New Issue
Block a user