Align native planning clearance and admit observed tracked pivots

This commit is contained in:
DCCONSTRUCTIONS
2026-10-08 21:14:12 +03:00
parent 7f87b5aa4d
commit 012286e972
12 changed files with 518 additions and 13 deletions
@@ -342,7 +342,8 @@ def registry(adapter_root: Path) -> ModuleRegistry:
"support_obstacles.py", "semantic_surface.py", "observed_space.py", "range_image.py",
"detection_obstacles.py", "route_observation.py", "arrival_approach.py", "pcl_ground.py")
runtime = ("configuration.py", "nodes.py", "observed_collision.py", "ros_navigation.py",
"server.py", "terrain_node.py", "terrain_observation.py", "terrain_process.py")
"server.py", "terrain_node.py", "terrain_observation.py", "terrain_process.py",
"detector_exclusion.py", "differential_motion.py")
files = [adapter_root/"nav2"/name for name in runtime]
files += [adapter_root/"navigation"/name for name in shared]
files += [adapter_root/name for name in ("model_stack.py", "navigation_client.py", "rig_collision.py")]
@@ -42,6 +42,7 @@ class WaypointMission:
self.turn_started = self.turn_goal = self.turn_best_error = None
self.recovery = ObservedRecovery()
self.last_recovery_attempt = None
self.local_alignment = None
def heading_progress(self, pose, seconds):
"""Credit new best alignment within the existing bounded turn budget.
@@ -90,7 +91,28 @@ class WaypointMission:
return True
return False
def observe_alignment(self, result, pose, seconds, execution_inputs_sha256):
"""Bind heading progress to the native local Spin, without crediting travel."""
self.local_alignment = None
if (self.recovery.active or self.goal is None or self.last_time != seconds
or self.last_pose != tuple(pose)):
return
expected = dict(pose=list(pose), simulation_time_seconds=seconds,
execution_inputs_sha256=execution_inputs_sha256)
owner = result.get("controller_goal") or []
if (result.get("route_observation", {}).get("observation") == expected
and result.get("status") == "path" and result.get("speed_mps") == 0.
and len(owner) == 3 and owner[0] == "align"
and list(owner[1]) == list(self.goal[:2])):
self.local_alignment = dict(key=("native-align", tuple(owner[1])),
xy=list(owner[1]), seconds=seconds)
def progress_orientation_target(self, seconds):
local = self.local_alignment
if (local is not None and self.goal is not None
and local["xy"] == list(self.goal[:2])
and 0 <= seconds-local["seconds"] <= 1.):
return {"key": local["key"], "xy": local["xy"]}
return self.orientation_target()
def resume(self):
@@ -296,7 +296,7 @@ class RoutedMission(WaypointMission):
self.body_approach = (orientation["key"], tuple(goal[:2]), seconds)
def progress_orientation_target(self, seconds):
orientation = self.orientation_target()
orientation = super().progress_orientation_target(seconds)
if self.body_approach is not None and orientation is not None:
key, goal, captured = self.body_approach
if key == orientation["key"] and 0 <= seconds - captured <= 0.8: