Advance observed passage intent without repeated lateral retargeting
This commit is contained in:
@@ -281,18 +281,7 @@ class Navigation:
|
||||
if (key != self.action_key or not continuing or self.path is None
|
||||
or self.node.native_command() is None
|
||||
or entered-self.path_planned_at >= 1.0):
|
||||
heading = math.atan2(goal[1]-pose[1], goal[0]-pose[0])
|
||||
if (value.get('continuous', False) and target is None
|
||||
and not value.get('recovery_orientation', False)
|
||||
and orientation is not None and 'direction_xy' in orientation):
|
||||
# The observed passage selects XY; the declared continuation
|
||||
# supplies its through-travel heading. Re-aiming the terminal
|
||||
# body toward a nearby lateral XY each replan makes the
|
||||
# approach progressively tighter instead of rejoining travel.
|
||||
# Smac still checks the complete path and footprint, and the
|
||||
# live support/collision gates retain all motion authority.
|
||||
heading = math.atan2(*reversed(orientation['direction_xy']))
|
||||
path, status = self.node.plan(pose, goal, heading)
|
||||
path, status = self.node.plan(pose, goal, math.atan2(goal[1]-pose[1],goal[0]-pose[0]))
|
||||
if path is None or len(path.poses) < 2:
|
||||
self.stop()
|
||||
# Humble has no typed planner error code. Preserve its
|
||||
|
||||
@@ -389,6 +389,38 @@ class ObservedGoals:
|
||||
before = np.asarray(prior, dtype=float)
|
||||
cell = tuple(self.surface.cell_keys(before[None])[0])
|
||||
matched = np.linalg.norm(passage_points - before, axis=1) <= 0.15
|
||||
# A routed local passage is a through-intent, not a succession of
|
||||
# stopping points. Advance its lookahead along the selected
|
||||
# continuation before the chassis starts chasing a near lateral
|
||||
# endpoint. A changed visible extent alone must not re-elect the
|
||||
# lateral centre on every reached point.
|
||||
# The projected XY is only a query: return an actual permitted
|
||||
# range sample, with the existing width and obstacle checks. Never
|
||||
# extrapolate range, terrain permission, or a motion certificate.
|
||||
if travel_direction is not None and cell in allowed and matched.any():
|
||||
continuation = np.asarray(travel_direction, dtype=float)
|
||||
if (continuation.shape != (2,) or not np.isfinite(continuation).all()
|
||||
or np.linalg.norm(continuation) <= 1e-9):
|
||||
raise ValueError("Invalid passage travel direction")
|
||||
continuation = continuation / np.linalg.norm(continuation)
|
||||
along = float((before[:2]-pose[:2]) @ continuation)
|
||||
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
|
||||
nearby = np.linalg.norm(candidates[:, :2]-query, axis=1)
|
||||
for index in np.argsort(nearby, kind="stable"):
|
||||
if nearby[index] > .15:
|
||||
break
|
||||
selected = candidates[index]
|
||||
clearance = self.approach_clearance(selected[None], pose, geometry, now,
|
||||
lookahead_m=min(remaining, 3.5))[0]
|
||||
if clearance < geometry['width_m'] or not supported(selected,
|
||||
source="continuing-observed-passage"):
|
||||
continue
|
||||
self.evidence['approach_clearance_m'] = (
|
||||
float(clearance) if math.isfinite(clearance) else None)
|
||||
return selected.tolist()
|
||||
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()
|
||||
|
||||
Reference in New Issue
Block a user