mirror of
https://github.com/ruvnet/RuView
synced 2026-07-19 16:53:18 +00:00
8166d8d822
- Docker default changed from --source simulated to --source auto (auto-detects ESP32 on UDP 5005, falls back to simulation) - Pose derivation now driven by real sensing features: motion_band_power, breathing_band_power, variance, dominant_freq_hz, change_points - Temporal feature extraction: 100-frame circular buffer, Goertzel breathing rate estimation (0.1-0.5 Hz), frame-to-frame L2 motion detection, SNR-based signal quality metric - Signal field driven by subcarrier variance spatial mapping instead of fixed animation circle - UI data source indicators: LIVE/RECONNECTING/SIMULATED banner on sensing tab, estimation mode badge on live demo tab - Setup guide panel explaining ESP32 count requirements for each capability level (1x: presence, 3x: localization, 4x+: full pose) - Tick rate improved from 500ms to 100ms (2fps to 10fps) - Fixed Option<f64> division bug from PR #83 - ADR-035 documents all decisions Closes #86 Co-Authored-By: claude-flow <ruv@ruv.net>
33 lines
1.1 KiB
TypeScript
33 lines
1.1 KiB
TypeScript
import { useEffect } from 'react';
|
|
import { wsService } from '@/services/ws.service';
|
|
import { usePoseStore } from '@/stores/poseStore';
|
|
import { useSettingsStore } from '@/stores/settingsStore';
|
|
|
|
export interface UsePoseStreamResult {
|
|
connectionStatus: ReturnType<typeof usePoseStore.getState>['connectionStatus'];
|
|
lastFrame: ReturnType<typeof usePoseStore.getState>['lastFrame'];
|
|
isSimulated: boolean;
|
|
}
|
|
|
|
export function usePoseStream(): UsePoseStreamResult {
|
|
const connectionStatus = usePoseStore((state) => state.connectionStatus);
|
|
const lastFrame = usePoseStore((state) => state.lastFrame);
|
|
const isSimulated = usePoseStore((state) => state.isSimulated);
|
|
const serverUrl = useSettingsStore((state) => state.serverUrl);
|
|
|
|
useEffect(() => {
|
|
const unsubscribe = wsService.subscribe((frame) => {
|
|
usePoseStore.getState().handleFrame(frame);
|
|
});
|
|
|
|
// Auto-connect to sensing server on mount
|
|
wsService.connect(serverUrl);
|
|
|
|
return () => {
|
|
unsubscribe();
|
|
};
|
|
}, [serverUrl]);
|
|
|
|
return { connectionStatus, lastFrame, isSimulated };
|
|
}
|