295efa2d83
End-to-end implementation per docs/sprint-2-plan.md.
Builds: pio run -e esp32-dev SUCCESS, RAM 6.8%, Flash 26.8% (351 KB).
Tests: pytest 129/129 green (110 Sprint 1 + 19 Sprint 2).
Python (arautopilot/studio/simulator/):
- rudder_dynamics.py: marine-realistic physical model of a hydraulic
rudder actuator. Defaults tuned so 100 % PWM produces steady-state
v_max ~5 deg/s, matching the brief's "typical 3-6 dps" for a 30 m
yacht. Includes deadband, min-useful PWM snap, port/stbd asymmetry,
end-stops, optional external torque, RunRecorder helper.
- pid_inner.py: pure-Python reference PID. Anti-windup via back-
calculation, setpoint rate limit, setpoint deadband, derivative LPF,
actuator non-linearity compensation. This module is the algorithmic
source of truth; C++ firmware is a line-by-line port.
Firmware (firmware/ar_autopilot_v1/src/pid/):
- pid_inner.h: header-only C++17 controller, byte-equivalent port of
pid_inner.py. Compiles on ESP32 toolchain AND on host g++/clang/MSVC
(no Arduino dependencies) -- ready for native Unity cross-validation
once a host compiler is installed.
- pid_inner_task.{h,cpp}: FreeRTOS task wrapper. 50 Hz on Core 1
(real-time core). Subscribes to TWDT, bleeds integrator during
STANDBY, surfaces telemetry + tunables via the Modbus slave.
Modbus map (regenerated from YAML):
- 6 new INPUT registers (40-45): setpoint, output, error, kp/ki/kd live
- 4 new HOLDING registers (16-19): writable setpoint + kp/ki/kd req
(writes propagate atomically; zero kp rejected as ILLEGAL_DATA_VALUE)
Tests:
- test_rudder_simulator.py: 9 tests (zero-input rest, full deflection,
end-stop saturation, deadband, min-useful snap, asymmetry, recorder
API, invalid dt, end-stop velocity zeroing).
- test_pid_inner_python.py: 10 tests (positive/negative step response,
setpoint deadband holds, anti-windup bounds under saturation,
allowed=false bleeds integrator, actuator deadband + asymmetry
compensation, output saturation, rate limit, disturbance rejection).
NOT in Sprint 2 (intentional per brief sec. 12):
- Outer heading PID, gain scheduling by SOG, ROT feed-forward
(those land in Sprint 3)
- Cross-validation tests via ctypes (need host C++ compiler that
this Windows machine lacks; algorithmic parity enforced by review)
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
146 lines
3.4 KiB
Plaintext
146 lines
3.4 KiB
Plaintext
# ============================================================================
|
|
# AR-Autopilot — .gitignore
|
|
# ============================================================================
|
|
|
|
# ----------------------------------------------------------------------------
|
|
# Python
|
|
# ----------------------------------------------------------------------------
|
|
__pycache__/
|
|
*.py[cod]
|
|
*$py.class
|
|
*.so
|
|
.Python
|
|
build/
|
|
develop-eggs/
|
|
dist/
|
|
downloads/
|
|
eggs/
|
|
.eggs/
|
|
lib/
|
|
lib64/
|
|
parts/
|
|
sdist/
|
|
var/
|
|
wheels/
|
|
share/python-wheels/
|
|
*.egg-info/
|
|
.installed.cfg
|
|
*.egg
|
|
MANIFEST
|
|
|
|
# Virtual environments
|
|
.venv/
|
|
venv/
|
|
env/
|
|
ENV/
|
|
.env
|
|
|
|
# pytest / coverage / mypy / ruff
|
|
.pytest_cache/
|
|
.coverage
|
|
.coverage.*
|
|
htmlcov/
|
|
.tox/
|
|
.nox/
|
|
coverage.xml
|
|
*.cover
|
|
.hypothesis/
|
|
.mypy_cache/
|
|
.dmypy.json
|
|
dmypy.json
|
|
.ruff_cache/
|
|
|
|
# Jupyter
|
|
.ipynb_checkpoints/
|
|
|
|
# ----------------------------------------------------------------------------
|
|
# Flutter / Dart (display app)
|
|
# ----------------------------------------------------------------------------
|
|
display/.dart_tool/
|
|
display/.flutter-plugins
|
|
display/.flutter-plugins-dependencies
|
|
display/.packages
|
|
display/.pub-cache/
|
|
display/.pub/
|
|
display/build/
|
|
display/**/build/
|
|
display/**/.dart_tool/
|
|
display/**/.idea/
|
|
display/**/*.iml
|
|
display/ios/Pods/
|
|
display/ios/.symlinks/
|
|
display/android/.gradle/
|
|
display/android/local.properties
|
|
display/android/captures/
|
|
display/android/gradlew
|
|
display/android/gradlew.bat
|
|
display/android/gradle-wrapper.jar
|
|
display/windows/flutter/ephemeral/
|
|
display/linux/flutter/ephemeral/
|
|
display/macos/Flutter/ephemeral/
|
|
|
|
# ----------------------------------------------------------------------------
|
|
# PlatformIO / ESP32 firmware
|
|
# ----------------------------------------------------------------------------
|
|
firmware/**/.pio/
|
|
firmware/**/.pioenvs/
|
|
firmware/**/.piolibdeps/
|
|
firmware/**/.vscode/
|
|
firmware/**/.clang_complete
|
|
firmware/**/.gcc-flags.json
|
|
|
|
# ----------------------------------------------------------------------------
|
|
# IDEs / Editors
|
|
# ----------------------------------------------------------------------------
|
|
.idea/
|
|
.vscode/
|
|
*.swp
|
|
*.swo
|
|
*~
|
|
.project
|
|
.pydevproject
|
|
.settings/
|
|
|
|
# ----------------------------------------------------------------------------
|
|
# OS files
|
|
# ----------------------------------------------------------------------------
|
|
.DS_Store
|
|
Thumbs.db
|
|
Desktop.ini
|
|
*.lnk
|
|
|
|
# ----------------------------------------------------------------------------
|
|
# Build artifacts / installers
|
|
# ----------------------------------------------------------------------------
|
|
installer/output/
|
|
installer/build/
|
|
*.msi
|
|
*.exe
|
|
*.appack
|
|
|
|
# ----------------------------------------------------------------------------
|
|
# Local config / secrets
|
|
# ----------------------------------------------------------------------------
|
|
*.local.yaml
|
|
*.local.json
|
|
secrets/
|
|
.env.local
|
|
.secrets/
|
|
|
|
# ----------------------------------------------------------------------------
|
|
# Examples output
|
|
# ----------------------------------------------------------------------------
|
|
examples/output/
|
|
|
|
# ----------------------------------------------------------------------------
|
|
# Logs
|
|
# ----------------------------------------------------------------------------
|
|
*.log
|
|
logs/
|
|
|
|
# ----------------------------------------------------------------------------
|
|
# Claude Code local settings + worktrees (personal — not committed)
|
|
# ----------------------------------------------------------------------------
|
|
.claude/settings.local.json
|
|
.claude/worktrees/
|