ReviewOS

also looking at this

stacks/drone

feat: expose owned VTOL transition simulation through native CLI

#82
Merged chris wants to merge codex/owned-vtol-transition-cli into main
20 files +743 -36
docs/vehicles-vtol.mdmodified+93-9
Changes to docs/vehicles-vtol.md
@@ -11,6 +11,7 @@ profiles in the `/missions` workspace.
1111./buddy vtol:hover
1212./buddy vtol:hover --scenario host-loss
1313./buddy vtol:hover --scenario imu-loss
14./buddy vtol:hover --electrical
1415```
1516
1617The native Stacks command defaults to 60 virtual seconds. It accepts `hover`, `imu-loss`,
@@ -25,6 +26,7 @@ The copied standalone CLI registers the same command definition:
2526```sh
2627bun run runtime:cli
2728./storage/runtime-build/cli/drone vtol:hover
29./storage/runtime-build/cli/drone vtol:hover --electrical
2830```
2931
3032## Model and measurements
@@ -50,8 +52,9 @@ RC takeover, kill and sensor loss revoke shared authority. Host death leaves its
5052stale while the independently ticking modeled board expires the output lease.
5153
5254The mission's 50 Wh capacity, 1200 W ceiling and 30% reserve are declared budget inputs for this
53fictional hover experiment. They are not identified electrical power, measured endurance or a
54complete hybrid energy model. Neutral outputs during an airborne fault do not establish a safe
55fictional hover experiment. The default retains a constant declared-ceiling charge. The optional
56electrical model below supplies fictional propulsion/battery dynamics and delayed energy measurements.
57Neither mode identifies hardware power or measured endurance. Neutral outputs during an airborne fault do not establish a safe
5558emergency landing. Physical flight commands remain disabled.
5659
5760## Explicit hover observation in library plans
@@ -71,8 +74,27 @@ new CLI scenario. Existing hover-only recordings keep their prior shapes.
7174is a separate development experiment on the same owned runtime. Its nominal mission observes initial
7275hover, takes off vertically to 15 m, requests a front transition, flies a cruise leg, requests back
7376transition, returns to the back request's capture point, observes settled hover, and lands vertically.
74A turning leg also has an actual completed model campaign. This profile is not registered as a CLI
75scenario or selectable workspace profile.
77A turning leg also has an actual completed model campaign. The native `vtol:simulate` command runs
78the nominal route. This profile is not a selectable workspace profile.
79
80```sh
81./buddy vtol:simulate
82./buddy vtol:simulate --electrical
83./storage/runtime-build/cli/drone vtol:simulate --electrical
84```
85
86The command defaults to 160 virtual seconds and accepts an integer `--seconds` from 2 to 180.
87It reports the existing runtime's actual status and the three qualified initial-hover, cruise and
88back-hover observations, including their event, task, reference and capture epochs. Exit 0 requires
89those ordered confirmations, observed estimated flight, completed landing with qualified modeled
90contact, no runtime fault, neutral board outputs and no active output lease. An incomplete route
91retains its partial observations and status and exits 1. The condensed report omits the full path
92and trace. The library still exposes both for replay and evaluation.
93
94Buddy discovers the typed command natively; the standalone binary registers the same definition.
95This command currently exposes the nominal route only. Fault scenarios, operator schedules and
96recovery route selection remain library capabilities. Simulation completion does not qualify
97physical transitions, arbitrary flight envelopes or hardware landing.
7698
7799The controller receives measured relative airspeed, differential pressure, airflow angles and modeled
78100rotor/pusher response, together with the qualified raw gyro and estimated navigation. Delayed airflow
@@ -96,8 +118,8 @@ requires wrapped heading error within 0.1 rad for the complete 500 ms dwell. Hov
96118therefore have a finite 45-second ceiling; front requests retain 15 seconds. The original 15-second
97119back budget still fails without retry or a claimed landing. This is a virtual task allowance,
98120not a wall-clock test timeout. The complete declared mission budget is 131,520 ms, or 43.84 Wh at its
991200 W ceiling, with 100 Wh capacity and 30% reserve. These remain declared planning values, without
100a complete hybrid electrical-power law or measured battery identification.
1211200 W ceiling, with 100 Wh capacity and 30% reserve. These remain declared planning values. Select
122the optional electrical law below for modeled consumption; measured battery identification remains open.
101123
102124The experiment keeps the 2 m transition-height deviation, 0.6 rad roll, 0.5 rad pitch and 22 m/s
103125speed guards. Its own target range is bounded to 400 m. The quadcopter and hover development kernel's
@@ -147,7 +169,8 @@ and releases outputs. Neither result establishes an airborne landing.
147169Task execution time stops during pause. Global endurance and the declared energy charge continue,
148170so a later scheduled resume can be preempted by reserve, endurance, health or authority refusal.
149171Operator actions never extend the original planning allowance or rearm revoked authority. The
150transition library and these actions remain separate from the hover-only CLI and common workspace.
172operator schedules remain library-only; neither CLI command exposes them, and the common workspace
173does not select this VTOL profile.
151174
152175## Declared transition recovery routes
153176
@@ -196,7 +219,7 @@ airborne. A separately declared 35-second allowance completes after about 26.94
196219the complete 156,520 ms / 52.1733 Wh worst-case plan. A normal 45-second back plus 45-second recovery
197220hover and 35-second landing exceeds the unchanged 180-second graph cap and is rejected. The phase
198221abort/pause/recover campaigns instead declare 40-second recovery hover and 30-second landing, fitting
199176,520 ms / 58.84 Wh. These remain declared 1200 W planning charges, without identified electrical
222176,520 ms / 58.84 Wh. These remain conservative 1200 W planning charges, without identified electrical
200223power or measured battery endurance.
201224
202225Sensor loss, reference/clock guards, RC takeover, kill, fence, reserve and global endurance remain
@@ -204,11 +227,72 @@ authoritative during recovery. Host loss still produces a stale host snapshot an
204227lease expiry. Fault-induced neutral outputs do not become a landing claim. These bounded library
205228campaigns do not qualify arbitrary wind, failed lift rotors, every transition state or physical recovery.
206229
230## Fictional electrical model
231
232Select `--electrical` in either VTOL command, or pass `{ electrical: true }` to
233`createVtolHoverProfile('hover', options)` or `createVtolTransitionProfile(options)` in TypeScript.
234The default/disabled profiles keep their prior reports and declared-ceiling energy accounting.
235Both commands run through Buddy and the copied standalone CLI. The nominal full-route command
236uses the same experimental transition library profile.
237
238Each session owns its electrical state. The plant uses actual lagged individual rotor and pusher
239thrust, with these declared coefficients:
240
241| Source | Fictional law |
242| --- | --- |
243| Each of four lift motors | `4 * thrustN ** 1.5` W |
244| Independent pusher | `5 * thrustN ** 1.5` W |
245| Avionics and idle auxiliaries | 12 W |
246| Each surface | `3 * abs(deflectionRad) / 0.4` W |
247| Open-circuit voltage | 20 to 24 V, linear in remaining chemical energy fraction |
248| Series resistance | 0.04 ohm |
249
250The low-current solution of `loadW = (openCircuitV - currentA * resistanceOhm) * currentA`
251sets terminal voltage and current. Chemical source power is `openCircuitV * currentA`, including
252series loss. The four motors, full pusher and all surfaces together draw 948.023527 W at the load.
253At the minimum open-circuit voltage their chemical source demand is 1060.486740 W, rounded upward
254to a **1061 W envelope**. This is an analytic bound on this fictional law, not a motor/battery rating.
255The 20 to 24 V open-circuit range is a simulation parameter; the hardware list's 4S pack retains
256its own specification.
257
258Before session allocation, the runtime requires a planning ceiling at least this envelope and
259capacity matching the captured plant declaration. Existing longest-path graph validation charges
260the complete declared ceiling across normal and supported failure/recovery/landing routes. With the
2611200 W planning ceiling, the normal route is 43.84 Wh and the declared back-abort route is 58.84 Wh.
262At 50% reserve of 100 Wh, the former fits and the latter is refused before resources are created.
263The front-failure path is shorter than the normal route, so it does not increase that worst-case budget.
264
265The plant integrates chemical source energy on its independent 4 ms steps. Before remaining energy
266cannot fund one complete worst-case step, propulsion demand is cut and latched. Retained motor response
267may coast down; it cannot rearm from a voltage rebound. Auxiliary draw continues to exhaustion.
268Rejected rigid-body integration commits neither body nor electrical state.
269
270Battery data travels through existing delayed, sequence/reference/capture-qualified measurements.
271Energy use rounds upward to micro-watt-hours; current/voltage/load use declared milli-unit quantization.
272The common qualifier rejects missing, nonfinite, inconsistent, over-envelope or decreasing consumption.
273The authority and mission receive a conservative remaining-energy bound after charging the maximum
274source envelope over the measurement's age. A reported supply cutoff withdraws authority even if
275chemical capacity remains. Source loss never substitutes a full battery.
276
277Reports add `energy.model` and `energy.lastObservation`. `energyUsedWh` belongs to its capture epoch;
278`remainingWhLowerBound` and `remainingPercentLowerBound` include the worst-case age charge at
279`observedAtMs`. Host loss leaves this host observation unchanged while independent plant consumption
280and board expiry continue. Mission-policy replay uses the recorded battery observations; it does not
281reconstruct the electrical plant from a mission trace alone.
282
283Actual model campaigns cover combined front demand, all nominal phases, open-circuit pusher timeout, initial/front/back abort
284landing, held recovery/resume, global endurance during pause, supply cutoff, bad battery observations,
285reserve, host loss and independent sessions. The nominal example's front peak is 347.313 W; its
286last captured use is about 4.62 Wh. Neither value predicts aircraft endurance. Motor/propeller advance
287ratio, voltage-dependent thrust, cell temperature/degradation, current-sensor calibration and measured
288capacity remain unmodeled or unqualified. The open-circuit fixture removes pusher demand and thrust;
289it does not model a seized motor's electrical current.
290
207291## Remaining implementation
208292
209293[Issue #12](https://github.com/stacksjs/drone/issues/12) remains open. The experimental nominal
210294controller and opt-in recovery routes do not establish complete VTOL support. Complete recovery/abort
211envelopes, fresh-process restoration, the complete hybrid power/reserve model, native transition CLI and
295envelopes, fresh-process restoration, identified hybrid power/voltage/cell behavior, CLI fault/operator scenarios and
212296the common mission workspace still require implementation and qualification. Wind campaigns and
213297broader mission/envelope coverage remain necessary. Full TECS/soaring, tiltrotor/tailsitter mechanisms,
214298helicopters and other airframe families remain separate work. Native board control, measured airframe