-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTestServer
executable file
·56 lines (44 loc) · 1.47 KB
/
TestServer
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
#!/usr/bin/env python3
import time
import argparse
from Togetic.Server import Handler
from Togetic.Server import Listener
value = 0
def PositionServer(path):
class _PositionServer(Handler):
def __init__(self, client):
Handler.__init__(self, client)
self._time = 0
self._dt = 0.01
def _msgToSend(self):
data_int = path(self._time)
data = 'T ' + ' '.join(map(str, data_int))
print(data)
return data + '\n'
def _parseRecv(self, data):
pass
def _run(self):
time.sleep(self._dt)
self._time += self._dt
return _PositionServer
def dummyPath(t):
import math
# Avant blender
# return (time.time(), 0 * -10 * math.cos(t), 0 * -10 * math.sin(t), 0, 0 * math.sin(t), (int(time.time()) % 10) / 10 * 2 * math.pi, 0 * (math.cos(t) + math.sin(t)) / 2.0)
# Avant le filtre
return (time.time(), 0, 0, 0, 0, value * 2 - 1, 0, 0, 0, 0)
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument('--output', required=True, metavar='output', type=str,
help='Filename of the socket to write in')
parsed_args = parser.parse_args()
addr = parsed_args.output
listener = Listener(addr, PositionServer(dummyPath))
try:
listener.start()
while True:
input()
value = 1 - value
pass
except KeyboardInterrupt:
listener.stop()