diff --git a/tracker/tracker.py b/tracker/tracker.py index 630d470..7989a68 100644 --- a/tracker/tracker.py +++ b/tracker/tracker.py @@ -154,13 +154,24 @@ class Tracker: self._hold_remaining -= 1 return pose, frame - def run(self, max_frames: Optional[int] = None, max_seconds: Optional[float] = None) -> int: + def run( + self, + max_frames: Optional[int] = None, + max_seconds: Optional[float] = None, + status_interval: Optional[float] = 2.0, + ) -> int: + # The tracker has no GUI (that only exists in the Windows-only + # tracker-native/) and otherwise produces zero output, so a working run + # looks identical to a silently stuck one. Print a status line every + # status_interval seconds (None disables it, e.g. for tests) so a + # terminal run shows live confirmation instead of nothing. self._worker = threading.Thread(target=self._inference_worker, name="inference", daemon=True) self._worker.start() period = 1.0 / self.target_fps start = time.monotonic() published = 0 + last_status = start while not self._stop.is_set(): deadline = start + published * period now = time.monotonic() @@ -174,6 +185,17 @@ class Tracker: self.control.send_heartbeat(seq) published += 1 + now = time.monotonic() + if status_interval is not None and now - last_status >= status_interval: + elapsed = now - start + fps = published / elapsed if elapsed > 0 else 0.0 + print( + f"[tracker] frame={published} fps={fps:.1f} " + f"player={'tracked' if pose is not None else 'lost'} seq={seq}", + flush=True, + ) + last_status = now + if max_frames is not None and published >= max_frames: break if max_seconds is not None and (time.monotonic() - start) >= max_seconds: @@ -237,11 +259,22 @@ def main(argv: Optional[list[str]] = None) -> int: print(f"{tier}: {fps:.1f} fps") return 0 + # No GUI on this path (camera picker / live preview only exist in the + # Windows-only tracker-native/); print confirmation so a terminal run + # shows the camera actually opened instead of silently doing nothing. + print(f"[tracker] opening camera source={args.source!r} ...", flush=True) source = CvFrameSource(args.source) + print(f"[tracker] camera opened; loading pose model (tier/path={args.model!r}) ...", flush=True) provider = MediaPipePoseProvider(model=args.model, models_dir=args.models_dir) publisher = FrameContractPublisher( depth_size=args.depth_size, color_size=args.color_size, name=args.shm_name ) + print( + f"[tracker] publishing to shared memory '{args.shm_name}' " + f"({args.depth_size[0]}x{args.depth_size[1]} depth, " + f"{args.color_size[0]}x{args.color_size[1]} color) at {args.target_fps} fps target", + flush=True, + ) control = None if args.control_socket: control = ControlPlaneServer(args.control_socket)