Guide local goals around observed obstacles and finish native recovery

This commit is contained in:
DCCONSTRUCTIONS
2026-10-09 13:06:04 +03:00
parent 51406fc90c
commit ade3c19d2a
10 changed files with 281 additions and 12 deletions
+15 -5
View File
@@ -143,6 +143,15 @@ class Navigation:
detected=observed['detected']):
return self.reply('stale-range')
route = route_observation(terrain, pose, value, self.monitor.max_step)
# Return the same observed search obstacles used by Smac, as bounded
# intent guidance only. Goal selection must see unlabelled solids too.
hazards = observed['search_terrain']
hazards = hazards[hazards[:, 3] > self.monitor.max_step + 1e-4, :2]
if len(hazards):
_, indices = np.unique(np.floor(hazards / .05), axis=0, return_index=True)
hazards = hazards[np.sort(indices)]
receipts['clearance_observation'] = dict(
observation=route['observation'], obstacles_xy=hazards.tolist())
support = route_support(self.monitor, observed, value, self.inputs)
if support is not None:
receipts["route_support"] = support
@@ -183,7 +192,8 @@ class Navigation:
if (not reverse and value['translation_allowed'] and not aligning
and alignment_key != self.attempted_alignment):
turn = alignment_angle(pose, goal, terrain, observed['detected'], self.monitor,
value['body_contact_height_m'])
value['body_contact_height_m'],
collision_terrain=observed['collision_terrain'])
orienting = aligning or turn is not None or (not reverse and orientation is not None
and orientation_key != self.completed_orientation
and not value['translation_allowed'])
@@ -207,16 +217,16 @@ class Navigation:
self.attempted_alignment = alignment_key
local_path = [[0.,0.,0.],[0.,0.,0.]]
elif reverse:
key = ('backup', tuple(goal[:2]), limit)
completed = self.completed_action(key, route)
if completed is not None:
return completed
delta = goal[:2]-pose[:2]
heading = yaw_of(pose)
rear = -float(delta @ [math.cos(heading), math.sin(heading)])
if rear <= 0:
self.node.stop()
return self.reply('reverse-goal-is-not-behind', status='blocked')
key = ('backup', tuple(goal[:2]), limit)
completed = self.completed_action(key, route)
if completed is not None:
return completed
if key != self.action_key:
with self.owner_lock:
self.action_key = None