Skip to content

Commit 089be79

Browse files
committed
Add ball search that first goes to the other half and then at the middle T crossing if the initial search was unsuccessfull
1 parent 02ebb2a commit 089be79

File tree

2 files changed

+29
-3
lines changed
  • bitbots_behavior/bitbots_body_behavior/bitbots_body_behavior/behavior_dsd

2 files changed

+29
-3
lines changed

bitbots_behavior/bitbots_body_behavior/bitbots_body_behavior/behavior_dsd/actions/go_to.py

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ def __init__(self, blackboard, dsd, parameters):
5656
"""Go to an absolute position on the field"""
5757
super().__init__(blackboard, dsd, parameters)
5858
self.point = float(parameters.get("x", 0)), float(parameters.get("y", 0)), float(parameters.get("t", 0))
59+
self.blocking = parameters.get("blocking", True)
5960

6061
def perform(self, reevaluate=False):
6162
pose_msg = PoseStamped()
@@ -69,6 +70,21 @@ def perform(self, reevaluate=False):
6970

7071
self.blackboard.pathfinding.publish(pose_msg)
7172

73+
if not self.blocking:
74+
self.pop()
75+
76+
77+
class GoToAbsolutePositionFieldFraction(GoToAbsolutePosition):
78+
def __init__(self, blackboard, dsd, parameters):
79+
"""Go to the own goal"""
80+
super().__init__(blackboard, dsd, parameters)
81+
point = float(parameters.get("x", 0)), float(parameters.get("y", 0)), float(parameters.get("t", 0))
82+
self.point = (
83+
point[0] * self.blackboard.world_model.field_length,
84+
point[1] * self.blackboard.world_model.field_width,
85+
self.point[2],
86+
)
87+
7288

7389
class GoToOwnGoal(GoToAbsolutePosition):
7490
def __init__(self, blackboard, dsd, parameters):
@@ -77,7 +93,7 @@ def __init__(self, blackboard, dsd, parameters):
7793
self.point = (
7894
self.blackboard.world_model.get_map_based_own_goal_center_xy()[0],
7995
self.blackboard.world_model.get_map_based_own_goal_center_xy()[1],
80-
parameters,
96+
self.point[2],
8197
)
8298

8399

@@ -88,7 +104,7 @@ def __init__(self, blackboard, dsd, parameters):
88104
self.point = (
89105
self.blackboard.world_model.get_map_based_opp_goal_center_xy()[0],
90106
self.blackboard.world_model.get_map_based_opp_goal_center_xy()[1],
91-
parameters,
107+
self.point[2],
92108
)
93109

94110

bitbots_behavior/bitbots_body_behavior/bitbots_body_behavior/behavior_dsd/main.dsd

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
#SearchBall
2-
@ChangeAction + action:searching, @LookAtFieldFeatures, @WalkInPlace + duration:3, @Turn
2+
$DoOnce
3+
NOT_DONE --> @ChangeAction + action:searching, @LookAtFieldFeatures, @WalkInPlace + duration:3, @Turn + duration:15, @GoToAbsolutePositionFieldFraction + x:0.5 + blocking:false
4+
DONE --> $ReachedAndAlignedToPathPlanningGoalPosition + threshold:0.5 + latch:true
5+
NO --> @LookAtFieldFeatures, @GoToAbsolutePositionFieldFraction + x:0.5
6+
YES --> $DoOnce
7+
NOT_DONE --> @Turn + duration:5
8+
DONE --> $DoOnce
9+
NOT_DONE --> @GoToAbsolutePositionFieldFraction + y:1.0 + t:-90 + blocking:false
10+
DONE --> $ReachedAndAlignedToPathPlanningGoalPosition + threshold:0.2 + latch:true
11+
YES --> @Stand
12+
NO --> @GoToAbsolutePositionFieldFraction + y:1.0 + t:-90
313

414
#DoNothing
515
@ChangeAction + action:waiting, @LookForward, @Stand

0 commit comments

Comments
 (0)