fix(failsafe): allow recovery to NORMAL from RETURN_TO_SAFE, not just HOLD_AND_RECOVER

This commit is contained in:
Grant 2026-07-11 14:14:30 +02:00
parent d8546413d1
commit 1b0050dd6f

View File

@ -465,8 +465,17 @@ class FailsafeMonitor(Node):
'complete current task, no new panels' 'complete current task, no new panels'
) )
# All clear — return to NORMAL if previously in HOLD_AND_RECOVER # All clear — recover to NORMAL from any transient failsafe state.
if self.fsm_state == FSMState.HOLD_AND_RECOVER: # This block is only reached when every higher-priority condition
# above has cleared (each returns early while active), so reaching
# here means the vehicle is once again capable. Both HOLD_AND_RECOVER
# and RETURN_TO_SAFE are recoverable: without RETURN_TO_SAFE here it
# becomes a terminal trap (the FSM never leaves it even after the
# triggering condition clears). NOTE: this is the simple mode-blind
# recovery. Mode-dependent recovery (AUV commits to recovery, ROV
# hands to operator at AMBER) is a separate future change once the
# monitor reads the mode profile — see DIR.
if self.fsm_state in (FSMState.HOLD_AND_RECOVER, FSMState.RETURN_TO_SAFE):
self.get_logger().info('Conditions cleared — returning to NORMAL') self.get_logger().info('Conditions cleared — returning to NORMAL')
self.fsm_state = FSMState.NORMAL self.fsm_state = FSMState.NORMAL
self.hold_recover_start = None self.hold_recover_start = None