11from typing import Optional
22
33from bitbots_utils .utils import get_parameters_from_other_node
4- from game_controller_hl_interfaces .msg import GameState
4+ from game_controller_hsl_interfaces .msg import GameState
55from std_msgs .msg import Bool
66
77from bitbots_blackboard .capsules import AbstractBlackboardCapsule
@@ -20,32 +20,37 @@ def __init__(self, node, blackboard=None):
2020 self .last_goal_from_us_time = - 86400.0
2121 self .last_goal_time = - 86400.0
2222 self .free_kick_kickoff_team : Optional [bool ] = None
23- self .game_controller_stop : Bool = False
23+ self .game_controller_stop : bool = False
2424 # publish stopped msg for hcm
25- self .stop_pub = self . node .create_publisher (Bool , "game_controller/stop_msg" , 1 )
25+ self .stop_pub = node .create_publisher (Bool , "game_controller/stop_msg" , 1 )
2626
27- def get_gamestate (self ) -> int :
28- # Init, ready, set, playing, finished, standby
27+ def get_game_state (self ) -> int :
28+ # Init, ready, set, playing, finished
2929 return self .gamestate .main_state
3030
31- def get_gamePhase (self ) -> int :
32- # Timeout, Normal, Penaltyshoot
33- return self .gamestate .gamePhase
31+ def get_game_phase (self ) -> int :
32+ # Timeout, Normal, Extratime, Penaltyshoot
33+ return self .gamestate .game_phase
3434
35- def get_setPlay (self ) -> int :
36- # None, Kick In, Goalkick, Cornerkick, Pushing Freekick, Penaltykick
37- return self .gamestate .setPlay
35+ def get_set_play (self ) -> int :
36+ # None, Direct Freekick, Indirect Freekick, Penalty, Throw in, Goalkick, Cornerkick,
37+ return self .gamestate .set_play
3838
3939 def get_secondary_team (self ) -> int :
40- # Team ID, wer in set Play den Baall hat
41- return self .gamestate .kickingTeam
40+ # Team ID, wer in set Play den Ball hat
41+ return self .gamestate .kicking_team
4242
4343 def has_kickoff (self ) -> bool :
4444 # vegelcih mit eigener Teamnummer
45- return self .gamestate .kickingTeam == self .team_id
45+ return self .gamestate .kicking_team == self .team_id
46+
47+ def is_stopped (self ) -> bool :
48+ return self .gamestate .stopped
4649
4750 def has_penalty_kick (self ) -> bool :
48- return self .gamestate .set_play == GameState .SET_PLAY_PENALTY_KICK and self .gamestate .kickingTeam == self .team_id
51+ return (
52+ self .gamestate .set_play == GameState .SET_PLAY_PENALTY_KICK and self .gamestate .kicking_team == self .team_id
53+ )
4954
5055 def get_our_goals (self ) -> int :
5156 return self .gamestate .own_score
@@ -74,7 +79,7 @@ def get_secondary_seconds_remaining(self) -> float:
7479 )
7580
7681 def get_seconds_since_unpenalized (self ) -> float :
77- return self ._node .get_clock ().now ().nanoseconds / 1e9 - self .seconds_till_unpenalized
82+ return self ._node .get_clock ().now ().nanoseconds / 1e9 - self .unpenalized_time
7883
7984 def get_is_penalized (self ) -> bool :
8085 return self .gamestate .penalized
@@ -98,7 +103,7 @@ def gamestate_callback(self, gamestate_msg: GameState) -> None:
98103
99104 self .game_controller_stop = gamestate_msg .stopped
100105
101- self .stop_pub .publish (self .game_controller_stop )
106+ self .stop_pub .publish (Bool ( data = self .game_controller_stop ) )
102107
103108 """Anstoß im Falle von Overtime jetzt erstmal nicht genauer geregelt
104109 if (
@@ -109,13 +114,14 @@ def gamestate_callback(self, gamestate_msg: GameState) -> None:
109114 # secondary action is now executed but we will not see this in the new messages.
110115 # it will look like a normal kick off, but we need to remember that this is some sort of free kick
111116 # we set the kickoff value accordingly, then we will not be allowed to move if it is a kick for the others
112- self.free_kick_kickoff_team = gamestate_msg.kickingTeam
117+ self.free_kick_kickoff_team = gamestate_msg.kicking_team
113118
119+ if gamestate_msg.set_play != 2 and gamestate_msg.secondary_time == 0:
120+ self.free_kick_kickoff_team = gamestate_msg.kicking_team
114121
115- if gamestate_msg.setPlay != 2 and gamestate_msg.secondaryTime == 0:
122+ if gamestate_msg.set_play != 2 and gamestate_msg.secondary_time == 0:
116123 self.free_kick_kickoff_team = None
117124
118-
119125 if self.free_kick_kickoff_team is not None:
120126 gamestate_msg.has_kick_off = self.free_kick_kickoff_team == self.team_id
121127 """
0 commit comments