-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.py
executable file
·224 lines (184 loc) · 5.05 KB
/
config.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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
import thunder_grader
from tkinter import simpledialog
import tkinter as tk
# GRID SIZE CONSTANTS- GRID SIZE IS (rows, columns), DIMENSIONS IS (width, height).
# TWEAK DIMENSIONS TO ROUGHLY ASPECT RATIO OF BUBBLE AREA, BIGGER IS MORE ACCURATE AND SLOWER
matchString = "DEFAULT"
match_filename = "data_match.csv"
cycle_filename = "data_cycle.csv"
leftBoxDimensions = (203,260)
leftBoxGrid = (15, 8)
leftThresh = 0.8
rightBoxDimensions = (100,350)
rightBoxGrid = (15, 3)
rightThresh = 0.9
# THE REST ARE FOR PARSING THE BUBBLES.
validBubblesLeft = [
[0,1,1,1,1,0,0,0],
[0,1,1,1,1,0,0,0],
[0,1,1,1,1,0,0,0],
[0,1,1,1,1,0,0,0],
[0,1,1,1,1,0,0,0],
[0,1,1,1,1,0,0,0],
[0,1,1,1,1,1,1,1],
[0,1,1,1,1,1,1,1],
[0,0,0,0,0,0,0,0],
[0,1,1,1,1,0,0,0],
[0,1,1,1,0,0,1,1],
[0,1,1,1,0,0,1,1],
[0,1,1,1,0,0,0,1],
[0,1,1,1,0,0,0,1],
[0,1,1,1,1,0,0,1],
]
validBubblesRight = [
[0,0,0],
[1,1,1],
[1,1,1],
[0,0,0],
[0,0,0],
[0,0,0],
[1,1,1],
[0,0,0],
[1,1,1],
[1,1,1],
[0,0,0],
[0,0,1],
[0,0,1],
[0,0,1],
[0,0,0]
]
scoutIDTable = {
1: "Julia S",
10: "Nick",
11: "Jonah",
100: "Noah",
101: "Jazmyne",
110: "Devon",
111: "Aidan",
1000: "Parker",
1001: "Gavyn",
1010: "Isaac",
1011: "Hagan",
1100: "Gabby",
1101: "Owen",
1110: "Julia D",
1111: "Vanessa",
10000: "Sam",
10001: "Helen",
10010: "Wes",
10011: "Andrew",
10100: "Simon",
10101: "Cameron",
10110: "Gabe",
10111: "Alex",
11000: "Emma",
11001: "Thomas",
11010: "Grady",
}
teamIDTable = {
1: 60,
10: 118,
11: 498,
100: 670,
101: 687,
110: 842,
111: 991,
1000: 996,
1001: 1011,
1010: 1138,
1011: 1165,
1100: 1339,
1101: 1622,
1110: 1726,
1111: 1828,
10000: 1891,
10001: 2240,
10010: 2403,
10011: 2478,
10100: 2486,
10101: 2840,
10110: 3009,
10111: 3019,
11000: 3133,
11001: 3187,
11010: 3230,
11011: 3577,
11100: 3853,
11101: 4063,
11110: 4146,
11111: 4183,
100000: 4565,
100001: 5059,
100010: 5133,
100011: 5429,
100100: 5493,
100101: 5496,
100110: 5539,
100111: 5678,
101000: 6127,
101001: 6413,
101010: 6474,
101011: 6546,
101100: 6656,
101101: 6674,
101110: 6821,
101111: 6824,
110000: 6871,
110001: 6922,
110010: 7214,
110011: 7424,
110100: 7426,
}
main = tk.Tk()
def switchMatch():
global matchString
matchString = simpledialog.askstring("Input", "Enter Match String:", parent=main)
print("New match descriptor: " + str(matchString))
def processMatchScout(bubbles):
#METADATA
scoutID = thunder_grader.boolArrToBinary(bubbles[1][1:3])
scoutName = str(scoutID)
if scoutID in scoutIDTable:
scoutName = scoutIDTable[scoutID]
teamID = thunder_grader.boolArrToBinary(bubbles[1][8:10])
teamName = str(teamID)
if teamID in teamIDTable:
teamName = teamIDTable[teamID]
#START
startingPos = ("3" if bubbles[0][12][7] else "") + ("2" if bubbles[0][13][7] else "") + ("1" if bubbles[0][14][7] else "")
print(bubbles[0][12][7:8])
botConfig = ("CARGO" if bubbles[0][10][6] else "") + ("HATCH" if bubbles[0][11][6] else "")
fieldConfig = ("CARGO" if bubbles[0][10][7] else "") + ("HATCH" if bubbles[0][11][7] else "")
#AUTONOMOUS
autoRocketCargo = bubbles[0][10][1:4]
autoRocketHatch = bubbles[0][11][1:4]
autoCBCargo = bubbles[0][12][1:4]
autoCBHatch = bubbles[0][13][1:4]
#TELEOP
teleopRRocketL3 = bubbles[0][0][1:5]
tRRL3C = sum(teleopRRocketL3[1:3])
tRRL3H = teleopRRocketL3[0] + teleopRRocketL3[3]
teleopRRocketL2 = bubbles[0][1][1:5]
tRRL2C = sum(teleopRRocketL2[1:3])
tRRL2H = teleopRRocketL2[0] + teleopRRocketL2[3]
teleopRRocketL1 = bubbles[0][2][1:5]
tRRL1C = sum(teleopRRocketL1[1:3])
tRRL1H = teleopRRocketL1[0] + teleopRRocketL1[3]
teleopLRocketL3 = bubbles[0][3][1:5]
tLRL3C = sum(teleopLRocketL3[1:3])
tLRL3H = teleopLRocketL3[0] + teleopLRocketL3[3]
teleopLRocketL2 = bubbles[0][4][1:5]
tLRL2C = sum(teleopLRocketL2[1:3])
tLRL2H = teleopLRocketL2[0] + teleopLRocketL2[3]
teleopLRocketL1 = bubbles[0][5][1:5]
tLRL1C = sum(teleopLRocketL1[1:3])
tLRL1H = teleopLRocketL1[0] + teleopLRocketL1[3]
fouls = bubbles[0][14][1:5]
comms = ("Lost" if bubbles[1][11][2] else "") + ("Recovered" if bubbles[1][12][2] else "") + ("Lost" if bubbles[1][13][2] else "")
# SCOUT,TEAM,MATCH,STARTING POS,BOT CONFIG,FIELD CONFIG,STORM ROCKET CARGO,STORM ROCKET HATCH,STORM CB CARGO,STORM CB HATCH,RIGHT ROCKET L3 C,RIGHT ROCKET L3 H,RIGHT ROCKET L2 C,RIGHT ROCKET L2 H,RIGHT ROCKET L1 C,RIGHT ROCKET L2 H,RIGHT ROCKET L1 C,RIGHT ROCKET L1 H,LEFT ROCKET L3 C,LEFT ROCKET L3 H,LEFT ROCKET L2 C,LEFT ROCKET L2 H,LEFT ROCKET L1 C,LEFT ROCKET L2 H,LEFT ROCKET L1 C,LEFT ROCKET L1 H,FOULS
data = [scoutName, teamName, matchString, startingPos, botConfig, fieldConfig, comms, autoRocketCargo, autoRocketHatch, autoCBCargo, autoCBHatch, tRRL3C, tRRL3H, tRRL2C, tRRL2H, tRRL1C, tRRL1H, tLRL3C, tLRL3H, tLRL2C, tLRL2H, tLRL1C, tLRL1H, fouls]
return (data, match_filename)
def processCycles(codes):
print(str(codes[0].data).split("'")[1])
data = list(x.split("/") for x in str(codes[0].data).split("'")[1].split("*"))
return (data, cycle_filename)