Skip to content

Commit 5e9653a

Browse files
committed
Version with init
1 parent a3faf12 commit 5e9653a

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

bitbots_behavior/bitbots_body_behavior/bitbots_body_behavior/behavior_dsd/actions/go_to_ball.py

+5-3
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,13 @@ def __init__(self, blackboard, dsd, parameters):
2424
self.blocking = parameters.get("blocking", True)
2525
self.distance = parameters.get("distance", self.blackboard.config["ball_approach_dist"])
2626
# Offset so we kick the ball with one foot instead of the center between the feet
27-
self.side_offset = parameters.get("side_offset", 0.08)
27+
self.side_offset = parameters.get("side_offset", 0.00)
28+
29+
2830

2931
def perform(self, reevaluate=False):
30-
ball_position_y_relative = self.blackboard.world_model.get_ball_position_uv[1]
31-
self.side_offset = -1 * math.copysign(self.side_offset, ball_position_y_relative)
32+
ball_position_y_relative = self.blackboard.world_model.get_ball_position_uv()[1]
33+
self.side_offset = math.copysign(self.side_offset, ball_position_y_relative)
3234
pose_msg = self.blackboard.pathfinding.get_ball_goal(self.target, self.distance, self.side_offset)
3335
self.blackboard.pathfinding.publish(pose_msg)
3436

bitbots_behavior/bitbots_body_behavior/bitbots_body_behavior/behavior_dsd/main.dsd

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ $AvoidBall
4444
LEFT --> #PerformKickLeft
4545
RIGHT --> #PerformKickRight
4646
FAR --> @ChangeAction + action:going_to_ball, @LookAtFieldFeatures, @GoToBall + target:map
47-
NO --> @ChangeAction + action:going_to_ball + r:false, @LookAtFieldFeatures + r:false, @AvoidBallActive + r:false, @GoToBall + target:map + blocking:false + distance:%ball_far_approach_dist
47+
NO --> @ChangeAction + action:going_to_ball + r:false, @LookAtFieldFeatures + r:false, @AvoidBallActive + r:false, @GoToBall + target:map + blocking:false + distance:%ball_far_approach_dist + side_offset:0.08
4848
YES --> $ReachedPathPlanningGoalPosition + threshold:%ball_far_approach_position_thresh
4949
YES --> @AvoidBallInactive
5050
NO --> @ChangeAction + action:going_to_ball, @LookAtFieldFeatures, @GoToBall + target:map + distance:%ball_far_approach_dist

0 commit comments

Comments
 (0)