-
Notifications
You must be signed in to change notification settings - Fork 0
/
nithFunctions.py
38 lines (34 loc) · 962 Bytes
/
nithFunctions.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
import numpy as np
from udpFunctions import send_generic_udp_message
SENSORNAME = "NITHfaceCam"
SENSORVERSION = "0.1.0"
OPCODE = "OPR"
MOUTH_APERTURE_MAX = str(0.6)
EYES_APERTURE_MAX = str(0.6)
def send_data(pitch, yaw, roll, mouth_aperture, left_eye_aperture, right_eye_aperture):
message = (
"$"
+ SENSORNAME
+ "-"
+ SENSORVERSION
+ "|"
+ OPCODE
+ "|"
+ "head_pos_pitch="
+ str(np.round(pitch, 2))
+ "&head_pos_yaw="
+ str(np.round(yaw, 2))
+ "&head_pos_roll="
+ str(np.round(roll, 2))
+ "&mouth_ape="
+ str(np.round(mouth_aperture, 2))
# + MOUTH_APERTURE_MAX
+ "&eyeLeft_ape="
+ str(np.round(left_eye_aperture, 2))
# + EYES_APERTURE_MAX
+ "&eyeRight_ape="
+ str(np.round(right_eye_aperture, 2))
# + EYES_APERTURE_MAX
+ "$"
)
send_generic_udp_message(message)