fix(simulation): retire rejected Nav2 intermediate goals

This commit is contained in:
DCCONSTRUCTIONS
2026-10-08 15:29:41 +03:00
parent 1f1d4a2807
commit 021b9f427f
8 changed files with 120 additions and 9 deletions
@@ -245,6 +245,24 @@ def main():
changed=request('/plan',retreat)
assert changed['status']=='path' and 'action_result' not in changed,changed
report['new_goal_after_completion']=changed
# An unobserved destination is rejected by the native planner with
# allow_unknown=False. Report that exact action result to selection;
# do not mislabel it as a measured obstacle or retain the old command.
retreat.update(goal=[6.,0.,0.],observation_id='unobserved-local-goal')
rejected=request('/plan',retreat)
assert rejected['status']=='blocked' and rejected['diagnostic']['failure']=='no-path',rejected
assert rejected['planning_result']==dict(status='aborted',goal_xy=[6.,0.]),rejected
assert rejected['route_observation']['observation']==dict(pose=reached,
simulation_time_seconds=retreat['simulation_time_seconds'],
execution_inputs_sha256=inputs['sha256']),rejected
with condition:state.update(enabled=True,observation_id=retreat['observation_id'])
time.sleep(.1)
assert responses[-1]['speed_mps']==responses[-1]['yaw_rate_rps']==0.,responses[-1]
report['aborted_local_plan']=dict(plan=rejected,command=responses[-1])
retreat.update(goal=[1.8,.2,0.],observation_id='replacement-observed-goal')
replacement=request('/plan',retreat)
assert replacement['status']=='path' and 'planning_result' not in replacement,replacement
report['replacement_local_plan']=replacement
with condition:
state.update(pose=[0.,0.,.37,0.,0.,0.,1.],enabled=False)
retreat['pose']=[0.,0.,.37,0.,0.,0.,1.]
@@ -72,7 +72,7 @@ def main():
bridge.activate()
history=[]
for goal in ([5.,0.], [3.,1.]):
planned=bridge.plan(pose,goal,math.atan2(goal[1],goal[0]))
planned,status=bridge.plan(pose,goal,math.atan2(goal[1],goal[0]))
assert planned is not None and len(planned.poses)>1
proposed=bridge.follow(planned)
assert proposed is not None
+2 -1
View File
@@ -144,7 +144,8 @@ class RosNavigation(Node):
# Do not leave work from a timed-out HTTP transaction as authority.
self.await_result(handle.cancel_goal_async(), .2)
raise
return result.result.path if result.status == GoalStatus.STATUS_SUCCEEDED else None
return (result.result.path if result.status == GoalStatus.STATUS_SUCCEEDED else None,
result.status)
def accept(self, client, request, timeout, feedback_callback=None):
if self.failed:
+6 -2
View File
@@ -204,10 +204,14 @@ class Navigation:
# capture leases and command gates still refresh above/every tick.
if (not continuing or self.path is None or self.node.native_command() is None
or entered-self.path_planned_at >= 1.0):
path = self.node.plan(pose, goal, math.atan2(goal[1]-pose[1],goal[0]-pose[0]))
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.node.stop()
return self.reply('no-path', status='blocked', route_observation=route)
# Humble has no typed planner error code. Preserve its
# terminal abort without inventing an obstacle diagnosis.
feedback = (dict(planning_result=dict(status='aborted', goal_xy=goal[:2].tolist()))
if status == GoalStatus.STATUS_ABORTED else {})
return self.reply('no-path', status='blocked', route_observation=route, **feedback)
if not continuing:
with self.owner_lock:
self.action_key = None
@@ -837,6 +837,8 @@ class ComposedInference:
"allow_reverse": intent["state"] == "reversing",
},
)
self.mission.reject_local_plan(
result, pose, inputs["source.simulation-time"], self.inputs["sha256"])
self.mission.recovery.observe_navigation(
result, pose, inputs["source.simulation-time"],
recovery_option, self.inputs["sha256"],