sprint-9: integration tests + hardening + operator manual

Integration tests (64 new tests, 462 total):
- test_integration_cascade: full cascade closed-loop simulation --
  outer PID → inner PID → rudder dynamics → vessel heading; verifies
  convergence across small/90°/180° turns, wrap-around, and low speed
- test_integration_ekf_pid: EKF-smoothed heading feeding outer PID;
  confirms EKF reduces rudder total-variation vs raw noisy heading
- test_integration_alarm_audit: alarm engine → audit log hash-chain;
  verify, tamper detection, cross-session reload, multi-alarm logging
- test_modbus_utils: 38 tests for scale/raw conversion, bounds checking,
  heading/rudder helpers, signed int16 two's-complement round-trip

Hardening:
- heading_ekf: guard NaN/inf in update_heading() and update_rot() -- skip
  bad measurements silently rather than corrupting filter state
- adaptive_tuner: guard NaN/inf in step() -- ignore corrupt error samples
- modbus_utils.py: new shared module with scale_to_raw, scale_to_raw_signed,
  raw_signed_to_scaled, clamp_uint16, validate_holding_write,
  heading_deg_to_raw, rudder_deg_to_raw_signed

Documentation:
- docs/operator_manual.md: 15-section operator manual covering safety,
  installation, all operating modes, alarm reference, commissioning,
  fault-finding, Modbus register summary, and activation/audit log procedure

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-20 03:35:23 -04:00
parent 45642fda0e
commit a2f3e82f17
8 changed files with 1056 additions and 0 deletions
+3
View File
@@ -23,6 +23,7 @@ Usage::
from __future__ import annotations
import math
from dataclasses import dataclass, field
from arautopilot.core.pid_config import PidConfig, PidGains
@@ -75,6 +76,8 @@ class AdaptiveTuner:
"""
if not self.config.adaptive_enabled:
return None
if not math.isfinite(error_deg):
return None
self._error_buffer.append(error_deg)
if len(self._error_buffer) > self.window_steps: