Reconsider transient native planner rejections after bounded backoff
This commit is contained in:
@@ -297,3 +297,53 @@ def test_native_abort_keeps_task_arrival_evidence_and_requires_new_observation()
|
||||
assert mission.goal == first and mission.failed_goals == []
|
||||
assert mission.update(pose(), .1, lambda *_: None)[0] is None
|
||||
assert mission.index == 0 and mission.fault is None
|
||||
|
||||
|
||||
def test_aborted_goal_can_be_reobserved_after_backoff_without_progress_credit():
|
||||
mission = WaypointMission([[8, 0]])
|
||||
measured = [2., 0., 0.]
|
||||
visible = True
|
||||
|
||||
def choose(_target, _prior, excluded):
|
||||
return measured if visible and measured not in excluded else None
|
||||
|
||||
mission.update(pose(), 0, choose)
|
||||
mission.reject_local_plan(aborted_plan(measured, pose(), 0), pose(), 0, "run")
|
||||
assert mission.update(pose(), 1.9, choose)[0] is None
|
||||
# Expiry itself supplies neither a destination nor surface permission.
|
||||
visible = False
|
||||
assert mission.update(pose(), 2., choose)[0] is None
|
||||
assert mission.goal is None and mission.anchor_time == 0 and mission.attempts == 0
|
||||
visible = True
|
||||
assert mission.update(pose(), 2.1, choose)[0] == measured
|
||||
assert mission.anchor_time == 0 and mission.attempts == 0
|
||||
assert mission.index == 0 and mission.fault is None
|
||||
|
||||
|
||||
def test_repeated_abort_refreshes_backoff_but_not_stall_deadline():
|
||||
mission = WaypointMission([[8, 0]])
|
||||
measured = [2., 0., 0.]
|
||||
choose = lambda _target, _prior, excluded: measured if measured not in excluded else None
|
||||
for seconds in (0., 2., 4., 6.):
|
||||
assert mission.update(pose(), seconds, choose)[0] == measured
|
||||
mission.reject_local_plan(aborted_plan(measured, pose(), seconds), pose(), seconds, "run")
|
||||
assert mission.update(pose(), seconds + 1., choose)[0] is None
|
||||
assert mission.anchor_time == 0
|
||||
mission.update(pose(), 8., choose)
|
||||
assert mission.attempts == 1
|
||||
|
||||
|
||||
def test_native_backoff_does_not_clear_current_recovery_round_or_motion_failures():
|
||||
mission = WaypointMission([[8, 0]])
|
||||
first, _ = mission.update(pose(), 0, goal)
|
||||
mission.reject_local_plan(aborted_plan(first, pose(), 0), pose(), 0, "run")
|
||||
other = [3., 1., 0.]
|
||||
mission.failed_goals.append(other) # A progress failure, not a planner abort.
|
||||
mission.recovery.begin(pose(), 1., mission.failed_goals)
|
||||
mission.retry_native_goals(3.)
|
||||
assert mission.failed_goals == [first, other]
|
||||
assert mission.recovery.excluded == [first, other]
|
||||
mission.recovery.phase = "idle"
|
||||
mission.retry_native_goals(3.)
|
||||
assert mission.failed_goals == [other]
|
||||
assert mission.attempts == 0 and mission.anchor_time == 0
|
||||
|
||||
Reference in New Issue
Block a user