-
Notifications
You must be signed in to change notification settings - Fork 22
team_com disallowed robots to send messages if not intended, and reduces the rate if we get close to the budget end #870
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
3b16541
614b005
ccdafa8
db26bed
32c7f1d
793f1cd
0c0e384
dc7af9b
962273e
6071a91
0b5294e
b90edc8
0eccd8d
c1b6f50
b3249a0
ffe7dd3
bfbf088
632363c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,65 @@ | ||
| from bitbots_blackboard.body_blackboard import BodyBlackboard | ||
| from dynamic_stack_decider.abstract_decision_element import AbstractDecisionElement | ||
|
|
||
|
|
||
| class NumberPenalizedTeamMates(AbstractDecisionElement): | ||
| blackboard: BodyBlackboard | ||
|
|
||
| def __init__(self, blackboard, dsd, parameters): | ||
| super().__init__(blackboard, dsd, parameters) | ||
|
|
||
| def perform(self, reevaluate=False): | ||
| """ | ||
| Return number of penalized team mates | ||
| :param reevaluate: | ||
| :return: | ||
| """ | ||
| game_state_penalized_team_mates = self.blackboard.gamestate.get_penalized_team_mates() | ||
|
|
||
| if game_state_penalized_team_mates == 4: | ||
| return "FOUR" | ||
| elif game_state_penalized_team_mates == 3: | ||
| return "THREE" | ||
| elif game_state_penalized_team_mates == 2: | ||
| return "TWO" | ||
| elif game_state_penalized_team_mates == 1: | ||
| return "ONE" | ||
| else: | ||
| return "ZERO" | ||
|
|
||
| def get_reevaluate(self): | ||
| """ | ||
| Game state can change during the game | ||
| """ | ||
| return True | ||
|
|
||
| class NumberPenalizedRivals(AbstractDecisionElement): | ||
| blackboard: BodyBlackboard | ||
|
|
||
| def __init__(self, blackboard, dsd, parameters): | ||
| super().__init__(blackboard, dsd, parameters) | ||
|
|
||
| def perform(self, reevaluate=False): | ||
| """ | ||
| Return number of penalized rivals | ||
| :param reevaluate: | ||
| :return: | ||
| """ | ||
| game_state_penalized_rivals = self.blackboard.gamestate.get_penalized_rivals() | ||
|
|
||
| if game_state_penalized_rivals == 4: | ||
| return "FOUR" | ||
| elif game_state_penalized_rivals == 3: | ||
| return "THREE" | ||
| elif game_state_penalized_rivals == 2: | ||
| return "TWO" | ||
| elif game_state_penalized_rivals == 1: | ||
| return "ONE" | ||
| else: | ||
| return "ZERO" | ||
|
|
||
| def get_reevaluate(self): | ||
| """ | ||
| Game state can change during the game | ||
| """ | ||
| return True |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| from bitbots_blackboard.body_blackboard import BodyBlackboard | ||
| from dynamic_stack_decider.abstract_decision_element import AbstractDecisionElement | ||
|
|
||
|
|
||
| class TeamComLimitReached(AbstractDecisionElement): | ||
| blackboard: BodyBlackboard | ||
|
|
||
| def __init__(self, blackboard, dsd, parameters): | ||
| super().__init__(blackboard, dsd, parameters) | ||
|
|
||
| def perform(self, reevaluate=False): | ||
| if self.blackboard.gamestate.get_team_com_limit_has_reached(): | ||
| return "YES" | ||
| else: | ||
| return "NO" | ||
|
|
||
| def get_reevaluate(self): | ||
| return True |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -76,11 +76,13 @@ $GoalieActive | |
| NO --> @LookAtFieldFeatures, @ChangeAction + action:positioning, @GoToBlockPosition | ||
|
|
||
| #SupporterRole | ||
| $PassStarted | ||
| YES --> $BallSeen | ||
| YES --> @TrackBall, @ChangeAction + action:positioning, @AvoidBallActive, @GoToPassAcceptPosition | ||
| NO --> @LookAtFieldFeatures, @ChangeAction + action:positioning, @AvoidBallActive, @GoToPassAcceptPosition | ||
| NO --> @LookAtFieldFeatures, @ChangeAction + action:positioning, @AvoidBallActive, @GoToPassPreparePosition | ||
| $TeamComLimitReached | ||
| YES --> @LookAtFieldFeatures, @ChangeAction + action:positioning, @AvoidBallActive, @GoToPassPreparePosition | ||
| NO --> $PassStarted | ||
| YES --> $BallSeen | ||
| YES --> @TrackBall, @ChangeAction + action:positioning, @AvoidBallActive, @GoToPassAcceptPosition | ||
| NO --> @LookAtFieldFeatures, @ChangeAction + action:positioning, @AvoidBallActive, @GoToPassAcceptPosition | ||
| NO --> @LookAtFieldFeatures, @ChangeAction + action:positioning, @AvoidBallActive, @GoToPassPreparePosition | ||
|
|
||
| #PenaltyShootoutBehavior | ||
| $SecondaryStateTeamDecider | ||
|
|
@@ -120,14 +122,23 @@ $BallSeen | |
| NO_FREEKICK --> #Placing | ||
| YES --> $ConfigRole | ||
| GOALIE --> #GoalieBehavior | ||
| ELSE --> $CountActiveRobotsWithoutGoalie | ||
| ONE --> $RankToBallNoGoalie | ||
| FIRST --> #StrikerRole | ||
| SECOND --> #DefensePositioning | ||
| ELSE --> $RankToBallNoGoalie | ||
| FIRST --> #StrikerRole | ||
| SECOND --> #SupporterRole | ||
| THIRD --> #DefensePositioning | ||
| ELSE --> $TeamComLimitReached //this decision is only for better visualization in rqt | ||
| NO --> $CountActiveRobotsWithoutGoalie | ||
| ONE --> $RankToBallNoGoalie | ||
| FIRST --> #StrikerRole | ||
| SECOND --> #DefensePositioning | ||
| ELSE --> $RankToBallNoGoalie | ||
| FIRST --> #StrikerRole | ||
| SECOND --> #SupporterRole | ||
| THIRD --> #DefensePositioning | ||
| YES --> $CountActiveRobotsWithoutGoalie | ||
| ONE --> $RankToBallNoGoalie | ||
| FIRST --> #StrikerRole | ||
| SECOND --> #DefensePositioning | ||
| ELSE --> $RankToBallNoGoalie | ||
| FIRST --> #StrikerRole | ||
| SECOND --> #SupporterRole | ||
| THIRD --> #DefensePositioning | ||
|
|
||
| #PlayingBehavior | ||
| $SecondaryStateDecider | ||
|
|
@@ -145,6 +156,7 @@ $IsPenalized | |
| JUST_UNPENALIZED --> $GameStateDecider | ||
| INITIAL --> #Init | ||
| ELSE --> #GetWalkreadyAndLocalize | ||
| UNPENALIZED_AFTER_TEAM_COM_LIMIT --> #DoNothing | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What's the thinking here? Why are we passive after being unpenalized? Is there a possibility this hits every team robot at the same time frame and thus disables the whole team while still being allowed to play?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since the unpenalised robot won't receive any more team_com messages it would act like it's playing alone and go to the ball. This could hinder the actual striker while playing. The only case the whole team stops playing is where all robots are penalised at the moment the team com_limit is reached, since a penalised robot is not allowed to send any more messages this is a very very rare case |
||
| NO --> $GameStateDecider | ||
| INITIAL --> #Init | ||
| READY --> $AnyGoalScoreRecently + time:50 | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.