Bind Nav2 route transitions to current observed body support

Return a separate positive-surface body receipt before reaching a guide vertex. Keep mission arrival and command admission independent, reject stale transaction reuse, and include the bridge helper in module identity. Validate the actual Nav2 plan entry with observed, unknown and obstructed support.
This commit is contained in:
DCCONSTRUCTIONS
2026-10-08 23:54:38 +03:00
parent 31b74e4571
commit a14158e483
8 changed files with 128 additions and 4 deletions
@@ -0,0 +1,24 @@
"""Current observed body support for an intent transition, never a drive goal."""
import math
import numpy as np
def route_support(monitor, observed, value, inputs):
target = value.get("route_transition_target")
if target is None:
return None
pose = np.asarray(value["pose"], dtype=float)
target = np.asarray(target, dtype=float)
if (target.shape != (2,) or not np.isfinite(target).all()
or math.dist(pose[:2], target) > 3.5
or value["execution_inputs_sha256"] != inputs["sha256"]):
raise ValueError("Invalid route transition observation")
support = observed["permitted_terrain"]
receipt = monitor.assess_pose(observed["terrain"], pose,
value["body_contact_height_m"], support_terrain=support)
return {**receipt, "positive_surface_required": True,
"authority": "current-body; intent-transition-only",
"observation": dict(pose=pose.tolist(), target_xy=target.tolist(),
simulation_time_seconds=value["simulation_time_seconds"],
execution_inputs_sha256=inputs["sha256"])}
+10
View File
@@ -27,6 +27,7 @@ from navigation.route_observation import route_observation
from navigation.support_policy import SupportPolicy
from observed_collision import ObservedCollision
from rig_collision import collision_geometry
from route_support import route_support
from ros_navigation import RosNavigation, yaw_of
from std_srvs.srv import Trigger
from terrain_process import TerrainProcess
@@ -98,6 +99,12 @@ class Navigation:
return None
def plan(self, value):
# Transaction-local metadata cannot survive a stale/failed observation.
receipts = {}
result = self._plan(value, receipts)
return {**result, **receipts}
def _plan(self, value, receipts):
entered = time.monotonic()
if self.failure:
raise RuntimeError(self.failure)
@@ -130,6 +137,9 @@ class Navigation:
detected=observed['detected']):
return self.reply('stale-range')
route = route_observation(terrain, pose, value, self.monitor.max_step)
support = route_support(self.monitor, observed, value, self.inputs)
if support is not None:
receipts["route_support"] = support
orientation = validate_orientation(value.get('orientation_target'))
target = value.get('arrival_target')
if target is not None:
@@ -133,6 +133,8 @@ class TerrainObservation:
points, forbidden = self.semantics.apply(points, time.monotonic())
search, _ = self.support_obstacles.apply(points, pose=pose, monitor=self.monitor)
return dict(terrain=points, search_terrain=search, physical_terrain=physical, detected=detected,
permitted_terrain=(self.semantics.permitted_terrain(points, time.monotonic())
if request.get("route_transition_target") is not None else None),
current_points=current,
metrics=dict(detection_candidates=len(candidates),
detection_ground_returns=len(candidates)-len(detected),
+4 -1
View File
@@ -831,6 +831,8 @@ class ComposedInference:
"arrival_target": arrival_target
if arrival_candidate or body_goal_query
else None,
"route_transition_target": arrival_target
if nearby and isinstance(self.mission, RoutedMission) else None,
"max_speed_mps": min(self.max_speed, 0.1)
if intent["state"] == "reversing" or intent.get("corner_approach")
else min(self.max_speed, inputs.get("source.crossing-admission", {}).get("speed_limit_mps") or self.max_speed),
@@ -931,7 +933,8 @@ class ComposedInference:
intent = self.mission.intent(self.mission.state)
elif isinstance(self.mission, RoutedMission) and revision is None:
transition = self.mission.confirm_corridor_transition(
pose, inputs["source.simulation-time"], result.get("arrival") or {}
pose, inputs["source.simulation-time"],
result.get("route_support") or result.get("arrival") or {}
)
if transition is not None:
result.update(