@ -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). """