-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathdump.py
More file actions
30 lines (20 loc) · 663 Bytes
/
dump.py
File metadata and controls
30 lines (20 loc) · 663 Bytes
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
# coding: utf-8
"""Connect to a NatNet packet and dump the first mocap frame to disk.
This requires NatNetClient.py from the NatNet SDK, which I'm not distributing for legal reasons.
"""
import NatNetClient
def main():
client = NatNetClient.NatNetClient()
# Create socket
data_socket = client._create_data_socket(client.data_port)
if data_socket is None:
print('Could not open data channel')
return
# Get one packet
print('Waiting for data...')
data, addr = data_socket.recvfrom(32768)
if len(data) > 0:
open('packet.bin', 'wb').write(data)
print('Done')
if __name__ == '__main__':
main()