fix: make v1 Python API runnable on WSL2 with real WiFi sensing#150
Open
SabaPivot wants to merge 1 commit intoruvnet:mainfrom
Open
fix: make v1 Python API runnable on WSL2 with real WiFi sensing#150SabaPivot wants to merge 1 commit intoruvnet:mainfrom
SabaPivot wants to merge 1 commit intoruvnet:mainfrom
Conversation
Fixes multiple issues that prevented the v1 API from starting and serving real-time pose/sensing data end-to-end: Bug fixes: - Fix datetime serialization in pose_service (4 locations) — raw datetime objects in dicts caused TypeError on WebSocket send_json - Fix zone confidence averaging — use incremental mean instead of broken (0 + value) / 2 formula that always halved confidence - Fix CORS/allowed_hosts parsing — settings expected List[str] but .env provides strings; add flexible parsing via _list properties - Bridge orchestrator services to app.state so health endpoint works - Fix sensing module imports: v1.src.sensing → src.sensing (5 files) - Lazy-import torch in pose_service so API starts without PyTorch Features: - WSL2 support: WindowsWifiCollector auto-detects WSL2 and uses netsh.exe; parses Korean-locale output (신호, 수신 속도, etc.) - RSSI dithering (σ=0.3 dBm) overcomes integer-dBm quantization from netsh, enabling meaningful feature extraction from flat signals - Signal-derived pose stream: pose_stream.py connects to sensing WebSocket and converts presence/motion classification into COCO 17-keypoint pose data for the Live Demo canvas - WebSocket proxy /ws/sensing in app.py bridges UI to sensing server - Static file serving for UI at /app/ path - Sensing UI recognizes windows_wifi/linux_wifi/macos_wifi as live data sources with "REAL WIFI DATA" banner
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The v1 Python API had several issues that prevented it from starting and serving real-time data. This PR fixes all of them and adds WSL2 WiFi sensing support so the Live Demo and Sensing tabs work end-to-end with real WiFi signals.
Bug Fixes
pose_service.pyput rawdatetimeobjects into dicts broadcast via WebSocket, causingTypeError: Object of type datetime is not JSON serializable. Fixed with.isoformat().(0 + confidence) / 2always halved the first person's confidence, causing values to fall below the stream filter threshold. Replaced with proper incremental mean.Settingsdeclaredcors_originsandallowed_hostsasList[str], but.envprovides plain strings. Added_listproperties that accept both JSON arrays and comma-separated strings.request.app.state.hardware_servicewas never set because the orchestrator stored services only onself. Added service bridge in lifespan.from v1.src.sensing.*which fails when running from insidev1/. Fixed tofrom src.sensing.*.pose_service.pyimported torch at module level, crashing the API if PyTorch wasn't installed. Made it lazy-import on demand.Features
WindowsWifiCollectorauto-detects WSL2 and usesnetsh.exe; parses Korean-locale output fields (신호,수신 속도,전송 속도); captures throughput rates as additional metrics.netshreports integer dBm, producing variance=0 and collapsing all spectral features. Added Gaussian dithering (σ=0.3 dBm) to overcome quantization, a standard signal processing technique for quantized ADCs.pose_stream.pyconnects to the sensing WebSocket (ws://localhost:8765) and converts presence/motion classification into COCO 17-keypoint pose data, so the Live Demo shows real WiFi-based detection./ws/sensingendpoint inapp.pybridges the UI to the sensing server, eliminating cross-origin WebSocket issues./app/so everything runs from a singleuvicornprocess.windows_wifi,linux_wifi, andmacos_wifias live data sources.Test Plan
from src.sensing.*)_sensing_to_pose()returns valid 17-keypoint data when present,Nonewhen absent