-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmodels.py
More file actions
177 lines (147 loc) · 4.76 KB
/
models.py
File metadata and controls
177 lines (147 loc) · 4.76 KB
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
from pydantic import BaseModel
from datetime import datetime
from enum import Enum, IntEnum
class ClimbEnum:
SUCCESS = 'Success'
SUCCESSPARTNER = 'Success with Partner'
FAILED = 'Failed'
NOTRY = 'NoTry'
@classmethod
def options(cls):
return [ClimbEnum.SUCCESS,ClimbEnum.SUCCESSPARTNER,ClimbEnum.FAILED,ClimbEnum.NOTRY]
class PickupEnum:
GROUND = 'Ground'
SOURCE = 'Source'
BOTH = 'Both'
NONE = 'None'
@classmethod
def options(cls):
return [PickupEnum.GROUND,PickupEnum.SOURCE,PickupEnum.BOTH,PickupEnum.NONE]
class DriveEnum:
SWERVE = 'Swerve'
MECANUM = 'Mecanum'
TANK = 'Tank'
OTHER = 'Other'
@classmethod
def options(cls):
return [DriveEnum.SWERVE,DriveEnum.MECANUM,DriveEnum.TANK,DriveEnum.OTHER]
class CanClimbEnum:
YES = 'Yes'
YESPARTNER = 'Yes with a Partner'
NO = 'No'
@classmethod
def options(cls):
return [CanClimbEnum.YES,CanClimbEnum.YESPARTNER,CanClimbEnum.NO]
class StartLocEnum:
AMP = 'Amp side'
MIDDLE = 'Middle'
LANE = 'Lane side'
@classmethod
def options(cls):
return [StartLocEnum.AMP, StartLocEnum.MIDDLE, StartLocEnum.LANE]
class ShotLocEnum:
SUBWOOFER = 'Subwoofer'
PODIUM = 'Podium'
MIDDLE = 'Middle'
MIDFIELD = 'Midfield'
AMP = 'Amp'
@classmethod
def options(cls):
return [ShotLocEnum.SUBWOOFER,ShotLocEnum.PODIUM,ShotLocEnum.MIDDLE,ShotLocEnum.MIDFIELD,ShotLocEnum.AMP]
class Matches:
@staticmethod
def make_matches():
matches = []
for i in range(1,101):
matches.append('Q'+str(i))
for i in range(1,14):
matches.append('P'+str(i))
for i in range(1,4):
matches.append('F'+str(i))
return matches
class ScoutingRecord(BaseModel):
tstamp: str = datetime.now().isoformat()
team_number: int = 0
match_number: str = ''
scouter_name: str = ''
#auto scoring
amp_completed_auto: int = 0
amp_attempted_auto: int = 0
speaker_subwoofer_completed_auto: int = 0
speaker_subwoofer_attempted_auto: int = 0
speaker_podium_completed_auto: int = 0
speaker_podium_attempted_auto: int = 0
speaker_medium_completed_auto: int = 0
speaker_medium_attempted_auto: int = 0
#teleop scoring
amp_completed_teleop: int = 0
amp_attempted_teleop: int = 0
speaker_subwoofer_completed_teleop: int = 0
speaker_subwoofer_attempted_teleop: int = 0
speaker_podium_completed_teleop: int = 0
speaker_podium_attempted_teleop: int = 0
speaker_medium_completed_teleop: int = 0
speaker_medium_attempted_teleop: int = 0
#other
robot_disabled_time: int = 0
robot_speed: float = 0.0
robot_pickup: str = PickupEnum.SOURCE
climb: str = ClimbEnum.NOTRY
team_present: bool = False
mobility: bool = False
alliance_coop: bool = False
park: bool = False
high_note: bool = False
trap: bool = False
mobility: bool = False
rps: int = 0
fouls: int = 0
defense_rating: int = 0
defense_forced_penalties: int = 0
strategy: str = '' #did they employ a strategy that might exaggerate their stats
notes: str = ''
def calc_fields(self):
pass
def as_tuple(self):
m = self.model_dump()
#print("model before export",m)
return list(m.values())
@staticmethod
def snake_column_headers():
return ScoutingRecord.model_fields.keys()
@staticmethod
def dot_column_headers():
return [ f.replace('_','.') for f in ScoutingRecord.snake_column_headers() ]
class PitScoutingRecord(BaseModel):
tstamp: str = datetime.now().isoformat()
team_number: int = 0
scouter_name: str = ''
event_name: str = ''
robot_weight: float = 0.0
robot_width: float = 0.0
robot_length: float = 0.0
robot_height: float= 0.0
under_stage: bool = False
robot_drive: str = DriveEnum.TANK
climb: str = CanClimbEnum.NO
trap: bool = False
pref_start: str = StartLocEnum.MIDDLE
robot_pickup: str = PickupEnum.NONE
score_abilities: str = ShotLocEnum.SUBWOOFER
pref_shoot: str = ShotLocEnum.SUBWOOFER
autos: str = ''
strategy: str = '' #did they employ a strategy that might exaggerate their stats
notes: str = ''
def as_tuple(self):
return list(self.model_dump().values())
def calc_fields(self):
self.pref_start = str(self.pref_start)
self.robot_pickup = str(self.robot_pickup)
self.pref_shoot = str(self.pref_shoot)
self.score_abilities = str( self.score_abilities)
@staticmethod
def snake_column_headers():
return PitScoutingRecord.model_fields.keys()
@staticmethod
def dot_column_headers():
return [ f.replace('_','.') for f in PitScoutingRecord.snake_column_headers() ]