Commit graph

11 commits

Author SHA1 Message Date
rUv
27a6edba8b
feat(examples/three.js): cinematic skinned realtime pose demo + folder reorg (#584)
* feat(examples/three.js): cinematic skinned realtime pose demo + ESP32 CSI bridge

Five-stage example progression exploring three.js helpers (ADR-097 surface) as
a viewer for live RuView sensor data:

1. helpers-demo.html              — clean ADR-097 helper reference (GridHelper,
                                    PolarGridHelper, BoxHelper, AxesHelper),
                                    file://-safe, no backend
2. helpers-cinematic.html         — same scene + UnrealBloomPass + pseudo-CSI
                                    sonar pings + tomography sweep + procedural
                                    cyber floor + ambient drift particles
3. helpers-skinned.html           — replaces sphere skeleton with Mixamo X Bot
                                    via GLTFLoader from threejs.org CDN, plays
                                    bundled animations with additive blending
4. helpers-skinned-fbx.html       — same but loads a local Mixamo FBX (needs
                                    serve-demo.py — file:// can't fetch local
                                    siblings). Drop X Bot.fbx alongside.
5. helpers-skinned-realtime.html  — webcam → MediaPipe Pose Heavy →
                                    poseWorldLandmarks → direct quaternion
                                    retargeting onto the Mixamo skeleton.
                                    Real ESP32-S3 CSI streamed over WebSocket
                                    from ruvultra (Tailscale, port 8766).

Supporting:
  - serve-demo.py             threaded HTTP server with no-cache headers
                               (fixes net::ERR_EMPTY_RESPONSE on the FBX path)
  - ruvultra-csi-bridge.py    ESP32 RuView firmware tick → WebSocket bridge,
                               runs as systemd-run unit on ruvultra

Bugs found + fixed along the way (all documented in code comments):
  - FBX exports yield TWO parallel Bone trees with identical names; only the
    SkinnedMesh.skeleton.bones one drives visible deformation. model.traverse
    finds orphans.
  - Mixamo FBX nests a zero-length wrapper bone above the real bone, same name.
    bone.children[0].getWorldPosition == bone.getWorldPosition → restDir is
    (0,0,0) → setFromUnitVectors collapses to identity. Walk past same-named
    same-position wrappers when computing tail.
  - AnimationMixer.update() with a "stopped" action still mutates bones unless
    enabled=false is set.

Retargeting layer in helpers-skinned-realtime.html:
  - 12 bones direct quaternion retarget (arms × 2, legs × 2, spine × 3, neck)
  - Hips root rotation from shoulder/hip line basis (torso twist + lean)
  - Neck aims at ear-midpoint (kp 7+8), not nose (kp 0), to remove the
    forward bias of the protruding-nose anchor
  - One Euro Filter per landmark per axis (Casiez 2012) — adaptive low-pass
  - Visibility-weighted per-bone slerp gain — occluded limbs relax to rest
  - URL toggles: ?mirror= ?yflip= ?zflip= ?cnn=0/1/2 ?csi=ws://...

Live CSI integration:
  - Bridge parses adaptive_ctrl tick lines (motion/presence/rssi/yield)
  - Browser fans single ESP32 reading across 4 UI nodes with phase-shifted
    wobble (0.88–1.00 × sin(t·0.55 + offsetᵢ))
  - EMA α=0.06 (~3 sec time constant), HUD update throttled 3 Hz

Co-Authored-By: claude-flow <ruv@ruv.net>

* refactor(examples/three.js): organize into demos/screenshots/server/assets + add README

Flatten the 13-file flat layout into purposeful subfolders so the demo
collection has a clean top-level entry point (README.md) and the file roles
are obvious from a directory listing.

Layout:
  demos/         01..05 — numbered for the progression (helpers → cinematic →
                          skinned → skinned-fbx → skinned-realtime)
  screenshots/   one PNG per demo, matching the demo's filename prefix
  server/        serve-demo.py + ruvultra-csi-bridge.py
  assets/        X Bot.fbx (gitignored, used by demos 04 and 05)

Touched files (beyond the renames):
- 04-skinned-fbx.html, 05-skinned-realtime.html: MODEL_URL now resolves
  '../assets/X%20Bot.fbx' instead of './X%20Bot.fbx'
- server/serve-demo.py: chdir() walks 3 levels up to repo root (was 2), and
  the URL banner now lists all 5 demos
- .gitignore: comment refresh — points at assets/ and screenshots/
- 05-skinned-realtime.html also picks up in-flight fps-tune work from this
  branch (Holistic script, SMOOTH_K URL param, slerp gain scaling) since
  those edits and the rename hit the same file

Verified end-to-end:
- python examples/three.js/server/serve-demo.py
- all 5 demos return 200, X Bot.fbx returns 200 from new asset/ path
- demos 04 + 05 render the X Bot mesh; 0 JS errors via browser eval
- screenshots reproduced match the originals

Co-Authored-By: claude-flow <ruv@ruv.net>
2026-05-17 17:01:02 -04:00
rUv
f49c722764
chore(repo): rename rust-port/wifi-densepose-rs → v2/ (flatten to one level) (#427)
The Rust port lived two directories deep (rust-port/wifi-densepose-rs/)
without any sibling under rust-port/ that warranted the extra level.
Move the whole workspace up to v2/ to match v1/ (Python) at the same
depth and shorten every cd / build command across the repo.

git mv preserves history for all tracked files. 60 files updated for
path references (CI workflows, ADRs, docs, scripts, READMEs, internal
.claude-flow state). Two manual fixes for relative-cd paths in
CLAUDE.md and ADR-043 that became wrong after the depth change
(cd ../.. → cd ..).

Validated:
- cargo check --workspace --no-default-features → clean (after target/
  nuke; the gitignored target/ was carried by the OS rename and had
  hard-coded old paths in build scripts)
- cargo test --workspace --no-default-features → 1,539 passed, 0 failed,
  8 ignored (same totals as pre-rename)
- ESP32-S3 on COM7 → still streaming live CSI (cb #40300, RSSI -64 dBm)

After-merge follow-up: contributors should `rm -rf v2/target` once and
let cargo regenerate from the new path.
2026-04-25 21:28:13 -04:00
ruv
a4bd2308b7 feat: ADR-069 ESP32 CSI → Cognitum Seed RVF pipeline (v0.5.4-esp32)
Hardware-validated pipeline connecting ESP32-S3 CSI sensing to Cognitum
Seed (Pi Zero 2 W) edge intelligence appliance via 8-dim feature vectors.

Firmware:
- New 48-byte feature vector packet (magic 0xC5110003) at 1 Hz with
  normalized presence, motion, breathing, heart rate, phase variance,
  person count, fall detection, and RSSI
- Compressed frame magic reassigned 0xC5110003 → 0xC5110005
- Guard against uninitialized s_top_k read when count=0

Bridge (scripts/seed_csi_bridge.py):
- UDP→HTTPS ingest with bearer token, hash-based vector IDs
- --validate (kNN), --stats, --compact, --allowed-sources modes
- NaN/inf rejection, retry logic, SEED_TOKEN env var support

Validated on live hardware:
- 941 vectors ingested, 100% kNN exact match
- Witness chain SHA-256 verified (1,325 entries)
- 1,463 Rust tests passed, Python proof VERDICT: PASS

Research: 26 docs covering Arena Physica, Maxwell's equations in WiFi
sensing, SOTA survey 2025-2026, GOAP implementation plan

Security: removed hardcoded credentials, added NVS patterns to
.gitignore, source IP filtering, NaN validation

Co-Authored-By: claude-flow <ruv@ruv.net>
2026-04-02 19:32:18 -04:00
ruv
4713a30402 docs: add README for happiness-vector example
Quick start guide, 8-dim vector schema, multi-node swarm setup,
Seed query tool usage, privacy considerations, and file index.

Co-Authored-By: claude-flow <ruv@ruv.net>
2026-03-20 18:51:05 -04:00
rUv
2b8a7cc458
feat: happiness scoring pipeline + ESP32 swarm with Cognitum Seed (#285)
* feat: happiness scoring pipeline with ESP32 swarm + Cognitum Seed coordinator

ADR-065: Hotel guest happiness scoring from WiFi CSI physiological proxies.
ADR-066: ESP32 swarm with Cognitum Seed as coordinator for multi-zone analytics.

Firmware:
- swarm_bridge.c/h: FreeRTOS task on Core 0, HTTP client with Bearer auth,
  registers with Seed, sends heartbeats (30s) and happiness vectors (5s)
- nvs_config: seed_url, seed_token, zone_name, swarm intervals
- provision.py: --seed-url, --seed-token, --zone CLI args
- esp32-hello-world: capability discovery firmware for 4MB ESP32-S3 variant

WASM edge modules:
- exo_happiness_score.rs: 8-dim happiness vector from gait speed, stride
  regularity, movement fluidity, breathing calm, posture, dwell time
  (events 690-694, 11 tests, ESP32-optimized buffers + event decimation)
- ghost_hunter.rs standalone binary: 5.7 KB WASM, feature-gated default pipeline

RuView Live:
- --mode happiness dashboard with bar visualization
- --seed flag for Cognitum Seed bridge (urllib, background POST)
- HappinessScorer + SeedBridge classes (stdlib only, no deps)

Examples:
- seed_query.py: CLI tool (status, search, witness, monitor, report)
- provision_swarm.sh: batch provisioning for multi-node deployment
- happiness_vector_schema.json: 8-dim vector format documentation

Verified live: ESP32 on COM5 (4MB flash) registered with Seed at 10.1.10.236,
vectors flowing, witness chain growing (epoch 455, chain 1108).

Co-Authored-By: claude-flow <ruv@ruv.net>

* ci: raise firmware binary size gate to 1100 KB for HTTP client stack

The swarm bridge (ADR-066) adds esp_http_client for Seed communication,
which pulls in the HTTP/TLS stack (~150 KB). Binary grew from ~978 KB to
~1077 KB. Raise the gate from 950 KB to 1100 KB. Still fits comfortably
in both 4MB (1856 KB OTA slot, 43% free) and 8MB flash variants.

Co-Authored-By: claude-flow <ruv@ruv.net>
2026-03-20 18:46:34 -04:00
ruv
7eba8c7286 feat: 10-in-1 medical vitals suite from single mmWave sensor
examples/medical/vitals_suite.py — all 10 capabilities:
1. Heart rate (continuous)
2. Breathing rate (continuous)
3. Blood pressure estimation (HRV-based)
4. HRV stress analysis (SDNN, RMSSD, pNN50)
5. Sleep stage classification (awake/light/deep/REM)
6. Apnea event detection (BR=0 for >10s, AHI scoring)
7. Cough detection (BR spike > 2.5x baseline)
8. Snoring detection (periodic high-amplitude BR)
9. Activity state (resting/active/exercising)
10. Meditation quality scorer (BR regularity + HR + HRV)

Uses Welford online stats, zero-crossing analysis, and
variability-based state classification. Single $15 sensor.

Co-Authored-By: claude-flow <ruv@ruv.net>
2026-03-15 18:05:42 -04:00
ruv
a7d417837f feat: RuView Live v2 — RuVector signal processing integration
Ported 5 RuVector/RuvSense algorithms from Rust to Python:
- WelfordStats (field_model.rs): online mean/variance/z-score
- VitalAnomalyDetector (vitals/anomaly.rs): Welford z-score apnea/tachy/brady
- LongitudinalTracker (ruvsense/longitudinal.rs): drift detection over time
- CoherenceScorer (ruvsense/coherence.rs): signal quality with decay
- HRVAnalyzer (vitals/heartrate.rs): SDNN, RMSSD, pNN50, LF/HF spectral

Live verified: detected HR anomaly (2.5sd drop) and BR drift (2.2sd rise)
from real mmWave + CSI data. Full session baselines tracked for 3 metrics.

Co-Authored-By: claude-flow <ruv@ruv.net>
2026-03-15 17:03:29 -04:00
ruv
4239dfa35a feat: RuView Live unified dashboard + improved examples README
ruview_live.py: single-file dashboard that auto-detects CSI and
mmWave sensors, displays fused vitals (HR, BR, BP, stress/HRV),
environment (light, RSSI, RF fingerprint), presence, and events.

Tested live: CSI 1000 frames/60s (17 Hz), light trending 7.4→6.0
lux, RSSI -57 to -72 dBm. Handles graceful degradation when
sensors are unavailable.

README: updated with unified dashboard as primary entry point,
hardware table with capabilities, expanded quick start.

Co-Authored-By: claude-flow <ruv@ruv.net>
2026-03-15 16:56:11 -04:00
ruv
24ea88cbe0 feat: 4 sensing examples — sleep apnea, stress, room environment
examples/sleep/apnea_screener.py — detects breathing cessation
events (>10s), computes AHI score, classifies OSA severity.

examples/stress/hrv_stress_monitor.py — real-time SDNN/RMSSD
from mmWave HR, stress level with visual bar.

examples/environment/room_monitor.py — dual-sensor (CSI + mmWave)
room awareness: occupancy, light, RF fingerprint, activity events.

examples/README.md — index with hardware table and quick start.

Co-Authored-By: claude-flow <ruv@ruv.net>
2026-03-15 16:50:04 -04:00
ruv
ef582b4429 docs: medical examples README + link from root README
- examples/medical/README.md: full guide for BP estimator,
  hardware requirements, sample output, accuracy table, AHA
  categories, disclaimer, RuView integration explanation
- README.md: added Medical Examples to documentation table

Co-Authored-By: claude-flow <ruv@ruv.net>
2026-03-15 16:36:45 -04:00
ruv
8318f9c677 feat: contactless blood pressure estimation via mmWave HRV (examples/medical)
Reads real-time heart rate from MR60BHA2 60 GHz mmWave sensor and
estimates BP trends using HR/HRV correlation model:
- Mean HR → baseline SBP/DBP
- SDNN (HRV) → sympathetic/parasympathetic adjustment
- LF/HF spectral ratio → fine adjustment (with numpy)
- Optional calibration with a real BP reading

Verified on real hardware: 125/83 mmHg estimate from 35 HR samples
over 60 seconds at 84 bpm mean HR with 91ms SDNN.

NOT A MEDICAL DEVICE — research/wellness tracking only.

Co-Authored-By: claude-flow <ruv@ruv.net>
2026-03-15 16:24:47 -04:00