Separate Nav2 body collision from ground search costs

This commit is contained in:
DCCONSTRUCTIONS
2026-10-09 12:22:26 +03:00
parent 39dd3bb551
commit 51406fc90c
6 changed files with 192 additions and 7 deletions
+31
View File
@@ -264,3 +264,34 @@ def test_unbound_or_unsuccessful_result_cannot_complete_local_recovery(mismatch)
r.observe_navigation(receipt, position, now, key, run)
r.tick(position, now+.1, choose)
assert r.active and r.selected == selected
@pytest.mark.parametrize('reverse', [False, True])
@pytest.mark.parametrize('mismatch', [None, 'run', 'time', 'pose', 'option', 'goal', 'kind',
'missing', 'nonzero', 'status'])
def test_only_bound_native_abort_retires_the_local_option(reverse, mismatch):
r = ObservedRecovery()
r.begin(pose(), 0, [])
selected = dict(goal=[-2. if reverse else 2., 0., 0.], reverse=reverse)
choose = lambda *_: selected
survey(r, pose(), choose)
position, now = pose(), 2.
receipt = completed_path(position, now, selected['goal'])
receipt.update(status='blocked', diagnostic=dict(failure='native-action-aborted'))
receipt['action_result'].update(status='aborted', kind='backup' if reverse else 'path')
key, run = (r.sequence, r.option), 'run'
if mismatch == 'run': run = 'another-run'
elif mismatch == 'time': now += .1
elif mismatch == 'pose': position = pose(.1)
elif mismatch == 'option': key = (r.sequence, r.option+1)
elif mismatch == 'goal': receipt['action_result']['goal_xy'] = [9., 0.]
elif mismatch == 'kind': receipt['action_result']['kind'] = 'spin'
elif mismatch == 'missing': receipt.pop('action_result')
elif mismatch == 'nonzero': receipt['speed_mps'] = .1
elif mismatch == 'status': receipt['status'] = 'waiting-for-plan'
r.observe_navigation(receipt, position, now, key, run)
assert r.blocked_option is (mismatch is None)
assert r.completion is None
if mismatch is None:
assert r.tick(position, now+.1, choose)[0] is None
assert r.excluded == [selected['goal']]