Skip to content

Free Motion Capture for Everyone πŸ’€βœ¨

TypeScript

chkpt

jonmatthis329abee3801d
diff --git a/.claude/settings.local.json b/.claude/settings.local.json
deleted file mode 100644
index e979d0f0..00000000
--- a/.claude/settings.local.json
+++ /dev/null
@@ -1,8 +0,0 @@
-{
- "permissions": {
- "allow": [
- "Bash(npm run:*)",
- "Bash(npx tsc:*)"
- ]
- }
-}
diff --git a/freemocap-ui/src/components/common/PresetPicker.tsx b/freemocap-ui/src/components/common/PresetPicker.tsx
new file mode 100644
index 00000000..ef8794fb
--- /dev/null
+++ b/freemocap-ui/src/components/common/PresetPicker.tsx
@@ -0,0 +1,50 @@
+import React from "react";
+import {FormControl, InputLabel, MenuItem, Select, SxProps, Theme} from "@mui/material";
+
+interface PresetOption<T extends string> {
+ value: T;
+ label: string;
+}
+
+interface PresetPickerProps<T extends string> {
+ label?: string;
+ value: T;
+ options: PresetOption<T>[];
+ onChange: (value: T) => void;
+ disabled?: boolean;
+ size?: "small" | "medium";
+ minWidth?: number;
+ sx?: SxProps<Theme>;
+}
+
+export function PresetPicker<T extends string>({
+ label,
+ value,
+ options,
+ onChange,
+ disabled = false,
+ size = "small",
+ minWidth = 120,
+ sx,
+}: PresetPickerProps<T>): React.ReactElement {
+ const labelId = label ? `preset-picker-${label.toLowerCase().replace(/\s+/g, "-")}-label` : undefined;
+
+ return (
+ <FormControl size={size} sx={{minWidth, ...sx}}>
+ {label && <InputLabel id={labelId}>{label}</InputLabel>}
+ <Select
+ labelId={labelId}
+ value={value}
+ label={label || undefined}
+ onChange={(e) => onChange(e.target.value as T)}
+ disabled={disabled}
+ >
+ {options.map((opt) => (
+ <MenuItem key={opt.value} value={opt.value}>
+ {opt.label}
+ </MenuItem>
+ ))}
+ </Select>
+ </FormControl>
+ );
+}
diff --git a/freemocap-ui/src/components/control-panels/calibration-control-panel/CharucoBoardConfigSection.tsx b/freemocap-ui/src/components/control-panels/calibration-control-panel/CharucoBoardConfigSection.tsx
index e8efe161..8e7ba237 100644
--- a/freemocap-ui/src/components/control-panels/calibration-control-panel/CharucoBoardConfigSection.tsx
+++ b/freemocap-ui/src/components/control-panels/calibration-control-panel/CharucoBoardConfigSection.tsx
@@ -1,15 +1,12 @@
import React, {useCallback, useMemo} from "react";
import {
- FormControl,
- InputLabel,
- MenuItem,
- Select,
Stack,
TextField,
Typography,
useTheme,
} from "@mui/material";
import {useCalibration} from "@/hooks/useCalibration";
+import {PresetPicker} from "@/components/common/PresetPicker";
type BoardPreset = "5x3" | "7x5" | "custom";
@@ -55,20 +52,18 @@ export const CharucoBoardConfigSection: React.FC = () => {
</Typography>
{/* Preset */}
- <FormControl size="small" sx={{minWidth: 140}}>
- <InputLabel id="board-preset-label">Preset</InputLabel>
- <Select
- labelId="board-preset-label"
- value={currentPreset}
- label="Preset"
- onChange={(e) => handlePresetChange(e.target.value as BoardPreset)}
- disabled={isLoading}
- >
- <MenuItem value="5x3">5Γ—3</MenuItem>
- <MenuItem value="7x5">7Γ—5</MenuItem>
- <MenuItem value="custom">Custom</MenuItem>
- </Select>
- </FormControl>
+ <PresetPicker
+ label="Preset"
+ value={currentPreset}
+ options={[
+ {value: "5x3" as BoardPreset, label: "5Γ—3"},
+ {value: "7x5" as BoardPreset, label: "7Γ—5"},
+ {value: "custom" as BoardPreset, label: "Custom"},
+ ]}
+ onChange={handlePresetChange}
+ disabled={isLoading}
+ minWidth={140}
+ />
{/* X / Y Squares */}
<Stack direction="row" spacing={2}>
diff --git a/freemocap-ui/src/components/control-panels/recording-info-panel/RecordingInfoPanel.tsx b/freemocap-ui/src/components/control-panels/recording-info-panel/RecordingInfoPanel.tsx
index f74eb910..94df9bcf 100644
--- a/freemocap-ui/src/components/control-panels/recording-info-panel/RecordingInfoPanel.tsx
+++ b/freemocap-ui/src/components/control-panels/recording-info-panel/RecordingInfoPanel.tsx
@@ -5,6 +5,13 @@ import ExpandMoreIcon from "@mui/icons-material/ExpandMore";
import ChevronRightIcon from "@mui/icons-material/ChevronRight";
import FiberManualRecordIcon from '@mui/icons-material/FiberManualRecord';
import {recordingInfoUpdated, startRecording, stopRecording, useAppDispatch, useAppSelector} from "@/store";
+import {pathRecomputed} from "@/store/slices/recording/recording-slice";
+import {manualCalibrationRecordingPathChanged} from "@/store/slices/calibration/calibration-slice";
+import {calibrateRecording} from "@/store/slices/calibration/calibration-thunks";
+import {manualMocapRecordingPathChanged} from "@/store/slices/mocap/mocap-slice";
+import {processMocapRecording} from "@/store/slices/mocap/mocap-thunks";
+import {PresetPicker} from "@/components/common/PresetPicker";
+import {RecordingTypePreset, RECORDING_TYPE_OPTIONS} from "./recording-type-preset";
import {
MicrophoneSelector
} from "@/components/control-panels/recording-info-panel/recording-subcomponents/MicrophoneSelector";
@@ -46,6 +53,7 @@ export const RecordingInfoPanel: React.FC = () => {
const [customSubfolderName, setCustomSubfolderName] = useState<string>("");
const [recordingTag, setRecordingTag] = useState<string>("");
const [micDeviceIndex, setMicDeviceIndex] = useState<number>(-1);
+ const [recordingTypePreset, setRecordingTypePreset] = useState<RecordingTypePreset>("none");
const {isElectron, api} = useElectronIPC();
const {connectedCameraIds} = useServer();
const noCamerasConnected = connectedCameraIds.length === 0;
@@ -53,6 +61,13 @@ export const RecordingInfoPanel: React.FC = () => {
// Recording duration for summary
const [recordingDuration, setRecordingDuration] = useState<string>("");
+ // Keep the computed recording path timestamp ticking with the wall clock
+ useEffect(() => {
+ if (recordingInfo.isRecording) return;
+ const id = setInterval(() => dispatch(pathRecomputed()), 1000);
+ return () => clearInterval(id);
+ }, [dispatch, recordingInfo.isRecording]);
+
// Track when recording state changes to clear pending state
useEffect(() => {
if (pendingOperation) {
@@ -160,6 +175,10 @@ export const RecordingInfoPanel: React.FC = () => {
parts.push(baseName);
}
+ if (recordingTypePreset !== "none") {
+ parts.push(recordingTypePreset);
+ }
+
if (recordingTag) {
parts.push(recordingTag);
}
@@ -214,7 +233,15 @@ export const RecordingInfoPanel: React.FC = () => {
setPendingOperation({type: 'stop', timestamp: Date.now()});
try {
- await dispatch(stopRecording()).unwrap();
+ const result = await dispatch(stopRecording()).unwrap();
+ // Auto-launch pipeline based on recording type preset
+ if (result && recordingTypePreset === "calibration") {
+ dispatch(manualCalibrationRecordingPathChanged(result.recording_path));
+ dispatch(calibrateRecording());
+ } else if (result && recordingTypePreset === "mocap") {
+ dispatch(manualMocapRecordingPathChanged(result.recording_path));
+ dispatch(processMocapRecording());
+ }
} catch (error) {
console.error("Failed to stop recording:", error);
setPendingOperation(null);
@@ -237,6 +264,21 @@ export const RecordingInfoPanel: React.FC = () => {
<CollapsibleSidebarSection
icon={<FiberManualRecordIcon sx={{color: "inherit"}}/>}
title={"Recording"}
+ secondaryControls={
+ <PresetPicker
+ value={recordingTypePreset}
+ options={RECORDING_TYPE_OPTIONS}
+ onChange={setRecordingTypePreset}
+ disabled={recordingInfo.isRecording}
+ size="small"
+ minWidth={80}
+ sx={{
+ '& .MuiSelect-select': {py: 0.25, fontSize: 12, color: 'inherit'},
+ '& .MuiOutlinedInput-notchedOutline': {borderColor: 'rgba(255,255,255,0.3)'},
+ '& .MuiSvgIcon-root': {color: 'inherit'},
+ }}
+ />
+ }
summaryContent={
<RecordingSummary
isRecording={recordingInfo.isRecording}
diff --git a/freemocap-ui/src/components/control-panels/recording-info-panel/recording-type-preset.ts b/freemocap-ui/src/components/control-panels/recording-info-panel/recording-type-preset.ts
new file mode 100644
index 00000000..e5520d42
--- /dev/null
+++ b/freemocap-ui/src/components/control-panels/recording-info-panel/recording-type-preset.ts
@@ -0,0 +1,7 @@
+export type RecordingTypePreset = "none" | "calibration" | "mocap";
+
+export const RECORDING_TYPE_OPTIONS: { value: RecordingTypePreset; label: string }[] = [
+ {value: "none", label: "None"},
+ {value: "calibration", label: "Cal"},
+ {value: "mocap", label: "Mocap"},
+];
diff --git a/freemocap-ui/src/components/pipeline-progress/PipelineProgressBar.tsx b/freemocap-ui/src/components/pipeline-progress/PipelineProgressBar.tsx
index 6545b1fc..4dd1878c 100644
--- a/freemocap-ui/src/components/pipeline-progress/PipelineProgressBar.tsx
+++ b/freemocap-ui/src/components/pipeline-progress/PipelineProgressBar.tsx
@@ -1,7 +1,16 @@
import Box from '@mui/material/Box';
import LinearProgress from '@mui/material/LinearProgress';
import Typography from '@mui/material/Typography';
-import {PipelineProgress, PHASE_LABELS} from '@/store/slices/pipelines';
+import {PipelineProgress, PipelinePhase, PHASE_LABELS} from '@/store/slices/pipelines';
+
+function formatTimeAgo(timestamp: number): string {
+ const seconds = Math.floor((Date.now() - timestamp) / 1000);
+ if (seconds < 60) return `${seconds}s ago`;
+ const minutes = Math.floor(seconds / 60);
+ if (minutes < 60) return `${minutes}m ago`;
+ const hours = Math.floor(minutes / 60);
+ return `${hours}h ago`;
+}
interface PipelineProgressBarProps {
pipeline: PipelineProgress;
@@ -9,17 +18,21 @@ interface PipelineProgressBarProps {
export default function PipelineProgressBar({pipeline}: PipelineProgressBarProps) {
const phaseLabel = PHASE_LABELS[pipeline.phase] ?? pipeline.phase;
- const isFailed = pipeline.phase === 'failed';
- const isComplete = pipeline.phase === 'complete';
+ const isFailed = pipeline.phase === PipelinePhase.FAILED;
+ const isComplete = pipeline.phase === PipelinePhase.COMPLETE;
+ const isTerminal = isComplete || isFailed;
return (
- <Box sx={{px: 1, py: 0.5}}>
+ <Box sx={{px: 1, py: 0.5, opacity: isTerminal ? 0.5 : 1}}>
<Box sx={{display: 'flex', justifyContent: 'space-between', alignItems: 'baseline', mb: 0.25}}>
<Typography variant="caption" fontWeight="bold" noWrap sx={{flex: 1, mr: 1}}>
{pipeline.pipelineType} β€” {pipeline.pipelineId}
</Typography>
<Typography variant="caption" color="text.secondary">
- {phaseLabel} {pipeline.progress}%
+ {isTerminal && pipeline.completedAt
+ ? `${phaseLabel} ${formatTimeAgo(pipeline.completedAt)}`
+ : `${phaseLabel} ${pipeline.progress}%`
+ }
</Typography>
</Box>
<LinearProgress
diff --git a/freemocap-ui/src/components/pipeline-progress/PipelineProgressPanel.tsx b/freemocap-ui/src/components/pipeline-progress/PipelineProgressPanel.tsx
index 8661b0fd..15e54fdb 100644
--- a/freemocap-ui/src/components/pipeline-progress/PipelineProgressPanel.tsx
+++ b/freemocap-ui/src/components/pipeline-progress/PipelineProgressPanel.tsx
@@ -1,63 +1,68 @@
-import {useEffect, useRef} from 'react';
import Box from '@mui/material/Box';
import Typography from '@mui/material/Typography';
+import TextField from '@mui/material/TextField';
+import FormControlLabel from '@mui/material/FormControlLabel';
+import Checkbox from '@mui/material/Checkbox';
import {useAppDispatch, useAppSelector} from '@/store/hooks';
-import {selectActivePipelines, pipelineRemoved, PipelinePhase} from '@/store/slices/pipelines';
+import {
+ selectFilteredPipelines,
+ selectHasCompletedPipelines,
+ selectShowCompleted,
+ selectFilterText,
+ toggleShowCompleted,
+ filterTextChanged,
+} from '@/store/slices/pipelines';
import PipelineProgressBar from './PipelineProgressBar';
-const REMOVAL_DELAY_MS = 3000;
-
export default function PipelineProgressPanel() {
- const pipelines = useAppSelector(selectActivePipelines);
+ const pipelines = useAppSelector(selectFilteredPipelines);
+ const hasCompleted = useAppSelector(selectHasCompletedPipelines);
+ const showCompleted = useAppSelector(selectShowCompleted);
+ const filterText = useAppSelector(selectFilterText);
const dispatch = useAppDispatch();
- const removalTimers = useRef<Record<string, ReturnType<typeof setTimeout>>>({});
-
- const entries = Object.values(pipelines);
-
- // Auto-remove completed/failed pipelines after delay
- useEffect(() => {
- for (const p of entries) {
- const isTerminal = p.phase === PipelinePhase.COMPLETE || p.phase === PipelinePhase.FAILED;
- if (isTerminal && !removalTimers.current[p.pipelineId]) {
- removalTimers.current[p.pipelineId] = setTimeout(() => {
- dispatch(pipelineRemoved(p.pipelineId));
- delete removalTimers.current[p.pipelineId];
- }, REMOVAL_DELAY_MS);
- }
- }
- // Clean up timers for pipelines no longer in state
- for (const id of Object.keys(removalTimers.current)) {
- if (!pipelines[id]) {
- clearTimeout(removalTimers.current[id]);
- delete removalTimers.current[id];
- }
- }
- }, [pipelines, dispatch, entries]);
-
- // Cleanup on unmount
- useEffect(() => {
- return () => {
- for (const timer of Object.values(removalTimers.current)) {
- clearTimeout(timer);
- }
- };
- }, []);
- if (entries.length === 0) {
- return (
- <Box sx={{height: '100%', display: 'flex', alignItems: 'center', justifyContent: 'center'}}>
- <Typography variant="caption" color="text.secondary">
- No active pipelines
- </Typography>
+ return (
+ <Box sx={{height: '100%', display: 'flex', flexDirection: 'column'}}>
+ <Box sx={{display: 'flex', alignItems: 'center', gap: 1, px: 1, py: 0.5, flexShrink: 0}}>
+ <TextField
+ size="small"
+ placeholder="Filter..."
+ value={filterText}
+ onChange={(e) => dispatch(filterTextChanged(e.target.value))}
+ sx={{
+ flex: 1,
+ '& .MuiInputBase-root': {height: 28, fontSize: '0.75rem'},
+ }}
+ />
+ {hasCompleted && (
+ <FormControlLabel
+ control={
+ <Checkbox
+ size="small"
+ checked={showCompleted}
+ onChange={() => dispatch(toggleShowCompleted())}
+ sx={{p: 0.25}}
+ />
+ }
+ label={<Typography variant="caption">Show completed</Typography>}
+ sx={{mr: 0, ml: 0}}
+ />
+ )}
</Box>
- );
- }
- return (
- <Box sx={{height: '100%', overflow: 'auto', py: 0.5}}>
- {entries.map((p) => (
- <PipelineProgressBar key={p.pipelineId} pipeline={p}/>
- ))}
+ <Box sx={{flex: 1, overflow: 'auto'}}>
+ {pipelines.length === 0 ? (
+ <Box sx={{height: '100%', display: 'flex', alignItems: 'center', justifyContent: 'center'}}>
+ <Typography variant="caption" color="text.secondary">
+ No active pipelines
+ </Typography>
+ </Box>
+ ) : (
+ pipelines.map((p) => (
+ <PipelineProgressBar key={p.pipelineId} pipeline={p}/>
+ ))
+ )}
+ </Box>
</Box>
);
}
diff --git a/freemocap-ui/src/components/ui-components/MainNavTabs.tsx b/freemocap-ui/src/components/ui-components/MainNavTabs.tsx
new file mode 100644
index 00000000..ac418684
--- /dev/null
+++ b/freemocap-ui/src/components/ui-components/MainNavTabs.tsx
@@ -0,0 +1,60 @@
+import {useLocation, useNavigate} from "react-router-dom";
+import {useCallback, useMemo} from "react";
+import {alpha, darken} from "@mui/material/styles";
+import {Tab, Tabs} from "@mui/material";
+
+const NAV_TABS = [
+ {path: '/welcome', label: 'Home'},
+ {path: '/streaming', label: 'Streaming'},
+ {path: '/playback', label: 'Playback'},
+] as const;
+
+export const MainNavTabs = () => {
+ const location = useLocation();
+ const navigate = useNavigate();
+
+ const activeTab = useMemo(() => {
+ const idx = NAV_TABS.findIndex(t => location.pathname === t.path);
+ return idx >= 0 ? idx : 0;
+ }, [location.pathname]);
+
+ const handleTabChange = useCallback((_: React.SyntheticEvent, index: number) => {
+ navigate(NAV_TABS[index].path);
+ }, [navigate]);
+
+ return (
+ <Tabs
+ value={activeTab}
+ onChange={handleTabChange}
+ sx={(theme) => ({
+ minHeight: 28,
+ px: 0.5,
+ borderRadius: 1,
+ backgroundColor: darken(theme.palette.background.default, 0.2),
+ borderBottom: `1px solid ${alpha(theme.palette.divider, 0.2)}`,
+ '& .MuiTab-root': {
+ minHeight: 28,
+ fontSize: '0.75rem',
+ py: 0.5,
+ borderRadius: 0.75,
+ position: 'relative',
+ },
+ '& .MuiTab-root:not(:last-of-type)::after': {
+ content: '""',
+ position: 'absolute',
+ right: 0,
+ top: '22%',
+ height: '56%',
+ borderRight: `1px solid ${alpha(theme.palette.divider, 0.15)}`,
+ },
+ '& .MuiTab-root.Mui-selected': {
+ backgroundColor: darken(theme.palette.background.paper, 0.15),
+ },
+ })}
+ >
+ {NAV_TABS.map(tab => (
+ <Tab key={tab.path} label={tab.label}/>
+ ))}
+ </Tabs>
+ );
+};
diff --git a/freemocap-ui/src/components/ui-components/PageTabButtons.tsx b/freemocap-ui/src/components/ui-components/PageTabButtons.tsx
deleted file mode 100644
index dde42dfc..00000000
--- a/freemocap-ui/src/components/ui-components/PageTabButtons.tsx
+++ /dev/null
@@ -1,42 +0,0 @@
-import {useLocation, useNavigate} from "react-router-dom";
-import {StreamingViewPage} from "@/pages/StreamingViewPage";
-import PlaybackPage from "@/pages/PlaybackPage";
-import {TabbedContent} from "@/components/ui-components/TabbedContent";
-import {useCallback, useMemo} from "react";
-import Box from "@mui/material/Box";
-
-const PAGE_TABS = [
- {path: '/streaming', label: 'Streaming'},
- {path: '/playback', label: 'Playback'},
-] as const;
-
-export const PageTabButtons = () => {
- const location = useLocation();
- const navigate = useNavigate();
-
- const isTabRoute = PAGE_TABS.some(t => location.pathname === t.path);
-
- const activeTab = useMemo(() => {
- const idx = PAGE_TABS.findIndex(t => location.pathname === t.path);
- return idx >= 0 ? idx : 0;
- }, [location.pathname]);
-
- const handleTabChange = useCallback((index: number) => {
- navigate(PAGE_TABS[index].path);
- }, [navigate]);
-
- const tabs = useMemo(() => [
- {label: PAGE_TABS[0].label, content: <StreamingViewPage/>},
- {label: PAGE_TABS[1].label, content: <PlaybackPage/>},
- ], []);
-
- return (
- <Box sx={{display: isTabRoute ? 'flex' : 'none', flexDirection: 'column', height: '100%'}}>
- <TabbedContent
- tabs={tabs}
- activeTab={activeTab}
- onTabChange={handleTabChange}
- />
- </Box>
- );
-};
diff --git a/freemocap-ui/src/components/viewport3d/helpers/skeleton-colors.ts b/freemocap-ui/src/components/viewport3d/helpers/skeleton-colors.ts
index a2e5cf2e..f9ba4dc2 100644
--- a/freemocap-ui/src/components/viewport3d/helpers/skeleton-colors.ts
+++ b/freemocap-ui/src/components/viewport3d/helpers/skeleton-colors.ts
@@ -8,4 +8,5 @@ export const SKELETON_COLORS = {
rightHand: new Color('#FF00FF'),
face: new Color('#FFD700'),
hidden: new Color('#000000'),
+ charuco: new Color('#00FF00'),
} as const;
diff --git a/freemocap-ui/src/components/viewport3d/helpers/skeleton-config.ts b/freemocap-ui/src/components/viewport3d/helpers/skeleton-config.ts
index 25b0e6be..67d61fc5 100644
--- a/freemocap-ui/src/components/viewport3d/helpers/skeleton-config.ts
+++ b/freemocap-ui/src/components/viewport3d/helpers/skeleton-config.ts
@@ -162,7 +162,8 @@ export const SEGMENT_DEFINITIONS: Record<string, { proximal: string; distal: str
...FACE_SEGMENTS,
};
-export const MAX_SEGMENTS = Object.keys(SEGMENT_DEFINITIONS).length;
+// Extra capacity for dynamically-generated charuco grid connections
+export const MAX_SEGMENTS = Object.keys(SEGMENT_DEFINITIONS).length + 800;
// Colors in matching order: body+hand first, then face contours
export const SEGMENT_COLORS: Color[] = [...BODY_HAND_COLORS, ...FACE_COLORS];
diff --git a/freemocap-ui/src/components/viewport3d/renderers/ConnectionRenderer.tsx b/freemocap-ui/src/components/viewport3d/renderers/ConnectionRenderer.tsx
index 447c64e1..3ddb4355 100644
--- a/freemocap-ui/src/components/viewport3d/renderers/ConnectionRenderer.tsx
+++ b/freemocap-ui/src/components/viewport3d/renderers/ConnectionRenderer.tsx
@@ -15,6 +15,9 @@ import {
MAX_SEGMENTS,
} from "../helpers/skeleton-config";
import { resolvePoint } from "../helpers/virtual-points";
+import { useAppSelector } from "@/store";
+import { selectCalibrationConfig } from "@/store/slices/calibration/calibration-slice";
+import { SKELETON_COLORS } from "../helpers/skeleton-colors";
const SEGMENT_KEYS = Object.keys(SEGMENT_DEFINITIONS);
@@ -27,6 +30,7 @@ const SEGMENT_KEYS = Object.keys(SEGMENT_DEFINITIONS);
export function ConnectionRenderer() {
const { subscribeToKeypointsRaw } = useServer();
const { statsRef } = useViewportState();
+ const calibrationConfig = useAppSelector(selectCalibrationConfig);
const linesRef = useRef<LineSegments>(null);
const pointsRef = useRef<Map<string, Point3d>>(new Map());
@@ -84,6 +88,55 @@ export function ConnectionRenderer() {
}
}
+ // Charuco grid connections
+ const cols = calibrationConfig.charucoBoard.squares_x - 1;
+ const rows = calibrationConfig.charucoBoard.squares_y - 1;
+ let segIdx = SEGMENT_KEYS.length;
+ const cr = SKELETON_COLORS.charuco.r;
+ const cg = SKELETON_COLORS.charuco.g;
+ const cb = SKELETON_COLORS.charuco.b;
+
+ for (let r = 0; r < rows; r++) {
+ for (let c = 0; c < cols; c++) {
+ const id = r * cols + c;
+ const pt = pts.get(`CharucoCorner-${id}`);
+
+ // Horizontal connection (to right neighbor)
+ if (c < cols - 1) {
+ const right = pts.get(`CharucoCorner-${id + 1}`);
+ const base = segIdx * 6;
+ if (pt && right) {
+ positions[base] = pt.x; positions[base + 1] = pt.y; positions[base + 2] = pt.z;
+ positions[base + 3] = right.x; positions[base + 4] = right.y; positions[base + 5] = right.z;
+ colors[base] = cr; colors[base + 1] = cg; colors[base + 2] = cb;
+ colors[base + 3] = cr; colors[base + 4] = cg; colors[base + 5] = cb;
+ visibleCount++;
+ } else {
+ for (let j = 0; j < 6; j++) positions[base + j] = 1e5;
+ for (let j = 0; j < 6; j++) colors[base + j] = 0;
+ }
+ segIdx++;
+ }
+
+ // Vertical connection (to bottom neighbor)
+ if (r < rows - 1) {
+ const below = pts.get(`CharucoCorner-${id + cols}`);
+ const base = segIdx * 6;
+ if (pt && below) {
+ positions[base] = pt.x; positions[base + 1] = pt.y; positions[base + 2] = pt.z;
+ positions[base + 3] = below.x; positions[base + 4] = below.y; positions[base + 5] = below.z;
+ colors[base] = cr; colors[base + 1] = cg; colors[base + 2] = cb;
+ colors[base + 3] = cr; colors[base + 4] = cg; colors[base + 5] = cb;
+ visibleCount++;
+ } else {
+ for (let j = 0; j < 6; j++) positions[base + j] = 1e5;
+ for (let j = 0; j < 6; j++) colors[base + j] = 0;
+ }
+ segIdx++;
+ }
+ }
+ }
+
geo.attributes.position.needsUpdate = true;
geo.attributes.color.needsUpdate = true;
dirtyRef.current = false;
diff --git a/freemocap-ui/src/components/viewport3d/renderers/KeypointsRenderer.tsx b/freemocap-ui/src/components/viewport3d/renderers/KeypointsRenderer.tsx
index 66593b3d..b84a5790 100644
--- a/freemocap-ui/src/components/viewport3d/renderers/KeypointsRenderer.tsx
+++ b/freemocap-ui/src/components/viewport3d/renderers/KeypointsRenderer.tsx
@@ -40,9 +40,9 @@ function KeypointLayer({ subscribeKey, color, radius, statsKey, colorMode = "uni
const geo = useMemo(() => new SphereGeometry(100, 8, 6), []);
const mat = useMemo(() => new MeshStandardMaterial({
- color: "#ffffff",
- roughness: 0.4,
- metalness: 0.3,
+ color: "#00ff00",
+ // roughness: 0.4,
+ // metalness: 0.3,
}), []);
useEffect(() => {
diff --git a/freemocap-ui/src/hooks/useCalibration.ts b/freemocap-ui/src/hooks/useCalibration.ts
index e0d69987..8c9e6637 100644
--- a/freemocap-ui/src/hooks/useCalibration.ts
+++ b/freemocap-ui/src/hooks/useCalibration.ts
@@ -21,6 +21,7 @@ import {
startCalibrationRecording,
stopCalibrationRecording,
} from "@/store/slices/calibration";
+import {pathRecomputed} from "@/store/slices/recording";
export function useCalibration() {
const dispatch = useAppDispatch();
@@ -70,6 +71,7 @@ export function useCalibration() {
const clearManualRecordingPath = useCallback(() => {
dispatch(manualCalibrationRecordingPathCleared());
dispatch(lastCalibrationRecordingPathCleared());
+ dispatch(pathRecomputed());
}, [dispatch]);
const dispatchStartCalibrationRecording = useCallback(() => {
diff --git a/freemocap-ui/src/hooks/useMocap.ts b/freemocap-ui/src/hooks/useMocap.ts
index 3e56109a..007a93d3 100644
--- a/freemocap-ui/src/hooks/useMocap.ts
+++ b/freemocap-ui/src/hooks/useMocap.ts
@@ -28,6 +28,7 @@ import {
startMocapRecording,
stopMocapRecording,
} from "@/store/slices/mocap";
+import {pathRecomputed} from "@/store/slices/recording";
export function useMocap() {
const dispatch = useAppDispatch();
@@ -128,6 +129,7 @@ export function useMocap() {
const clearManualRecordingPath = useCallback(() => {
dispatch(manualMocapRecordingPathCleared());
dispatch(lastMocapRecordingPathCleared());
+ dispatch(pathRecomputed());
}, [dispatch]);
const dispatchStartMocapRecording = useCallback(() => {
diff --git a/freemocap-ui/src/layout/BasePanelLayout.tsx b/freemocap-ui/src/layout/BasePanelLayout.tsx
index e89773f7..6019d2f0 100644
--- a/freemocap-ui/src/layout/BasePanelLayout.tsx
+++ b/freemocap-ui/src/layout/BasePanelLayout.tsx
@@ -8,7 +8,7 @@ import {Box} from "@mui/material";
import {useMenuActions} from "@/hooks/useMenuActions";
import {useKeyboardShortcuts} from "@/hooks/useKeyboardShortcuts";
import {RecordingCompleteDialog} from "@/components/control-panels/recording-info-panel/RecordingCompleteDialog";
-import {PageTabButtons} from "@/components/ui-components/PageTabButtons";
+import {MainNavTabs} from "@/components/ui-components/MainNavTabs";
export const BasePanelLayout = ({children}: { children?: React.ReactNode }) => {
@@ -75,7 +75,7 @@ export const BasePanelLayout = ({children}: { children?: React.ReactNode }) => {
{/* Main/Central Content Panel */}
<Panel defaultSize={76} minSize={10}>
- <PageTabButtons/>
+ <MainNavTabs/>
{children}
<RecordingCompleteDialog />
</Panel>
diff --git a/freemocap-ui/src/layout/content/BaseContentRouter.tsx b/freemocap-ui/src/layout/content/BaseContentRouter.tsx
index 75f01c22..c511c989 100644
--- a/freemocap-ui/src/layout/content/BaseContentRouter.tsx
+++ b/freemocap-ui/src/layout/content/BaseContentRouter.tsx
@@ -1,15 +1,17 @@
import React from 'react';
import {Navigate, Route, Routes} from 'react-router-dom';
import WelcomePage from "@/pages/WelcomePage";
+import {StreamingViewPage} from "@/pages/StreamingViewPage";
+import PlaybackPage from "@/pages/PlaybackPage";
export const BaseContentRouter: React.FC = () => {
return (
<Routes>
- <Route path="/" element={<WelcomePage/>}/>
- {/* /streaming and /playback are handled by PageTabButtons (keep-mounted tabs) */}
- <Route path="/streaming" element={null}/>
- <Route path="/playback" element={null}/>
- <Route path="*" element={<Navigate to="/" replace/>}/>
+ <Route path="/" element={<Navigate to="/welcome" replace/>}/>
+ <Route path="/welcome" element={<WelcomePage/>}/>
+ <Route path="/streaming" element={<StreamingViewPage/>}/>
+ <Route path="/playback" element={<PlaybackPage/>}/>
+ <Route path="*" element={<Navigate to="/welcome" replace/>}/>
</Routes>
);
};
diff --git a/freemocap-ui/src/layout/content/SidePanelContent.tsx b/freemocap-ui/src/layout/content/SidePanelContent.tsx
index 3a8f661a..eae6324f 100644
--- a/freemocap-ui/src/layout/content/SidePanelContent.tsx
+++ b/freemocap-ui/src/layout/content/SidePanelContent.tsx
@@ -24,7 +24,6 @@ import {
} from '@/components/control-panels/camera-config-panel/camera-config-tree-view/CameraConfigTreeView';
import {RecordingInfoPanel} from "@/components/control-panels/recording-info-panel/RecordingInfoPanel";
import {RealtimePipelinePanel} from "@/components/control-panels/realtime-panel/RealtimePipelinePanel";
-import {PageTabButtons} from "@/components/ui-components/PageTabButtons";
import {MocapPanel} from "@/components/control-panels/mocap-control-panel/MocapPanel";
import {CalibrationPanel} from "@/components/control-panels/calibration-control-panel/CalibrationPanel";
diff --git a/freemocap-ui/src/services/server/ServerContextProvider.tsx b/freemocap-ui/src/services/server/ServerContextProvider.tsx
index 73b9257e..c30a31a9 100644
--- a/freemocap-ui/src/services/server/ServerContextProvider.tsx
+++ b/freemocap-ui/src/services/server/ServerContextProvider.tsx
@@ -18,7 +18,6 @@ import {
} from "@/services/server/server-helpers/websocket-message-types";
import {Point3d, RigidBodyPose} from "@/components/viewport3d";
import {store} from "@/store";
-import {posthocProgressReceived} from "@/store/slices/mocap";
import {pipelineProgressUpdated, PipelinePhase, PipelineType} from "@/store/slices/pipelines";
interface ServerContextValue {
@@ -329,12 +328,6 @@ export const ServerContextProvider: React.FC<{ children: ReactNode }> = ({childr
progress: Math.round(jsonData.progress_fraction * 100),
detail: jsonData.detail,
}));
- // Backward compat with MocapSubsection
- store.dispatch(posthocProgressReceived({
- phase: jsonData.phase,
- progress_fraction: jsonData.progress_fraction,
- detail: jsonData.detail,
- }));
}
} catch (error) {
console.error('Error parsing JSON message:', error);
diff --git a/freemocap-ui/src/store/slices/pipelines/pipelines-slice.ts b/freemocap-ui/src/store/slices/pipelines/pipelines-slice.ts
index bf8a4f3d..c8f6e576 100644
--- a/freemocap-ui/src/store/slices/pipelines/pipelines-slice.ts
+++ b/freemocap-ui/src/store/slices/pipelines/pipelines-slice.ts
@@ -1,4 +1,4 @@
-import {createSlice, PayloadAction} from '@reduxjs/toolkit';
+import {createSelector, createSlice, PayloadAction} from '@reduxjs/toolkit';
import {RootState} from '../../types';
// ==================== Pipeline Types ====================
@@ -34,16 +34,21 @@ export interface PipelineProgress {
phase: PipelinePhase;
progress: number; // 0-100
detail: string;
+ completedAt?: number; // timestamp when completed/failed
}
// ==================== State ====================
interface PipelinesState {
activePipelines: Record<string, PipelineProgress>;
+ showCompleted: boolean;
+ filterText: string;
}
const initialState: PipelinesState = {
activePipelines: {},
+ showCompleted: false,
+ filterText: '',
};
// ==================== Slice ====================
@@ -53,10 +58,18 @@ export const pipelinesSlice = createSlice({
initialState,
reducers: {
pipelineProgressUpdated: (state, action: PayloadAction<PipelineProgress>) => {
- state.activePipelines[action.payload.pipelineId] = action.payload;
+ const incoming = action.payload;
+ const isTerminal = incoming.phase === PipelinePhase.COMPLETE || incoming.phase === PipelinePhase.FAILED;
+ state.activePipelines[incoming.pipelineId] = {
+ ...incoming,
+ completedAt: isTerminal ? Date.now() : undefined,
+ };
},
- pipelineRemoved: (state, action: PayloadAction<string>) => {
- delete state.activePipelines[action.payload];
+ toggleShowCompleted: (state) => {
+ state.showCompleted = !state.showCompleted;
+ },
+ filterTextChanged: (state, action: PayloadAction<string>) => {
+ state.filterText = action.payload;
},
},
});
@@ -64,9 +77,47 @@ export const pipelinesSlice = createSlice({
// ==================== Selectors ====================
export const selectActivePipelines = (state: RootState) => state.pipelines.activePipelines;
+export const selectShowCompleted = (state: RootState) => state.pipelines.showCompleted;
+export const selectFilterText = (state: RootState) => state.pipelines.filterText;
+
+export const selectFilteredPipelines = createSelector(
+ [selectActivePipelines, selectShowCompleted, selectFilterText],
+ (pipelines, showCompleted, filterText) => {
+ const entries = Object.values(pipelines);
+ const needle = filterText.toLowerCase();
+
+ return entries
+ .filter((p) => {
+ const isTerminal = p.phase === PipelinePhase.COMPLETE || p.phase === PipelinePhase.FAILED;
+ if (isTerminal && !showCompleted) return false;
+ if (needle) {
+ return (
+ p.pipelineId.toLowerCase().includes(needle) ||
+ p.pipelineType.toLowerCase().includes(needle) ||
+ p.detail.toLowerCase().includes(needle)
+ );
+ }
+ return true;
+ })
+ .sort((a, b) => {
+ const aTerminal = a.completedAt != null;
+ const bTerminal = b.completedAt != null;
+ if (aTerminal !== bTerminal) return aTerminal ? 1 : -1;
+ if (aTerminal && bTerminal) return (b.completedAt! - a.completedAt!);
+ return 0;
+ });
+ }
+);
+
+export const selectHasCompletedPipelines = createSelector(
+ [selectActivePipelines],
+ (pipelines) => Object.values(pipelines).some(
+ (p) => p.phase === PipelinePhase.COMPLETE || p.phase === PipelinePhase.FAILED
+ )
+);
// ==================== Actions Export ====================
-export const {pipelineProgressUpdated, pipelineRemoved} = pipelinesSlice.actions;
+export const {pipelineProgressUpdated, toggleShowCompleted, filterTextChanged} = pipelinesSlice.actions;
export default pipelinesSlice.reducer;
diff --git a/freemocap/api/websocket/websocket_server.py b/freemocap/api/websocket/websocket_server.py
index 984325c5..db51573a 100644
--- a/freemocap/api/websocket/websocket_server.py
+++ b/freemocap/api/websocket/websocket_server.py
@@ -181,11 +181,13 @@ class WebsocketServer:
framerate_source="Display")
self._display_framerate_trackers[packet.camera_group_id].update(time.perf_counter_ns())
-
- # Send posthoc pipeline progress updates
- for update_message in progress_updates:
- logger.trace(update_message.model_dump_json(indent=2))
- await self.websocket.send_json(update_message.model_dump())
+ if len(progress_updates) > 0:
+ # Send posthoc pipeline progress updates
+ for update_messages in progress_updates:
+ if len(update_messages) > 0:
+ for update_message in update_messages:
+ logger.trace(f"Sending {len(progress_updates)} updates through the websocket ")
+ await self.websocket.send_json(update_message.model_dump())
# Send framerate updates from our local trackers (throttled to ~4Hz)
now = time.monotonic()