-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathPCPlot.py
81 lines (56 loc) · 2.06 KB
/
PCPlot.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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
from myFastPlot import *
import sys,random
from TimeHelper import *
class PCPlot:
def __init__(self, gui):
print("PCPlot")
self.gui = gui
self.th = TimeHelper()
self.maxOnPlot = 30*20
self.dataX = []
self.dataY = []
self.HDGt = []
self.HDGd = []
#self.gui.sen.comCal.addCallBack( self )
self.simHDG = [[],[]]
self.simHDGTarget = [[],[]]
self.simPID = [[],[]]
self.simRud = [[],[]]
self.simError = [[],[]]
for d in range(20):
self.dataX.append(d)
self.dataY.append(random.randrange(0,20))
self.plt = myFastPlot([
#self.data0,
self.dHDG,
self.dSimHDG,
self.dSimHDGTarget,
self.dSimPID,
self.dSimRud,
self.dSimError,
],200)
self.plt.run()
#sys.exit(9)
def update(self, fromWho, vals):
#print("ucbComCal", fromWho,' -> ',vals)
if fromWho == 'comCal':
self.updateComCal(fromWho,vals)
def data0(self):
self.dataY[-1] = random.randrange(0,20)
return self.dataX, self.dataY
def updateComCal(self,fromWho,vals):
if fromWho == 'comCal':
self.HDGt.append( self.th.getTimestamp())
self.HDGd.append(vals[0])
def dHDG(self):
return self.HDGt, self.HDGd
def dSimHDG(self):
return self.simHDG[0][-self.maxOnPlot:],self.simHDG[1][-self.maxOnPlot:]
def dSimHDGTarget(self):
return self.simHDGTarget[0][-self.maxOnPlot:],self.simHDGTarget[1][-self.maxOnPlot:]
def dSimPID(self):
return self.simPID[0][-self.maxOnPlot:],self.simPID[1][-self.maxOnPlot:]
def dSimRud(self):
return self.simRud[0][-self.maxOnPlot:],self.simRud[1][-self.maxOnPlot:]
def dSimError(self):
return self.simError[0][-self.maxOnPlot:],self.simError[1][-self.maxOnPlot:]