Skip to content

Commit 0796ae2

Browse files
committed
fix(behavior): do not go to ball when opponent has kickoff
1 parent c979560 commit 0796ae2

5 files changed

Lines changed: 26 additions & 9 deletions

File tree

src/bitbots_behavior/bitbots_body_behavior/bitbots_body_behavior/behavior_dsd/decisions/secondary_state_decider.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,13 @@ def perform(self, reevaluate=False):
7373
else:
7474
if self.blackboard.gamestate.get_secondary_team() == self.team_id:
7575
return "OUR"
76+
# @TODO: handle this better and potentially adapt KickOffTimeUp
77+
elif (
78+
self.blackboard.gamestate.get_secondary_team() == 255
79+
or self.blackboard.gamestate.get_secondary_team() == 0
80+
):
81+
return "NONE"
82+
7683
return "OTHER"
7784

7885
def get_reevaluate(self):

src/bitbots_behavior/bitbots_body_behavior/bitbots_body_behavior/behavior_dsd/main.dsd

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ $AvoidBall
5353
$GoalScoreRecently
5454
YES --> $ConfigRole
5555
GOALIE --> $RobotInOwnPercentOfField + p:40
56-
YES -->@Stand + duration:1.0 + r:false, @PlayAnimationCheering + r:false, @GetWalkready + r:false
56+
YES --> @Stand + duration:1.0 + r:false, @PlayAnimationCheering + r:false, @GetWalkready + r:false
5757
NO --> @ChangeAction + action:positioning, @PlaySound + file:ole.wav, @LookAtFieldFeatures, @Stand + duration:%ready_wait_time, @AvoidBallActive, @GoToRolePosition
5858
ELSE --> @ChangeAction + action:positioning, @PlaySound + file:ole.wav, @LookAtFieldFeatures, @Stand + duration:%ready_wait_time, @AvoidBallActive, @GoToRolePosition
5959
NO --> @ChangeAction + action:positioning, @LookAtFieldFeatures, @Stand + duration:%ready_wait_time, @AvoidBallActive, @GoToRolePosition
@@ -85,15 +85,14 @@ $PassStarted
8585
#PenaltyShootoutBehavior
8686
$SecondaryStateTeamDecider
8787
OUR --> @StandAndWaitRandom + min:10 + max:30, @KickBallDynamic + r:true + type:penalty, @Stand
88-
OTHER --> $BallDangerous + radius:1.3
88+
ELSE --> $BallDangerous + radius:1.3
8989
LEFT --> @PlayAnimationGoalieFallLeft, @Stand
9090
RIGHT --> @PlayAnimationGoalieFallRight, @Stand
9191
CENTER --> @PlayAnimationGoalieFallCenter, @Stand
9292
ELSE --> $BallSeen
9393
YES --> @TrackBall, @Stand
9494
NO --> @LookAtFieldFeatures, @Stand
9595

96-
9796
#Placing
9897
$DoOnce
9998
NOT_DONE --> @ForgetBall, @LookAtFieldFeatures
@@ -102,7 +101,7 @@ $DoOnce
102101
ELSE --> $BallSeen
103102
NO --> $SecondaryStateTeamDecider
104103
OUR --> #SearchBall
105-
OTHER --> @AvoidBallActive, @LookAtFieldFeatures, @WalkInPlace + duration:2, @GoToRelativePosition + x:1 + y:0 + t:0, @Stand
104+
ELSE --> @AvoidBallActive, @LookAtFieldFeatures, @WalkInPlace + duration:2, @GoToRelativePosition + x:1 + y:0 + t:0, @Stand
106105
YES --> $RankToBallNoGoalie
107106
FIRST --> @ChangeAction + action:positioning, @LookAtFieldFeatures, @AvoidBallActive, @GoToDefensePosition + mode:freekick_first
108107
SECOND --> @ChangeAction + action:positioning, @LookAtFieldFeatures, @AvoidBallActive, @GoToDefensePosition + mode:freekick_second
@@ -136,7 +135,7 @@ $SecondaryStateDecider
136135
TIMEOUT --> #StandAndLook
137136
ELSE --> $SecondaryStateTeamDecider
138137
OUR --> #NormalBehavior
139-
OTHER --> #Placing
138+
ELSE --> #Placing
140139
NORMAL --> #NormalBehavior
141140
OVERTIME --> #NormalBehavior
142141

@@ -154,11 +153,14 @@ $IsPenalized
154153
NOT_DONE --> @ChangeAction + action:waiting + r:false, @LookAtFieldFeatures + r:false, @Stand + duration:2
155154
DONE --> #PositioningReady
156155
SET --> $WhistleDetected
157-
DETECTED --> #PlayingBehavior
156+
DETECTED --> $SecondaryStateTeamDecider
157+
OUR --> #PlayingBehavior
158+
OTHER --> #StandAndLook
159+
ELSE --> #PlayingBehavior
158160
NOT_DETECTED --> $SecondaryStateDecider
159161
PENALTYSHOOT --> $SecondaryStateTeamDecider
160162
OUR --> @Stand + duration:0.1 + r:false, @DeactivateHCM + r:false, @LookForward + r:false, @PlayAnimationInitInSim + r:false, @GetWalkready + r:false, @Stand // we need to also see the goalie
161-
OTHER --> $BallSeen
163+
ELSE --> $BallSeen
162164
YES --> @Stand + duration:0.1 + r:false, @DeactivateHCM + r:false, @LookForward + r:false, @PlayAnimationInitInSim + r:false, @GetWalkready + r:false, @TrackBall + r:false, @PlayAnimationGoalieArms + r:false, @Stand // goalie only needs to care about the ball
163165
NO --> @Stand + duration:0.1 + r:false, @DeactivateHCM + r:false, @LookForward + r:false, @PlayAnimationInitInSim + r:false, @GetWalkready + r:false, @LookAtFieldFeatures + r:false, @PlayAnimationGoalieArms + r:false, @Stand
164166
ELSE --> #StandAndLook

src/bitbots_misc/bitbots_bringup/launch/simulator_teamplayer.launch

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0"?>
22
<launch>
3-
<arg name="audio" default="true" description="Whether the audio system should be started" />
3+
<arg name="audio" default="false" description="Whether the audio system should be started" />
44
<arg name="behavior" default="true" description="Whether the behavior control system should be started" />
55
<arg name="behavior_dsd_file" default="main.dsd" description="The behavior dsd file that should be used" />
66
<arg name="game_controller" default="true" description="Whether the Gamecontroller module should be started" />

src/bitbots_navigation/bitbots_localization_handler/bitbots_localization_handler/localization_dsd/decisions/game_state.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,10 +118,18 @@ def perform(self, reevaluate=False):
118118
if game_phase_number == GameState.GAME_PHASE_PENALTY_SHOOT_OUT:
119119
if self.blackboard.gamestate.has_kickoff():
120120
return "OUR"
121+
121122
return "OTHER"
122123
else:
123124
if self.blackboard.gamestate.get_secondary_team() == self.team_id:
124125
return "OUR"
126+
# @TODO: handle this better and potentially adapt KickOffTimeUp
127+
elif (
128+
self.blackboard.gamestate.get_secondary_team() == 255
129+
or self.blackboard.gamestate.get_secondary_team() == 0
130+
):
131+
return "NONE"
132+
125133
return "OTHER"
126134

127135
def get_reevaluate(self):

src/bitbots_navigation/bitbots_localization_handler/bitbots_localization_handler/localization_dsd/localization.dsd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
#InitSet
22
$SecondaryStateDecider
33
PENALTYSHOOT --> $SecondaryStateTeamDecider
4-
OTHER --> @InitGoal, @DoNothing // Init as kicker
54
OUR --> @InitPenaltyKick, @DoNothing // Init as goalie
5+
ELSE --> @InitGoal, @DoNothing // Init as kicker
66
ELSE --> $CheckPickup
77
UP --> @WaitForPickupEnd + r:false, @InitSide, @DoNothing
88
ELSE --> @DoNothing

0 commit comments

Comments
 (0)