-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain_lab.py
56 lines (40 loc) · 1.36 KB
/
main_lab.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
import api
import comm
import vision
import match
import argparse
import fields as pitch
from commons.utils import get_config
parser = argparse.ArgumentParser(description='NeonFC')
parser.add_argument('--config_file', default='config_lab.json')
args = parser.parse_args()
class Game():
def __init__(self, config_file=None):
self.config = get_config(config_file)
self.match = match.LabMatch(self,
**self.config.get('match')
)
self.vision = vision.FiraVision()
self.comm = comm.FiraFullComm()
self.field = pitch.Field(self.match.category)
api_address = self.config.get("network").get("api_address")
api_port = self.config.get("network").get("api_port")
self.api = api.Api(api_address, api_port)
self.use_referee = False
self.start()
def start(self):
self.vision.assign_vision(self)
self.vision.start()
self.comm.start()
self.api.start()
self.match.start()
def update(self):
frame = vision.assign_empty_values(
self.vision.frame,
field_size=self.field.get_dimensions(),
team_side=self.match.team_side
)
self.match.update(frame)
commands = self.match.decide()
self.comm.send(commands)
g = Game(config_file=args.config_file)