Skip to content

feat(sensing-server): body tracking platform with persistent IDs and zones#487

Open
schwarztim wants to merge 1 commit intoruvnet:mainfrom
schwarztim:pr/body-tracking-zones
Open

feat(sensing-server): body tracking platform with persistent IDs and zones#487
schwarztim wants to merge 1 commit intoruvnet:mainfrom
schwarztim:pr/body-tracking-zones

Conversation

@schwarztim
Copy link
Copy Markdown

Motivation

Upstream's accepted ADR-081 (Adaptive CSI Mesh Firmware Kernel) describes the firmware vtable and is unrelated to body tracking. However, fork-side work has built a complete body-tracking platform that fits naturally with the v2/ sensing crate — persistent IDs across ticks, zone semantics, and REST APIs that downstream integrations (Home Assistant, dashboards) expect.

This PR contributes that work to upstream under a renumbered ADR (ADR-094) to avoid collision.

Changes

  • NEW: v2/crates/wifi-densepose-sensing-server/src/body_tracker.rsBodyTracker with persistent IDs, Kalman-filtered positions, zone tracking, and transition events. Self-contained: BodyCluster input type defined inline (no dependency on fork-specific spatial_pipeline module).
  • NEW: docs/adr/ADR-094-body-tracking-platform.md — design decision record (renumbered from fork ADR-081 to avoid collision with upstream ADR-081 Adaptive CSI Mesh Firmware Kernel, accepted 2026-04-19)
  • v2/crates/wifi-densepose-sensing-server/src/main.rs — add body_tracker module, wire BodyTracker into AppStateInner, expose tracking REST endpoints
  • CHANGELOG.md — entry under [Unreleased]

API surface

  • GET /api/v1/tracking/bodies — list of tracked bodies with persistent IDs, current pose hint, current zone, last-seen timestamp
  • POST /api/v1/tracking/zones — set zone definitions (rectangular regions)
  • GET /api/v1/tracking/zones — current zone configuration
  • DELETE /api/v1/tracking/zones/{name} — remove a named zone

Design notes

  • Bodies are matched across ticks via greedy nearest-neighbor assignment on centroid distance (< 2m threshold); IDs persist until quality decays to 0 (20 absent frames at default settings)
  • Simple Kalman filter (alpha=0.3 position correction + velocity estimation) smooths frame-to-frame centroid noise
  • Zone events fire on tick boundaries when a body's containing zone changes
  • This platform is the foundation for several upcoming PRs (activity history, fall detection, sleep detection, dashboard floor plan)

Test results

  • cargo test --workspace --no-default-features: 1647 passed, 0 failed (5 unit tests in body_tracker module: creation, ID persistence, timeout decay, zone containment, zone transitions)
  • python v1/data/proof/verify.py: VERDICT: FAIL — pre-existing on origin/main (numpy/scipy version drift); not caused by this PR

…zones

- New body_tracker module: BodyTracker with greedy nearest-neighbor
  association + Kalman filtering for stable body IDs across ticks
- BodyCluster type defined inline (self-contained, no spatial_pipeline dep)
- Zone system: configurable axis-aligned 3D boxes with transition events
- AppStateInner: body_tracker field wired into main loop
- REST: GET /api/v1/tracking/bodies, GET/POST /api/v1/tracking/zones,
  DELETE /api/v1/tracking/zones/{name}
- 5 unit tests: creation, ID persistence, timeout, zone containment, transitions
- ADR-094 (renumbered from fork ADR-081 to avoid collision with upstream
  ADR-081 Adaptive CSI Mesh Firmware Kernel, accepted 2026-04-19)
schwarztim pushed a commit to schwarztim/RuView that referenced this pull request Apr 28, 2026
…racking PR

PR ruvnet#487 (body tracking platform) was filed first and claims ADR-094.
Rename docs/adr/ADR-094-pull-based-ota.md → ADR-095-pull-based-ota.md
and update all references in CHANGELOG.md, Cargo.toml, and main.rs comments.
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