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 -Werrorverification against QNX SDP 8.0 API stubs (12 translation units + 9 negative rejection self-tests) and execute end-to-end viacompat/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 andtracelogger.kevcapture 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 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/Infrejection, velocity/acceleration kinematic limits, and circular + convex-polygonal surgical keep-out virtual fixtures (SafetyEnvelope::medical_surgical_fixture()), sliding tangentially around obstacles while emittingSHIELD_INTERVENTIONtelemetry pulses without deadlocking the task.
- Wraps any learned policy at 1 kHz with an
- 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) -> 2manipulation policy (1,410constexprparameters trained via Behavior Cloning + 2 rounds of DAgger over91,434contact trajectories, weight hash9354f53ae9f4cfce). - Dual inference paths: IEEE
float32(forward_fp32) and FPU-freeint16Q12fixed-point (forward_q12, max deviation0.814 mm), executing in< 2 µswith 0 heap allocations.
- Compact
- 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.
- Verifies each subtask independently (camera-style estimate,
- 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)) withMsgRegisterEvent(..., SYSMGR_COID)and explicit pulse priority (avoidingSIGEV_PULSE_PRIO_INHERITpriority demotion), paced underSCHED_FIFOorSCHED_SPORADICwith QNX 8.0 cluster pinning (pthread_cluster_set()). /dev/relmwResource Manager (qnx_resmgr.cpp): Exposes/dev/relmw/{status,events,ctl}viaresmgr_attach()with customio_read/io_writehandlers — inspect live state withcat /dev/relmw/statusand switch policies/shields or inject faults withecho "shield on" > /dev/relmw/ctl(wrapped byscripts/relmwctl).- Process-Isolated Robot Driver + HAM Self-Healing (
apps/relmw_robotd.cpp,qnx_robot_link.cpp,apps/relmw_ham_setup.cpp): Runs/dev/robot0as a separate resource manager communicating over fixed-size_IO_MSGMsgSend/MsgReplyframes. Ifrelmw_robotdcrashes (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 toslog2info -b relmwand ships a statically linted QNX 8.0secpolleast-privilege policy.
- Kernel Timer → Pulse Loop (
- 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-byteTelemetryFramewith magic0x524D5754, 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.pypublishes/relmw/diagnosticsand/relmw/pose(nativerclpyor zero-dependency JSONL fallback), whiledocs/dashboard.htmlembeds a 642-frame (82,176 B) real binary replay comparing unguardedNaiveRetrycrashing into the surgical keep-out zone againstrelmw-qnxsliding cleanly around it and surviving mid-episoderelmw_robotddeath.
- Fixed
- 6-Step Hands-On QNX OS 8.0 Simplex Safety Supervisor Codelab (
docs/codelab/CODELAB.md& Interactivedocs/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_SIMrehearsal throughMsgReceivePulse+SIGEV_PULSE_PRIO_INHERITpitfall avoidance +SCHED_SPORADIC, 1 kHz zero-alloc CBF safety shielding,/dev/relmw&/dev/robot0resmgr_attach+_IO_MSG, dual-layerHAM+slog2+ 128-B ROS 2 telemetry, andsecpolleast-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_SPORADICBudget Verifier (withrt_report_*.jsonimport), an interactive Simplex CBF Safety Shield Sandbox, and a QNX 8.0secpolAccess Checker (verified in Playwright Chromium with0console errors,0external requests,0pxmobile overflow, and0 / 7,443,360forbidden blue/cyan/purple pixels).
- Built specifically for the QNX Everywhere developer community and
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_e2ewith 3× simulated driver crashes,test_qnx_syntax,test_dashboard17/17 incl. HSV zero-blue/cyan/purple guard,test_llm_assist15/15,test_secpol_lint21/21,test_ros2_bridge3/3). - 17 / 17
RELMW_QNX_SIMtests PASS (compiling and running the actual#ifdef __QNX__sources end-to-end, verifyingcmpbyte-identical benchmark outputs against POSIX host).
- 22 / 22 Host tests PASS (unit suites,
- Zero Heap Allocations on Real-Time Hot Path (
test_rt_noalloc): Overriding globaloperator new,SafetyShield::project(×100,000),TinyMLPPolicy::act(×20,000),TelemetryRing::emit(×10,000),PeriodicTimer::wait_tick(×100), andRemoteRobot::step(×2,000) all record 0 dynamic allocations. - S+ Medical Surgical-Fixture Benchmark (
TinyMLPPolicy,N = 100paired 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 = 100paired): Field success rises from78/100(none) /80/100(naive retry,p = 0.5) to98/100(95% CI 93.0–99.4%,+20 pp, exact McNemarp = 1.91e-6; perception-bias subset0/21 → 1/21 → 19/21; verifier false positives0). - Host POSIX 1 kHz
SCHED_OTHERBaseline (results/host_linux/rt_report_*.json): Shared Linux hostp50 = 60.4 µs,p99 = 262.1 µs,max = 3,138.5 µs(9 / 8,067misses > 500 µs), degrading tomax = 19.3 ms(79 / 4,536misses) under 2 busy loops — providing the direct baseline for QNX 8.0SCHED_FIFO/SCHED_SPORADICQEMU comparison viascripts/run_qnx80_evidence_pack.sh.
Judging Criteria Mapping (Exact File → Function Evidence)
- Pulse-driven 1 kHz loop (explicit priority, no
SIGEV_PULSE_PRIO_INHERITdemotion):src/platform/qnx/qnx_timer.cpp→PeriodicTimer::PeriodicTimer,wait_tick,set_thread_sched,set_thread_cluster /dev/relmwResource Manager:src/platform/qnx/qnx_resmgr.cpp→relmw_io_read,relmw_io_write,ControlSurface::start- Process-isolated
/dev/robot0Driver & 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 athttps://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