Iter 17 — closes the per-frame mesh-time loop for ADR-018 CSI frames
that carry no per-frame local_us field (the v1 wire format reserves no
slot — see WITNESS-LOG-110 §A0.11).
Math: pair the frame's sequence number against the sync packet's
sequence high-water + an assumed CSI frame rate. Δframes × 1/fps
estimates the node-local delta from the sync, then apply_to_local
recovers the mesh epoch.
SyncPacket::mesh_aligned_us_for_sequence(frame_seq: u32, fps_hz: f64) -> u64
3 new unit tests (13 total in sync_packet::tests, all green):
* mesh_aligned_for_sequence_identity_at_sync_point — at sync.sequence
returns sync.epoch_us exactly
* mesh_aligned_for_sequence_extrapolates_forward — 20 frames @ 20 fps
extrapolates by exactly 1 s
* mesh_aligned_for_sequence_handles_seq_wraparound — u32 sequence
wrap doesn't jump backward by 2^32 (wrapping_sub guards it)
NodeState hook:
NodeState::mesh_aligned_us_for_csi_frame(frame_sequence: u32) -> Option<u64>
Wraps the SyncPacket method, defaults fps_hz=20.0 (matches the
firmware's CSI_MIN_SEND_INTERVAL_US-implied ceiling), enforces the
same 9 s staleness gate as mesh_aligned_us.
cargo check -p wifi-densepose-sensing-server --no-default-features → green.
cargo test -p wifi-densepose-hardware sync_packet → 13/13, 122 filtered.
Downstream ADR-029/030 multistatic fusion code can now do:
if frame.adr018_flags.ieee802154_sync_valid {
if let Some(mesh_us) = ns.mesh_aligned_us_for_csi_frame(frame.sequence) {
// pair this frame with frames from sibling nodes by mesh_us
}
}
Co-Authored-By: claude-flow <ruv@ruv.net>
|
||
|---|---|---|
| .. | ||
| benches | ||
| src | ||
| Cargo.toml | ||
| README.md | ||
README.md
wifi-densepose-hardware
Hardware interface abstractions for WiFi CSI sensors (ESP32, Intel 5300, Atheros).
Overview
wifi-densepose-hardware provides platform-agnostic parsers for WiFi CSI data from multiple
hardware sources. All parsing operates on byte buffers with no C FFI or hardware dependencies at
compile time, making the crate fully portable and deterministic -- the same bytes in always produce
the same parsed output.
Features
- ESP32 binary parser -- Parses ADR-018 binary CSI frames streamed over UDP from ESP32 and ESP32-S3 devices.
- UDP aggregator -- Receives and aggregates CSI frames from multiple ESP32 nodes (ADR-018 Layer 2). Provided as a standalone binary.
- Bridge -- Converts hardware
CsiFrameinto theCsiDataformat expected by the detection pipeline (ADR-018 Layer 3). - No mock data -- Parsers either parse real bytes or return explicit
ParseErrorvalues. There are no synthetic fallbacks. - Pure byte-buffer parsing -- No FFI to ESP-IDF or kernel modules. Safe to compile and test on any platform.
Feature flags
| Flag | Default | Description |
|---|---|---|
std |
yes | Standard library support |
esp32 |
no | ESP32 serial CSI frame parsing |
intel5300 |
no | Intel 5300 CSI Tool log parsing |
linux-wifi |
no | Linux WiFi interface for commodity sensing |
Quick Start
use wifi_densepose_hardware::{CsiFrame, Esp32CsiParser, ParseError};
// Parse ESP32 CSI data from raw UDP bytes
let raw_bytes: &[u8] = &[/* ADR-018 binary frame */];
match Esp32CsiParser::parse_frame(raw_bytes) {
Ok((frame, consumed)) => {
println!("Parsed {} subcarriers ({} bytes)",
frame.subcarrier_count(), consumed);
let (amplitudes, phases) = frame.to_amplitude_phase();
// Feed into detection pipeline...
}
Err(ParseError::InsufficientData { needed, got }) => {
eprintln!("Need {} bytes, got {}", needed, got);
}
Err(e) => eprintln!("Parse error: {}", e),
}
Architecture
wifi-densepose-hardware/src/
lib.rs -- Re-exports: CsiFrame, Esp32CsiParser, ParseError, CsiData
csi_frame.rs -- CsiFrame, CsiMetadata, SubcarrierData, Bandwidth, AntennaConfig
esp32_parser.rs -- Esp32CsiParser (ADR-018 binary protocol)
error.rs -- ParseError
bridge.rs -- CsiData bridge to detection pipeline
aggregator/ -- UDP multi-node frame aggregator (binary)
Related Crates
| Crate | Role |
|---|---|
wifi-densepose-core |
Foundation types (CsiFrame definitions) |
wifi-densepose-signal |
Consumes parsed CSI data for processing |
wifi-densepose-mat |
Uses hardware adapters for disaster detection |
wifi-densepose-vitals |
Vital sign extraction from parsed frames |
License
MIT OR Apache-2.0