Skip to content

Commit bfb9a40

Browse files
authored
Fix opponent back line positioning (#488)
2 parents a984512 + 13a13cb commit bfb9a40

File tree

3 files changed

+16
-4
lines changed

3 files changed

+16
-4
lines changed

bitbots_behavior/bitbots_blackboard/bitbots_blackboard/capsules/costmap_capsule.py

+10-2
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,14 @@ def calc_base_costmap(self):
236236
[
237237
((self.field_length, self.field_width / 2 - self.goal_width / 2), goalpost_value),
238238
((self.field_length, self.field_width / 2 + self.goal_width / 2), goalpost_value),
239+
(
240+
(self.field_length + self.map_margin, self.field_width / 2 - self.goal_width / 2),
241+
corner_value + in_field_value_our_side,
242+
),
243+
(
244+
(self.field_length + self.map_margin, self.field_width / 2 + self.goal_width / 2),
245+
corner_value + in_field_value_our_side,
246+
),
239247
(
240248
(self.field_length, self.field_width / 2 - self.goal_width / 2 + goalpost_safety_distance),
241249
goal_value,
@@ -247,14 +255,14 @@ def calc_base_costmap(self):
247255
(
248256
(
249257
self.field_length + self.map_margin,
250-
self.field_width / 2 - self.goal_width / 2 - goalpost_safety_distance,
258+
self.field_width / 2 - self.goal_width / 2 + goalpost_safety_distance,
251259
),
252260
-0.2,
253261
),
254262
(
255263
(
256264
self.field_length + self.map_margin,
257-
self.field_width / 2 + self.goal_width / 2 + goalpost_safety_distance,
265+
self.field_width / 2 + self.goal_width / 2 - goalpost_safety_distance,
258266
),
259267
-0.2,
260268
),

bitbots_behavior/bitbots_blackboard/bitbots_blackboard/capsules/pathfinding_capsule.py

+4
Original file line numberDiff line numberDiff line change
@@ -165,8 +165,12 @@ def get_ball_goal(self, target: BallGoalType, distance: float) -> PoseStamped:
165165

166166
ball_x, ball_y = self._blackboard.world_model.get_ball_position_xy()
167167

168+
# Play in any part of the opponents goal, not just the center
168169
if abs(ball_y) < self._blackboard.world_model.goal_width / 2:
169170
goal_angle = 0
171+
# Play in the opposite direction if the ball is near the opponent goal backline
172+
elif ball_x > self._blackboard.world_model.field_length / 2 - 0.2:
173+
goal_angle = math.pi + np.copysign(math.pi / 4, ball_y)
170174

171175
goal_x = ball_x - math.cos(goal_angle) * distance
172176
goal_y = ball_y - math.sin(goal_angle) * distance

bitbots_behavior/bitbots_body_behavior/config/body_behavior.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@
195195
##################
196196

197197
# sigma of gaussian blur applied to costmap
198-
base_costmap_smoothing_sigma: 0.3
198+
base_costmap_smoothing_sigma: 1.0
199199

200200
# margin that is added around the field size when creating the costmap (meters)
201201
map_margin: 1.0
@@ -207,7 +207,7 @@
207207
goal_value: 0.0
208208

209209
# cost at a goalpost
210-
goalpost_value: 1.0
210+
goalpost_value: 0.5
211211

212212
# cost in a corner
213213
corner_value: 1.0

0 commit comments

Comments
 (0)