8 Commits

Author SHA1 Message Date
f21bcb7b11 Pitch-compensated lift feedforward: hold altitude under forward thrust
Reported symptom: the ship sinks as soon as it moves forward. Confirmed in
code -- altitude.lua had no pitch input at all. Pitch only fed the front/aft
differential; nothing compensated the common-mode lift. So when the propeller
pushes the nose up, the lift vector tilts with the hull and its vertical
component drops ~cos(pitch), and only the slow altitude integrator (~5-10 s)
fought it -> a multi-block sag every time you accelerate.

- altitude.lua takes measured pitch and boosts common-mode lift by 1/cos(pitch),
  bounded by cfg.pitchLiftMax (default 1.5 = full comp to ~48 deg, 1.0 = off).
  Sign-agnostic (cos is even); feedforward adds no loop gain so it can't
  destabilize -- altitude feedback still owns steady-state.
- FLY HUD shows the live boost (liftFF xN.NN); u_sum in fly.log reflects it.

Physically motivated but unverified against the mod's exact lift model: if lift
were world-vertical the ship would climb slightly on accel instead (feedback
corrects it) -- still better than sinking. Tune pitchLiftMax from flight.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-25 18:13:40 +02:00
3e27b3f52b Auto-resume flight across chunk unload/reload
When the ship's chunk unloads the CC computer powers off and its redstone
outputs reset to 0, so on return the ship dropped and the pilot had to
re-ENGAGE every time. Flight state now survives the reboot:

- engaged.txt flag written while flying, cleared on pilot STOP.
- On boot, if engaged + profile present: drive the hover baseline
  immediately (closes the fall gap), then runStandby(true) re-enters the
  flight loop automatically with the persisted target -- no manual ENGAGE.
- runFly drives hover before its first sleep so no entry path leaves a
  0-output gap.
- Cleanup no longer lifts a PARKED ship: Ctrl+T out of standby holds hover
  only when engaged, else valves off.
- engaged.txt registered as per-ship state (gitignore, installer keep/reset,
  menu reset, build excludes).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-25 17:55:15 +02:00
a94eff9283 Never reference the ground attitude -- a flight-built hull lies on its side
The attitude reference was captured at the first sensor read, on the ground,
where a ship built to fly typically lies over. That made every tilt reading
relative to a meaningless datum, and worse: the hull's natural righting swing
after liftoff was read both as tilt and as rate response, contaminating the
very measurement the test exists to make.

- Attitude reference is now taken in the air, after an explicit righting
  phase that waits for every axis rate to steady (5 s calm, 120 s cap).
  Until then maxTilt() reads 0, so nothing can trip on ground attitude.
- The settled airborne attitude is recorded and reported per axis, with a
  warning if the hull settles far from level even under balanced lift.
- Wizard now says outright that a ship lying over on the ground is fine.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-24 00:00:44 +02:00
81e558d04e Sign test v3: a crooked ship is the measurement, not a failure
The tilt abort was circular logic -- it demanded a balanced ship before it
would learn how to balance one. Removed entirely, and the test restructured
so imbalance is handled structurally rather than guarded against:

- Rocking probe: alternate front/aft pushes; sign = rate(+) - rate(-).
  A constant lean appears in both terms and cancels exactly, so no balanced
  baseline is needed. Alternating also keeps the ship rocking around its
  start attitude instead of accumulating tilt. Two agreeing cycles verify.
- New BALANCE phase: with the sign known, an integral loop learns the
  differential trim that actually levels this ship and saves it as the
  pitchTrim warm-start. Not converging is a warning, not a failure.
- maxTiltAbort is now "measurement is good enough, stop pushing" -- it ends
  a measurement early once the window is full, never the test.
- Only three failures remain: no lift, liftoff timeout, no response on any
  gimbal axis.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-23 23:56:20 +02:00
d012246d0c Sign test: measure ALL gimbal axes + self-healing altitude supervisor; link diagnostics
- Sign test measures rate response on every gimbal axis and picks the one
  that actually answers the differential push -> pitchIndex is now MEASURED
  per ship (build orientation no longer matters). Verified both-direction
  response accepted at half threshold. Tilt guard watches all axes.
- Altitude supervisor: drifting out of the measuring band re-centers and
  retries instead of aborting; single 7-min deadline. Faster hover trim
  (0.05 -> 0.12, matches verified Ki_climb) plus an 8 s settle phase.
- Single-balloon ships: sign test marks itself done, FLY zeroes u_diff.
- Cockpit terminal now explains link status (OFFLINE checklist); autopilot
  standby screen warns loudly when no modem is attached.
- Failure text points at cross-wired links (both burners firing on one pulse).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-23 23:45:11 +02:00
54963e5b42 One-command installer + guided setup: role detection, self-flying sign test v2
- install.lua: single entry point -- detects role from peripherals
  (flight sensors = autopilot, monitor = cockpit), installs, cleans
  legacy/removed files, then hands off straight into setup/standby.
  Ship state (sides/calib/target/settings) is never shipped; existing
  profiles can be kept or reset on re-install.
- Sign test v2: fully self-driving -- staircase power search (learns
  hover), closed-loop climb, both-direction verification with auto-
  escalating nudge, controlled descent. Never freefalls, also not on
  Ctrl+T or abort.
- Setup wizard (ap setup): wiring pulse-walk + sign test in one guided
  flow; offered automatically on first boot without a profile.
- New launcher 'ap' (stabilizeV2 kept as case-safe identical aliases;
  removes Windows-host case-collision recursion risk).
- build.sh: repo is source of truth; LC_ALL=C sorted manifests;
  optional --from-world/--to-world dev sync with exclude lists.
- Removed legacy v1 files and per-ship state from the repo/manifest
  (26 -> 17 files in the autopilot role).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-23 23:21:54 +02:00
71e750bbe0 Point installer BASE at Gitea (gt.zyon.no)
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-23 13:10:17 +02:00
4cd2573f56 Airship autopilot: role-based wget installer for server
Mirrors the live CC autopilot (computer 0) and cockpit (computer 4) from the
Modda wii world. install.lua fetches each role's manifest over HTTP so the
system installs on any server regardless of computer id.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-23 12:53:41 +02:00