Skip to content

Commit 672068d

Browse files
committed
Merge branch 'feat/real-life-control' of https://github.com/project-neon/NeonFC into feat/real-life-control
2 parents eca480e + 6b9c5ee commit 672068d

File tree

2 files changed

+18
-20
lines changed

2 files changed

+18
-20
lines changed

entities/coach/iron2022.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ def __init__(self, match):
99

1010
# vamos usar strategies de teste por enquanto, essa deixa o robo parado
1111
self._3 = strategy.iron2022.Midfielder(self.match)
12-
self._9 = strategy.iron2022.Attacker_LC(self.match)
13-
self._0 = strategy.iron2022.Goalkeeper(self.match)
12+
self._0 = strategy.iron2022.Attacker_LC(self.match)
13+
self._9 = strategy.iron2022.Goalkeeper(self.match)
1414

1515
def decide(self):
1616
# esta lista eh ordenada em [robot_0, ..., robot_n]

strategy/iron2022/Goalkeeper.py

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ def __init__(self, match):
1111
self.g_left = 0.87
1212
self.g_right = 0.46
1313

14-
self.gk_x = 0.1
14+
self.gk_x = 0.12
1515

1616
def start(self, robot=None):
1717
super().start(robot=robot)
@@ -73,21 +73,21 @@ def get_def_spot(m):
7373
# trava o goleiro na lateral do gol caso a bola esteja no escanteio ou
7474
# acima/abaixo da linha do gol e indo para o escanteio
7575
if (m.ball.y > g_cvr_sup and m.ball.y > ga_hgr) or (m.ball.y > ga_hgr):
76-
y = g_hgr + self.robot_w / 4
76+
y = g_hgr
7777
return (x, y)
7878

7979
elif (m.ball.y < g_cvr_inf and m.ball.y < ga_lwr) or (m.ball.y < ga_lwr):
80-
y = g_lwr - self.robot_w / 4
80+
y = g_lwr
8181
return (x, y)
8282

8383
# bloqueia uma possivel trajetoria da bola se ela esta no meio do campo indo para a lateral
8484
if ga_lwr < m.ball.y < ga_hgr:
8585
y = m.ball.y + m.ball.vy * (16 / self.fps)
8686

8787
if y > g_hgr:
88-
y = g_hgr + self.robot_w / 4
88+
y = g_hgr
8989
elif y < g_lwr:
90-
y = g_lwr - self.robot_w / 4
90+
y = g_lwr
9191

9292
return (x, y)
9393

@@ -142,7 +142,7 @@ def get_def_spot(m):
142142

143143
self.repel = algorithms.fields.LineField(
144144
self.match,
145-
target = (-.03, 0.65),
145+
target = (-.025, 0.65),
146146
theta = math.pi / 2,
147147
line_size = 1.3,
148148
line_dist = 0.07,
@@ -151,18 +151,15 @@ def get_def_spot(m):
151151
multiplier = 1
152152
)
153153

154-
def get_def_pos_denovo(m):
155-
x, y = get_def_spot(m)
156-
print("DEF POS: ", x, y)
157-
return x,y
154+
self.get_pos = get_def_spot
158155

159156
self.pebas.add_field(
160157
algorithms.fields.LineField(
161158
self.match,
162-
target = get_def_pos_denovo,
159+
target = get_def_spot,
163160
theta = 0,
164161
line_size = 1,
165-
line_dist = 0.2,
162+
line_dist = 0.1,
166163
multiplier = .7,
167164
decay = lambda x : x**4
168165
)
@@ -194,15 +191,15 @@ def get_def_pos_denovo(m):
194191
target = lambda m: (self.gk_x, m.ball.y),
195192
radius = 0.1,
196193
decay = lambda x: x**2,
197-
multiplier = 0.8
194+
multiplier = 0.7
198195
)
199196
)
200197

201198
self.recovery.add_field(
202199
algorithms.fields.PointField(
203200
self.match,
204201
target = (self.gk_x, .65),
205-
radius = 0.25,
202+
radius = 0.15,
206203
decay = lambda x: x**3,
207204
multiplier = 0.8
208205
)
@@ -237,10 +234,10 @@ def decide(self):
237234

238235
if not self.g_right < ball.y < self.g_left and ball.x < .15:
239236
behaviour = self.push_ball
240-
elif ball.y > self.g_left:
241-
behaviour = self.left_edge
242-
elif ball.y < self.g_right:
243-
behaviour = self.right_edge
237+
# elif ball.y > self.g_left:
238+
# behaviour = self.left_edge
239+
# elif ball.y < self.g_right:
240+
# behaviour = self.right_edge
244241
else:
245242
behaviour = self.pebas
246243

@@ -250,6 +247,7 @@ def decide(self):
250247
# print(self.robot.y)
251248

252249
# print(self.robot.is_visible())
250+
print(behaviour.name)
253251
return behaviour.compute([self.robot.x, self.robot.y])
254252

255253
# def update(self):

0 commit comments

Comments
 (0)