From 0ea96e5f51a1248036d902dcd9af2bb8a1eeebcb Mon Sep 17 00:00:00 2001 From: Joe DiPrima Date: Wed, 18 Feb 2026 22:13:58 -0600 Subject: [PATCH] Add VP connection timestamp tracking for LED status indicator Add last_data_time_shared timestamp updated in all three Vuer event handlers (CAMERA_MOVE, HAND_MOVE, CONTROLLER_MOVE). Exposes last_data_time property for the main teleop loop to detect VP connection freshness (connected if data received within 1 second). Co-Authored-By: Claude Opus 4.6 --- src/televuer/televuer.py | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/televuer/televuer.py b/src/televuer/televuer.py index 0f76359..c50906d 100644 --- a/src/televuer/televuer.py +++ b/src/televuer/televuer.py @@ -6,6 +6,7 @@ import asyncio import threading import cv2 import os +import time as _time from pathlib import Path from typing import Literal @@ -138,6 +139,8 @@ class TeleVuer: self.vuer.spawn(start=False)(fn) + self.last_data_time_shared = Value('d', 0.0, lock=True) + self.head_pose_shared = Array('d', 16, lock=True) self.left_arm_pose_shared = Array('d', 16, lock=True) self.right_arm_pose_shared = Array('d', 16, lock=True) @@ -225,6 +228,8 @@ class TeleVuer: try: with self.head_pose_shared.get_lock(): self.head_pose_shared[:] = event.value["camera"]["matrix"] + with self.last_data_time_shared.get_lock(): + self.last_data_time_shared.value = _time.time() except: pass @@ -264,6 +269,8 @@ class TeleVuer: extract_controllers(left_controller, "left") extract_controllers(right_controller, "right") + with self.last_data_time_shared.get_lock(): + self.last_data_time_shared.value = _time.time() except: pass @@ -310,10 +317,12 @@ class TeleVuer: extract_hand_poses(right_hand_data, self.right_arm_pose_shared, self.right_hand_position_shared, self.right_hand_orientation_shared) extract_hands(left_hand, "left") extract_hands(right_hand, "right") + with self.last_data_time_shared.get_lock(): + self.last_data_time_shared.value = _time.time() except: pass - + ## immersive MODE async def main_image_binocular_zmq(self, session): if self.use_hand_tracking: @@ -679,6 +688,12 @@ class TeleVuer: await asyncio.sleep(1.0 / self.display_fps) # ==================== common data ==================== + @property + def last_data_time(self): + """float, timestamp of last VP data received (0.0 = never).""" + with self.last_data_time_shared.get_lock(): + return self.last_data_time_shared.value + @property def head_pose(self): """np.ndarray, shape (4, 4), head SE(3) pose matrix from Vuer (basis OpenXR Convention)."""