forked from jdibenes/hl2ss
-
Notifications
You must be signed in to change notification settings - Fork 0
/
client_stream_eet.py
58 lines (43 loc) · 1.93 KB
/
client_stream_eet.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#------------------------------------------------------------------------------
# This script receives extended eye tracking data from the HoloLens and prints
# it.
# Press esc to stop.
#------------------------------------------------------------------------------
from pynput import keyboard
import hl2ss
import hl2ss_lnm
# Settings --------------------------------------------------------------------
# HoloLens address
host = '192.169.1.41'
# Target Frame Rate
# Options: 30, 60, 90
fps = 30
#------------------------------------------------------------------------------
enable = True
def on_press(key):
global enable
enable = key != keyboard.Key.esc
return enable
listener = keyboard.Listener(on_press=on_press)
listener.start()
client = hl2ss_lnm.rx_eet(host, hl2ss.StreamPort.EXTENDED_EYE_TRACKER, fps=fps)
client.open()
while (enable):
data = client.get_next_packet()
eet = hl2ss.unpack_eet(data.payload)
# See
# https://learn.microsoft.com/en-us/windows/mixed-reality/develop/native/extended-eye-tracking-native
# for details
print(f'Tracking status at time {data.timestamp}')
print('Pose')
print(data.pose)
print(f'Calibration: Valid={eet.calibration_valid}')
print(f'Combined eye gaze: Valid={eet.combined_ray_valid} Origin={eet.combined_ray.origin} Direction={eet.combined_ray.direction}')
print(f'Left eye gaze: Valid={eet.left_ray_valid} Origin={eet.left_ray.origin} Direction={eet.left_ray.direction}')
print(f'Right eye gaze: Valid={eet.right_ray_valid} Origin={eet.right_ray.origin} Direction={eet.right_ray.direction}')
# "...not supported by HoloLens 2 at this time"
print(f'Left eye openness: Valid={eet.left_openness_valid} Value={eet.left_openness}')
print(f'Right eye openness: Valid={eet.right_openness_valid} Value={eet.right_openness}')
print(f'Vergence distance: Valid={eet.vergence_distance_valid} Value={eet.vergence_distance}')
client.close()
listener.join()