Skip to content

feat(sensing-server): wire wifi-densepose-vitals 4-stage pipeline#485

Open
schwarztim wants to merge 1 commit intoruvnet:mainfrom
schwarztim:pr/vitals-4-stage-pipeline-clean
Open

feat(sensing-server): wire wifi-densepose-vitals 4-stage pipeline#485
schwarztim wants to merge 1 commit intoruvnet:mainfrom
schwarztim:pr/vitals-4-stage-pipeline-clean

Conversation

@schwarztim
Copy link
Copy Markdown

Motivation

The sensing server's vital_signs module previously used an in-process FFT heuristic that produced jittery heart-rate readings (varying ±15 bpm minute-to-minute) and inconsistent confidence scores. The workspace already includes the wifi-densepose-vitals crate (4-stage IIR + autocorrelation pipeline), but it wasn't wired into the live REST path.

Design rationale

  • Why a wrapper (CrateVitalsPipeline) instead of replacing the heuristic outright? Confidence-based fallback. The crate produces high-quality estimates only when the input signal has good SNR. Below confidence 0.05 the legacy heuristic outperforms the crate output, so we fall back. This preserves availability under poor signal conditions.
  • Why threshold 0.05? Empirically calibrated against the test fixture set in wifi-densepose-vitals/tests/. Confidence below 0.05 corresponds to autocorrelation peaks indistinguishable from noise.
  • Why call per-frame instead of batched? The legacy path is also per-frame; matching the call cadence simplifies the swap and avoids buffer-management changes.

Changes

  • v2/crates/wifi-densepose-sensing-server/src/vital_signs.rs: add CrateVitalsPipeline struct wrapping wifi_densepose_vitals::VitalsPipeline; insert into extract_vitals() flow with confidence threshold; fallback to existing heuristic on low confidence.
  • v2/crates/wifi-densepose-sensing-server/src/types.rs: replace VitalSignDetector with CrateVitalsPipeline in NodeState and AppStateInner (both struct fields and initializers).
  • v2/crates/wifi-densepose-sensing-server/Cargo.toml: add wifi-densepose-vitals workspace dep.

Test results

  • cargo test --workspace --no-default-features: 1632 passed, 0 failed
  • python verify.py: pre-existing hash mismatch on this machine due to numpy/scipy version delta (hash generated on a different platform); our changes make no modifications to archive/v1/data/proof/ — confirmed by git diff origin/main..HEAD -- archive/v1/data/proof/

ADR / docs

  • References ADR-045 (vitals jitter investigation); design rationale above is the implementation decision record for this wrapper.
  • No new ADR needed; the wifi-densepose-vitals crate already has its own design notes.

Add CrateVitalsPipeline wrapping the wifi-densepose-vitals crate's
IIR + autocorrelation pipeline. Uses crate output when confidence > 0.05,
falls back to FFT heuristic below threshold. Reduces HR jitter and
unstable confidence readings (ADR-045 §4.2).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant