Not a medical device. Not certified. Not a patient-treatment product. Simulated plant on QEMU. No hardware timing claims.

Demo video: https://www.youtube.com/watch?v=CMnwOWsutzI · Source (MIT): https://github.com/PravinrajV/split-loop

Inspiration

I wanted a lab transfer a judge can check with the sound off: cassette leaves a rack slot, must not enter an occupied neighbor or the analyzer housing, and must not cross a published jerk limit that would splash. QNX already shows up in robotics and medical devices, so the market fits, but this demo is a simulated plant on QEMU, not an instrument and not a patient product.

Isolation of an untrusted planner is not a new idea. CortexCage, moco/SafeGuard, and the Simplex architecture already cover that ground. What I cared about was a frozen cycle-time metric, freshness threats (stale, replayed, expired advice), and a same-image A/B of naive blocking MsgSend versus isolated non-blocking advice, with raw samples a judge can open.

What it does

Split Loop runs a two-axis cassette shuttle on QNX 8.0 under QEMU. /dev/joint is the plant and command validator. /dev/advice holds the latest proposal with sequence, timestamp, and expiry. A SCHED_FIFO control loop (priority 40) never blocks on the advisor in isolated mode. The advisor (priority 10) may only write advice. A watchdog restarts the advisor only. An enforcing security policy denies the advisor opening /dev/joint even though the device mode is 0666.

The planner is a native analytic profiler, not a trained model. Against the frozen Safe-via baseline on the default rack recipe it finished in 2.959989901 s (run acceptance-r01-planner-none-0) versus 7.990243749 s (run acceptance-r00-baseline-none-0): about 62.95% shorter, zero keep-out entries, zero published jerk-limit breaches. When the advisor hangs in isolated mode (acceptance-r09-planner-hang-0) the shuttle reaches HOME with 0 missed 10 ms periods and 1 advisor restart. The same hang with naive synchronous MsgSend (acceptance-r11-planner-hang-1) misses 19 periods; max blocking ask 186.795 ms, max command completion 192.143 ms. Policy test: control open allowed (fd=3, mode 0666); advisor gets EPERM. Sixteen motion/fault cases plus the OS denial passed; 7,029 raw samples ship with the report.

Numbers above are QEMU TCG guest CLOCK_MONOTONIC measurements. They are not WCET and not a hardware real-time guarantee.

How we built it

Everything that moves runs in the QNX guest. The host UI is presentation and a serial bridge.

  1. Locked geometry, Safe-via baseline, and cycle-time clock in design/split-loop.md before the planner existed.
  2. Joint and advice resource managers, FIFO control, second-order plant, sensor noise kept separate from truth (app/runtime.c, app/motion.c).
  3. Advice contract with reason codes, including stale / replay / expired / malformed (app/contract.c).
  4. Native profiler that had to beat the frozen baseline or lose any AI-style label. It beat the baseline; we still do not call it AI, because it is an analytic profiler.
  5. Fault injector and a machine-readable matrix that is allowed to fail.
  6. Same-image naive coupling mode for the hang A/B.
  7. Enforcing secpol on a disposable mkqnximage (images/split-loop-policy.txt). Positive and negative open of /dev/joint on the live device.
  8. Host top-down lab schematic and JSON/CSV export.

Build: qcc -Vgcc_ntox86_64, mkqnximage --type=qemu --arch=x86_64 --secpol=secure, QEMU TCG 1 vCPU / 512 MiB.

Challenges we ran into

Getting a usable SDP license and an enforcing secpol image took longer than the control loop. A bad policy can lock a VM, so policy work stayed on a disposable image. Debian 13 is outside the documented supported SDP host set; we kept going once native qcc and mkqnximage actually worked.

Honesty about QEMU timing was another constant check. Max observed latency is easy to oversell. The report spells out miss definition, fixed-step plant integration, catch-up after a late wake, and that the simulated arm does not coast during a naive stall the way a real arm would.

Review also caught a feedback velocity overshoot against the frozen velocity cap. That was fixed without relaxing the baseline. Baseline self-checks were re-run before the final r00/r01 comparison.

Accomplishments that we're proud of

  • A legal planner transfer that beats a frozen baseline on a published settle clock, with run ids a judge can cite (r01 vs r00).
  • Freshness as a first-class threat: stale, replay, and expired advice each produce the matching reason code (r04–r06).
  • Same-image hang A/B with raw CSVs: isolated 0 misses (r09) versus naive 19 misses and a 186.795 ms blocking ask (r11).
  • OS mandatory-access denial with world-mode 0666 on /dev/joint, not an application check.
  • 16/16 matrix cases + policy pass, 7,029 samples, SHA-256 of the acceptance report published in the README.

What we learned

Leading with "we isolated the planner" is how you look like CortexCage and moco. The transfer task and the A/B experiment are what a judge can see. Also: if your simulator freezes the plant during a stall, say so. Otherwise the naive miss looks safer than a real motor would be.

What's next

  • Optional Safe-via join after mid-transfer advisor loss (not started; estimate 4–8 h of checked profiles plus a full acceptance re-run).
  • Hardware bring-up on a supported board if a later event needs it; until then, keep QEMU labels honest.
  • Short tracelogger capture of the critical threads, with overhead disclosed.
  • No medical certification path. This stays a checkable demo.

Built With

Share this project:

Updates

Submission history