Inspiration

What it does

How we built it

Challenges we ran into

Accomplishments that we're proud of

What we learned

What's next for relmw-qnx

Engineering Honesty Notice: The robot plant is a deterministic 2-D contact-push simulator (src/core/sim2d.cpp), not physical hardware; manipulation recovery and zero-intrusion rates below are deterministic simulation results. All QNX 8.0 native sources (src/platform/qnx/*, apps/relmw_ham_setup.cpp, apps/relmw_robotd.cpp) pass strict -D__QNX__ -fsyntax-only -Wall -Wextra -Werror verification against QNX SDP 8.0 API stubs (12 translation units + 9 negative rejection self-tests) and execute end-to-end via compat/qnx_sim/ (QNX API simulation on POSIX host, explicitly labelled as host simulation and never reported as QNX hardware timing). Live QNX SDP 8.0 QEMU x86_64 execution and tracelogger .kev capture are automated by a single command (scripts/run_qnx80_evidence_pack.sh) on any QNX SDP 8.0 host.

Inspiration

Retrying is the default recovery behavior in most robotics stacks, yet with learned neural manipulation policies it fails catastrophically: because the policy is nearly deterministic, rolling back and replaying under a biased wrist camera stalls in the exact same failure state — and in surgical or pharmacy-compounding cells, blind retries repeatedly drive the end-effector through sterile keep-out zones. We built relmw-qnx to put runtime assurance where safety belongs in a real robot: in a zero-allocation 1 kHz real-time supervisor on QNX OS 8.0, isolated from the robot driver by microkernel message passing, operable with standard cat/echo tools via a /dev resource manager, and self-healed by the High Availability Manager (HAM).

What it does

  1. 1 kHz Zero-Allocation Simplex Physical Safety Shield (include/relmw/safety_shield.hpp, src/core/safety_shield.cpp):
    • Wraps any learned policy at 1 kHz with an O(1), zero-heap-allocation Supporting-Hyperplane Control Barrier Function (CBF) projection (SafetyShield::project() noexcept).
    • Enforces NaN/Inf rejection, velocity/acceleration kinematic limits, and circular + convex-polygonal surgical keep-out virtual fixtures (SafetyEnvelope::medical_surgical_fixture()), sliding tangentially around obstacles while emitting SHIELD_INTERVENTION telemetry pulses without deadlocking the task.
  2. Zero-Dependency C++17 Tiny-MLP Neural Policy (include/relmw/nn_policy.hpp, src/core/nn_policy.cpp, tools/train_nn_policy.py):
    • Compact 8 -> 32 (ReLU) -> 32 (ReLU) -> 2 manipulation policy (1,410 constexpr parameters trained via Behavior Cloning + 2 rounds of DAgger over 91,434 contact trajectories, weight hash 9354f53ae9f4cfce).
    • Dual inference paths: IEEE float32 (forward_fp32) and FPU-free int16 Q12 fixed-point (forward_q12, max deviation 0.814 mm), executing in < 2 µs with 0 heap allocations.
  3. Correlation-Aware Task Recovery (src/core/verifier.cpp, src/core/retry_policy.cpp, src/core/middleware.cpp):
    • Verifies each subtask independently (camera-style estimate, σ = 3 mm, settle + hold check, 0 false positives against ground truth).
    • Fingerprints failures (mode + end pose within 2 cm) to detect correlated repeats, rolls back only the robot (never resetting the world), selects alternative strategies (relocalize, reapproach_left/right, slow_mode, obs_lead) via a Beta-posterior failure library without repeating failed strategies, propagates persistent fixes proactively to later subtasks, and escalates cleanly to an operator when the recovery ladder is exhausted.
  4. Native QNX OS 8.0 Microkernel Architecture (src/platform/qnx/*, apps/*, config/secpol/*):
    • Kernel Timer → Pulse Loop (qnx_timer.cpp): timer_create() → SIGEV_PULSE → MsgReceivePulse() on a private channel (ChannelCreate(_NTO_CHF_PRIVATE)) with MsgRegisterEvent(..., SYSMGR_COID) and explicit pulse priority (avoiding SIGEV_PULSE_PRIO_INHERIT priority demotion), paced under SCHED_FIFO or SCHED_SPORADIC with QNX 8.0 cluster pinning (pthread_cluster_set()).
    • /dev/relmw Resource Manager (qnx_resmgr.cpp): Exposes /dev/relmw/{status,events,ctl} via resmgr_attach() with custom io_read/io_write handlers — inspect live state with cat /dev/relmw/status and switch policies/shields or inject faults with echo "shield on" > /dev/relmw/ctl (wrapped by scripts/relmwctl).
    • Process-Isolated Robot Driver + HAM Self-Healing (apps/relmw_robotd.cpp, qnx_robot_link.cpp, apps/relmw_ham_setup.cpp): Runs /dev/robot0 as a separate resource manager communicating over fixed-size _IO_MSG MsgSend/MsgReply frames. If relmw_robotd crashes (kill -9 / slay -f -9), the supervisor detects link loss, restores the pre-episode failure-library snapshot, reconnects once HAM restarts the driver, and re-runs the interrupted episode deterministically with zero lost state.
    • slog2 Structured Logging & Least-Privilege secpol (qnx_log.cpp, config/secpol/relmw_secpol.txt, tools/secpol_lint.py): Logs all safety and recovery transitions to slog2info -b relmw and ships a statically linted QNX 8.0 secpol least-privilege policy.
  5. 128-Byte Zero-Copy Binary Telemetry, ROS 2 Bridge & Offline Dual-Screen Replay Dashboard (telemetry_bridge.cpp, tools/ros2_qnx_bridge.py, docs/dashboard.html):
    • Fixed alignas(8) 128-byte TelemetryFrame with magic 0x524D5754, monotonic nanoseconds, release jitter, desired vs. CBF-projected coordinates, signed obstacle clearance, shield pulse counter, reconnect flags, and IEEE 802.3 CRC-32.
    • Adaptive ros2_qnx_bridge.py publishes /relmw/diagnostics and /relmw/pose (native rclpy or zero-dependency JSONL fallback), while docs/dashboard.html embeds a 642-frame (82,176 B) real binary replay comparing unguarded NaiveRetry crashing into the surgical keep-out zone against relmw-qnx sliding cleanly around it and surviving mid-episode relmw_robotd death.
  6. 6-Step Hands-On QNX OS 8.0 Simplex Safety Supervisor Codelab (docs/codelab/CODELAB.md & Interactive docs/codelab/index.html):
    • Built specifically for the QNX Everywhere developer community and Best Codelab / Tutorial ($3,500) track: walks developers in 6 structured 10-minute modules from workspace build & RELMW_QNX_SIM rehearsal through MsgReceivePulse + SIGEV_PULSE_PRIO_INHERIT pitfall avoidance + SCHED_SPORADIC, 1 kHz zero-alloc CBF safety shielding, /dev/relmw & /dev/robot0 resmgr_attach + _IO_MSG, dual-layer HAM + slog2 + 128-B ROS 2 telemetry, and secpol least-privilege hardening + QNX 8.0 QEMU/Raspberry Pi 5 deployment.
    • The zero-external-CDN interactive web edition (https://qidianyan.github.io/relmw-qnx/codelab/) ships one-click copy-code buttons, persistent step-progress checkpoints, a live 1 kHz Timing/Jitter & SCHED_SPORADIC Budget Verifier (with rt_report_*.json import), an interactive Simplex CBF Safety Shield Sandbox, and a QNX 8.0 secpol Access Checker (verified in Playwright Chromium with 0 console errors, 0 external requests, 0px mobile overflow, and 0 / 7,443,360 forbidden blue/cyan/purple pixels).

Verified Engineering & Benchmark Results

All metrics below come directly from real compiled runs of https://github.com/Qidianyan/relmw-qnx (Apple clang 21.0.0, -std=c++17 -O2 -Wall -Wextra -Werror, 0 warnings):

  • 39 / 39 Automated Test Suites PASS (CXX=clang++ bash scripts/run_qnx80_evidence_pack.sh --host-verify):
    • 22 / 22 Host tests PASS (unit suites, test_safety_shield, test_nn_policy, test_telemetry_bridge, test_rt_noalloc, test_supervisor_e2e, test_robotd_e2e with 3× simulated driver crashes, test_qnx_syntax, test_dashboard 17/17 incl. HSV zero-blue/cyan/purple guard, test_llm_assist 15/15, test_secpol_lint 21/21, test_ros2_bridge 3/3).
    • 17 / 17 RELMW_QNX_SIM tests PASS (compiling and running the actual #ifdef __QNX__ sources end-to-end, verifying cmp byte-identical benchmark outputs against POSIX host).
  • Zero Heap Allocations on Real-Time Hot Path (test_rt_noalloc): Overriding global operator new, SafetyShield::project (×100,000), TinyMLPPolicy::act (×20,000), TelemetryRing::emit (×10,000), PeriodicTimer::wait_tick (×100), and RemoteRobot::step (×2,000) all record 0 dynamic allocations.
  • S+ Medical Surgical-Fixture Benchmark (TinyMLPPolicy, N = 100 paired seeds, frozen after 40 warmup seeds — results/host_splus/summary.json):
Condition Arm (N = 100 paired) Task Success (95% Wilson CI) Zero-Intrusion Episodes Total Zone Intrusions Shield Pulses Min True Clearance Mean Sim Steps
Nominal single_pass (no shield) 100/100 (96.3–100.0%) 0/100 (0.0%) 741 0 -41.99 mm 97.55
Nominal corr_aware_retry (relmw-qnx + 1 kHz shield) 100/100 (96.3–100.0%) 100/100 (100.0%) 0 3,372 +6.55 mm 100.80
Field Faults single_pass (no shield) 77/100 (67.8–84.2%) 1/100 (1.0%) 762 0 -41.91 mm 123.65
Field Faults naive_retry (no shield) 78/100 (68.9–85.0%, p = 1.0) 0/100 (0.0%) 1,345 (1.77× worse!) 0 -41.91 mm 279.11
Field Faults corr_aware_retry (relmw-qnx + 1 kHz shield) 92/100 (85.0–95.9%, +15 pp, McNemar p = 0.000275) 100/100 (100.0%) 0 7,262 +3.00 mm 206.16 (−26.1% vs naive)
  • Classic Scripted Baseline (results/host_linux/summary.json, N = 100 paired): Field success rises from 78/100 (none) / 80/100 (naive retry, p = 0.5) to 98/100 (95% CI 93.0–99.4%, +20 pp, exact McNemar p = 1.91e-6; perception-bias subset 0/21 → 1/21 → 19/21; verifier false positives 0).
  • Host POSIX 1 kHz SCHED_OTHER Baseline (results/host_linux/rt_report_*.json): Shared Linux host p50 = 60.4 µs, p99 = 262.1 µs, max = 3,138.5 µs (9 / 8,067 misses > 500 µs), degrading to max = 19.3 ms (79 / 4,536 misses) under 2 busy loops — providing the direct baseline for QNX 8.0 SCHED_FIFO/SCHED_SPORADIC QEMU comparison via scripts/run_qnx80_evidence_pack.sh.

Judging Criteria Mapping (Exact File → Function Evidence)

  • Pulse-driven 1 kHz loop (explicit priority, no SIGEV_PULSE_PRIO_INHERIT demotion): src/platform/qnx/qnx_timer.cpp → PeriodicTimer::PeriodicTimer, wait_tick, set_thread_sched, set_thread_cluster
  • /dev/relmw Resource Manager: src/platform/qnx/qnx_resmgr.cpp → relmw_io_read, relmw_io_write, ControlSurface::start
  • Process-isolated /dev/robot0 Driver & Crash Reconnect: apps/relmw_robotd.cpp, src/platform/qnx/qnx_robot_link.cpp
  • HAM Restart + Heartbeat Hang-to-Death: apps/relmw_ham_setup.cpp, src/platform/qnx/qnx_timer.cpp → watchdog_attach
  • 1 kHz Simplex CBF Safety Shield & Tiny-MLP: src/core/safety_shield.cpp → SafetyShield::project, src/core/nn_policy.cpp → TinyMLPPolicy::forward_fp32 / forward_q12
  • 128-B CRC-32 Telemetry & ROS 2 Bridge: src/core/telemetry_bridge.cpp, tools/ros2_qnx_bridge.py
  • Least-Privilege secpol & QNX 8.0 Syntax Gate: config/secpol/relmw_secpol.txt, tools/secpol_lint.py, scripts/qnx_syntax_check.sh
  • 6-Step Hands-On QNX OS 8.0 Codelab (Best Codelab / Tutorial): docs/codelab/CODELAB.md (35.7 KB, 6 steps + 6 verification checkpoints + troubleshooting matrix) & docs/codelab/index.html (124.1 KB zero-CDN interactive web guide live at https://qidianyan.github.io/relmw-qnx/codelab/)

New & Existing Work Disclosure

The high-level correlation-aware retry concept originated in an earlier Python/MuJoCo prototype created before 2026-11-02. Every line of C++17, QNX 8.0 platform code, Simplex safety shield, Tiny-MLP neural policy, 128-byte telemetry/ROS 2 bridge, resource manager, HAM setup, secpol policy, 39 test suites, dashboard, 6-step QNX OS 8.0 Codelab (CODELAB.md + index.html), and one-click QNX 8.0 QEMU evidence script in https://github.com/Qidianyan/relmw-qnx was written from scratch during the hackathon submission period (starting 2026-11-10).


3. Build, Verify & Run on QNX SDP 8.0 (Copy into Devpost Testing Instructions)

git clone https://github.com/Qidianyan/relmw-qnx.git
cd relmw-qnx

# 1. Zero-dependency host + QNX_SIM verification (builds both POSIX & -D__QNX__ simulation, runs 39/39 tests + S+ benchmark)
CXX=clang++ bash scripts/run_qnx80_evidence_pack.sh --host-verify

# 2. QNX SDP 8.0 cross-compile + SMP QEMU x86_64 full evidence pack (requires free QNX Everywhere SDP 8.0 + mkqnximage)
QNX_SDP=~/qnx800 bash scripts/run_qnx80_evidence_pack.sh --preflight
QNX_SDP=~/qnx800 bash scripts/run_qnx80_evidence_pack.sh --keep-vm

Built With

  • c++17
Share this project:

Updates

Submission history