Skip to content

Commit 240b86a

Browse files
committed
Fix map angle at opponent back line (e.g. for corner kicks)
1 parent d0a6940 commit 240b86a

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

bitbots_behavior/bitbots_blackboard/bitbots_blackboard/capsules/pathfinding_capsule.py

Lines changed: 4 additions & 0 deletions
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

0 commit comments

Comments
 (0)