From 96f7721021c7a41b9cf5b5a6ed575cf0326e631c Mon Sep 17 00:00:00 2001 From: Soroush Mazloum Date: Thu, 26 Sep 2024 21:41:24 +0330 Subject: [PATCH 1/9] .thrift version and catch_time added --- idl/soccer_service.thrift | 5 +++-- soccer/Game-remote | 2 +- soccer/Game.py | 2 +- soccer/constants.py | 2 +- soccer/ttypes.py | 16 ++++++++++++++-- soccer/ttypes.pyi | 3 ++- 6 files changed, 22 insertions(+), 8 deletions(-) diff --git a/idl/soccer_service.thrift b/idl/soccer_service.thrift index f4f989e..b90f156 100644 --- a/idl/soccer_service.thrift +++ b/idl/soccer_service.thrift @@ -1,4 +1,4 @@ -// version 1 +// version 1.1 namespace cpp soccer namespace py soccer @@ -177,7 +177,8 @@ struct Self { 36: double kick_rate, 37: double recovery, 38: double stamina_capacity, - 39: CardType card + 39: CardType card, + 40: i32 catch_time } enum InterceptActionType { diff --git a/soccer/Game-remote b/soccer/Game-remote index a1cd98b..1fccdbf 100755 --- a/soccer/Game-remote +++ b/soccer/Game-remote @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Autogenerated by Thrift Compiler (0.16.0) +# Autogenerated by Thrift Compiler (0.20.0) # # DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING # diff --git a/soccer/Game.py b/soccer/Game.py index 10cf40d..4978e51 100644 --- a/soccer/Game.py +++ b/soccer/Game.py @@ -1,5 +1,5 @@ # -# Autogenerated by Thrift Compiler (0.16.0) +# Autogenerated by Thrift Compiler (0.20.0) # # DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING # diff --git a/soccer/constants.py b/soccer/constants.py index 82c674e..09a78b3 100644 --- a/soccer/constants.py +++ b/soccer/constants.py @@ -1,5 +1,5 @@ # -# Autogenerated by Thrift Compiler (0.16.0) +# Autogenerated by Thrift Compiler (0.20.0) # # DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING # diff --git a/soccer/ttypes.py b/soccer/ttypes.py index acae6be..6ca06f0 100644 --- a/soccer/ttypes.py +++ b/soccer/ttypes.py @@ -1,5 +1,5 @@ # -# Autogenerated by Thrift Compiler (0.16.0) +# Autogenerated by Thrift Compiler (0.20.0) # # DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING # @@ -1299,11 +1299,12 @@ class Self(object): - recovery - stamina_capacity - card + - catch_time """ - def __init__(self, position=None, seen_position=None, heard_position=None, velocity=None, seen_velocity=None, pos_count=None, seen_pos_count=None, heard_pos_count=None, vel_count=None, seen_vel_count=None, ghost_count=None, id=None, side=None, uniform_number=None, uniform_number_count=None, is_goalie=None, body_direction=None, body_direction_count=None, face_direction=None, face_direction_count=None, point_to_direction=None, point_to_direction_count=None, is_kicking=None, dist_from_ball=None, angle_from_ball=None, ball_reach_steps=None, is_tackling=None, relative_neck_direction=None, stamina=None, is_kickable=None, catch_probability=None, tackle_probability=None, foul_probability=None, view_width=None, type_id=None, kick_rate=None, recovery=None, stamina_capacity=None, card=None,): + def __init__(self, position=None, seen_position=None, heard_position=None, velocity=None, seen_velocity=None, pos_count=None, seen_pos_count=None, heard_pos_count=None, vel_count=None, seen_vel_count=None, ghost_count=None, id=None, side=None, uniform_number=None, uniform_number_count=None, is_goalie=None, body_direction=None, body_direction_count=None, face_direction=None, face_direction_count=None, point_to_direction=None, point_to_direction_count=None, is_kicking=None, dist_from_ball=None, angle_from_ball=None, ball_reach_steps=None, is_tackling=None, relative_neck_direction=None, stamina=None, is_kickable=None, catch_probability=None, tackle_probability=None, foul_probability=None, view_width=None, type_id=None, kick_rate=None, recovery=None, stamina_capacity=None, card=None, catch_time=None,): self.position = position self.seen_position = seen_position self.heard_position = heard_position @@ -1343,6 +1344,7 @@ def __init__(self, position=None, seen_position=None, heard_position=None, veloc self.recovery = recovery self.stamina_capacity = stamina_capacity self.card = card + self.catch_time = catch_time def read(self, iprot): if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: @@ -1553,6 +1555,11 @@ def read(self, iprot): self.card = iprot.readI32() else: iprot.skip(ftype) + elif fid == 40: + if ftype == TType.I32: + self.catch_time = iprot.readI32() + else: + iprot.skip(ftype) else: iprot.skip(ftype) iprot.readFieldEnd() @@ -1719,6 +1726,10 @@ def write(self, oprot): oprot.writeFieldBegin('card', TType.I32, 39) oprot.writeI32(self.card) oprot.writeFieldEnd() + if self.catch_time is not None: + oprot.writeFieldBegin('catch_time', TType.I32, 40) + oprot.writeI32(self.catch_time) + oprot.writeFieldEnd() oprot.writeFieldStop() oprot.writeStructEnd() @@ -15066,6 +15077,7 @@ def __ne__(self, other): (37, TType.DOUBLE, 'recovery', None, None, ), # 37 (38, TType.DOUBLE, 'stamina_capacity', None, None, ), # 38 (39, TType.I32, 'card', None, None, ), # 39 + (40, TType.I32, 'catch_time', None, None, ), # 40 ) all_structs.append(InterceptInfo) InterceptInfo.thrift_spec = ( diff --git a/soccer/ttypes.pyi b/soccer/ttypes.pyi index 99b5b1e..44c49ba 100644 --- a/soccer/ttypes.pyi +++ b/soccer/ttypes.pyi @@ -137,7 +137,7 @@ class Player(object): type_id: int class Self(object): - def __init__(self, position: RpcVector2D = None, seen_position: RpcVector2D = None, heard_position: RpcVector2D = None, velocity: RpcVector2D = None, seen_velocity: RpcVector2D = None, pos_count: int = None, seen_pos_count: int = None, heard_pos_count: int = None, vel_count: int = None, seen_vel_count: int = None, ghost_count: int = None, id: int = None, side: Side = None, uniform_number: int = None, uniform_number_count: int = None, is_goalie: bool = None, body_direction: float = None, body_direction_count: int = None, face_direction: float = None, face_direction_count: int = None, point_to_direction: float = None, point_to_direction_count: int = None, is_kicking: bool = None, dist_from_ball: float = None, angle_from_ball: float = None, ball_reach_steps: int = None, is_tackling: bool = None, relative_neck_direction: float = None, stamina: float = None, is_kickable: bool = None, catch_probability: float = None, tackle_probability: float = None, foul_probability: float = None, view_width: ViewWidth = None, type_id: int = None, kick_rate: float = None, recovery: float = None, stamina_capacity: float = None, card: CardType = None): + def __init__(self, position: RpcVector2D = None, seen_position: RpcVector2D = None, heard_position: RpcVector2D = None, velocity: RpcVector2D = None, seen_velocity: RpcVector2D = None, pos_count: int = None, seen_pos_count: int = None, heard_pos_count: int = None, vel_count: int = None, seen_vel_count: int = None, ghost_count: int = None, id: int = None, side: Side = None, uniform_number: int = None, uniform_number_count: int = None, is_goalie: bool = None, body_direction: float = None, body_direction_count: int = None, face_direction: float = None, face_direction_count: int = None, point_to_direction: float = None, point_to_direction_count: int = None, is_kicking: bool = None, dist_from_ball: float = None, angle_from_ball: float = None, ball_reach_steps: int = None, is_tackling: bool = None, relative_neck_direction: float = None, stamina: float = None, is_kickable: bool = None, catch_probability: float = None, tackle_probability: float = None, foul_probability: float = None, view_width: ViewWidth = None, type_id: int = None, kick_rate: float = None, recovery: float = None, stamina_capacity: float = None, card: CardType = None, catch_time: int = None): pass position: RpcVector2D seen_position: RpcVector2D @@ -178,6 +178,7 @@ class Self(object): recovery: float stamina_capacity: float card: CardType + catch_time: int class InterceptActionType(Enum): UNKNOWN_Intercept_Action_Type = auto() From 28ca549c413248f40c39379e750c67d4ba221ad4 Mon Sep 17 00:00:00 2001 From: SK2iP Date: Sun, 29 Sep 2024 20:57:39 +0330 Subject: [PATCH 2/9] add version 1.1 --- idl/soccer_service.thrift | 9 +++- soccer/Game-remote | 2 +- soccer/Game.py | 2 +- soccer/constants.py | 2 +- soccer/ttypes.py | 86 +++++++++++++++++++++++++++++++++++++-- soccer/ttypes.pyi | 12 +++++- 6 files changed, 103 insertions(+), 10 deletions(-) diff --git a/idl/soccer_service.thrift b/idl/soccer_service.thrift index b90f156..657027e 100644 --- a/idl/soccer_service.thrift +++ b/idl/soccer_service.thrift @@ -285,7 +285,9 @@ struct WorldModel { 32: double our_defense_line_x, 33: double their_defense_line_x, 34: double our_defense_player_line_x, - 35: double their_defense_player_line_x + 35: double their_defense_player_line_x, + 36: bool kickable_teammate_existance, + 37: bool kickable_opponent_existance } struct State { @@ -766,6 +768,8 @@ struct HeliosPenalty {} struct HeliosCommunicaion {} +struct bhv_doForceKick {} + struct PlayerAction { 1: optional Dash dash, 2: optional Turn turn, @@ -830,7 +834,8 @@ struct PlayerAction { 61: optional HeliosBasicMove helios_basic_move, 62: optional HeliosSetPlay helios_set_play, 63: optional HeliosPenalty helios_penalty, - 64: optional HeliosCommunicaion helios_communication + 64: optional HeliosCommunicaion helios_communication, + 65: optional bhv_doForceKick bhv_do_force_kick } struct PlayerActions { diff --git a/soccer/Game-remote b/soccer/Game-remote index 1fccdbf..a1cd98b 100755 --- a/soccer/Game-remote +++ b/soccer/Game-remote @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Autogenerated by Thrift Compiler (0.20.0) +# Autogenerated by Thrift Compiler (0.16.0) # # DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING # diff --git a/soccer/Game.py b/soccer/Game.py index 4978e51..10cf40d 100644 --- a/soccer/Game.py +++ b/soccer/Game.py @@ -1,5 +1,5 @@ # -# Autogenerated by Thrift Compiler (0.20.0) +# Autogenerated by Thrift Compiler (0.16.0) # # DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING # diff --git a/soccer/constants.py b/soccer/constants.py index 09a78b3..82c674e 100644 --- a/soccer/constants.py +++ b/soccer/constants.py @@ -1,5 +1,5 @@ # -# Autogenerated by Thrift Compiler (0.20.0) +# Autogenerated by Thrift Compiler (0.16.0) # # DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING # diff --git a/soccer/ttypes.py b/soccer/ttypes.py index 6ca06f0..64bcce8 100644 --- a/soccer/ttypes.py +++ b/soccer/ttypes.py @@ -1,5 +1,5 @@ # -# Autogenerated by Thrift Compiler (0.20.0) +# Autogenerated by Thrift Compiler (0.16.0) # # DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING # @@ -2108,11 +2108,13 @@ class WorldModel(object): - their_defense_line_x - our_defense_player_line_x - their_defense_player_line_x + - kickable_teammate_existance + - kickable_opponent_existance """ - def __init__(self, intercept_table=None, our_team_name=None, their_team_name=None, our_side=None, last_set_play_start_time=None, myself=None, ball=None, teammates=None, opponents=None, unknowns=None, our_players_dict=None, their_players_dict=None, our_goalie_uniform_number=None, their_goalie_uniform_number=None, offside_line_x=None, offside_line_x_count=None, kickable_teammate_id=None, kickable_opponent_id=None, last_kick_side=None, last_kicker_uniform_number=None, cycle=None, game_mode_type=None, left_team_score=None, right_team_score=None, is_our_set_play=None, is_their_set_play=None, stoped_cycle=None, our_team_score=None, their_team_score=None, is_penalty_kick_mode=None, helios_home_positions=None, our_defense_line_x=None, their_defense_line_x=None, our_defense_player_line_x=None, their_defense_player_line_x=None,): + def __init__(self, intercept_table=None, our_team_name=None, their_team_name=None, our_side=None, last_set_play_start_time=None, myself=None, ball=None, teammates=None, opponents=None, unknowns=None, our_players_dict=None, their_players_dict=None, our_goalie_uniform_number=None, their_goalie_uniform_number=None, offside_line_x=None, offside_line_x_count=None, kickable_teammate_id=None, kickable_opponent_id=None, last_kick_side=None, last_kicker_uniform_number=None, cycle=None, game_mode_type=None, left_team_score=None, right_team_score=None, is_our_set_play=None, is_their_set_play=None, stoped_cycle=None, our_team_score=None, their_team_score=None, is_penalty_kick_mode=None, helios_home_positions=None, our_defense_line_x=None, their_defense_line_x=None, our_defense_player_line_x=None, their_defense_player_line_x=None, kickable_teammate_existance=None, kickable_opponent_existance=None,): self.intercept_table = intercept_table self.our_team_name = our_team_name self.their_team_name = their_team_name @@ -2148,6 +2150,8 @@ def __init__(self, intercept_table=None, our_team_name=None, their_team_name=Non self.their_defense_line_x = their_defense_line_x self.our_defense_player_line_x = our_defense_player_line_x self.their_defense_player_line_x = their_defense_player_line_x + self.kickable_teammate_existance = kickable_teammate_existance + self.kickable_opponent_existance = kickable_opponent_existance def read(self, iprot): if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: @@ -2375,6 +2379,16 @@ def read(self, iprot): self.their_defense_player_line_x = iprot.readDouble() else: iprot.skip(ftype) + elif fid == 36: + if ftype == TType.BOOL: + self.kickable_teammate_existance = iprot.readBool() + else: + iprot.skip(ftype) + elif fid == 37: + if ftype == TType.BOOL: + self.kickable_opponent_existance = iprot.readBool() + else: + iprot.skip(ftype) else: iprot.skip(ftype) iprot.readFieldEnd() @@ -2546,6 +2560,14 @@ def write(self, oprot): oprot.writeFieldBegin('their_defense_player_line_x', TType.DOUBLE, 35) oprot.writeDouble(self.their_defense_player_line_x) oprot.writeFieldEnd() + if self.kickable_teammate_existance is not None: + oprot.writeFieldBegin('kickable_teammate_existance', TType.BOOL, 36) + oprot.writeBool(self.kickable_teammate_existance) + oprot.writeFieldEnd() + if self.kickable_opponent_existance is not None: + oprot.writeFieldBegin('kickable_opponent_existance', TType.BOOL, 37) + oprot.writeBool(self.kickable_opponent_existance) + oprot.writeFieldEnd() oprot.writeFieldStop() oprot.writeStructEnd() @@ -9304,6 +9326,46 @@ def __ne__(self, other): return not (self == other) +class bhv_doForceKick(object): + + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('bhv_doForceKick') + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + + class PlayerAction(object): """ Attributes: @@ -9371,11 +9433,12 @@ class PlayerAction(object): - helios_set_play - helios_penalty - helios_communication + - bhv_do_force_kick """ - def __init__(self, dash=None, turn=None, kick=None, tackle=None, catch_action=None, move=None, turn_neck=None, change_view=None, say=None, point_to=None, point_to_of=None, attention_to=None, attention_to_of=None, log=None, debug_client=None, body_go_to_point=None, body_smart_kick=None, bhv_before_kick_off=None, bhv_body_neck_to_ball=None, bhv_body_neck_to_point=None, bhv_emergency=None, bhv_go_to_point_look_ball=None, bhv_neck_body_to_ball=None, bhv_neck_body_to_point=None, bhv_scan_field=None, body_advance_ball=None, body_clear_ball=None, body_dribble=None, body_go_to_point_dodge=None, body_hold_ball=None, body_intercept=None, body_kick_one_step=None, body_stop_ball=None, body_stop_dash=None, body_tackle_to_point=None, body_turn_to_angle=None, body_turn_to_ball=None, body_turn_to_point=None, focus_move_to_point=None, focus_reset=None, neck_scan_field=None, neck_scan_players=None, neck_turn_to_ball_and_player=None, neck_turn_to_ball_or_scan=None, neck_turn_to_ball=None, neck_turn_to_goalie_or_scan=None, neck_turn_to_low_conf_teammate=None, neck_turn_to_player_or_scan=None, neck_turn_to_point=None, neck_turn_to_relative=None, view_change_width=None, view_normal=None, view_synch=None, view_wide=None, helios_goalie=None, helios_goalie_move=None, helios_goalie_kick=None, helios_shoot=None, helios_offensive_planner=None, helios_basic_offensive=None, helios_basic_move=None, helios_set_play=None, helios_penalty=None, helios_communication=None,): + def __init__(self, dash=None, turn=None, kick=None, tackle=None, catch_action=None, move=None, turn_neck=None, change_view=None, say=None, point_to=None, point_to_of=None, attention_to=None, attention_to_of=None, log=None, debug_client=None, body_go_to_point=None, body_smart_kick=None, bhv_before_kick_off=None, bhv_body_neck_to_ball=None, bhv_body_neck_to_point=None, bhv_emergency=None, bhv_go_to_point_look_ball=None, bhv_neck_body_to_ball=None, bhv_neck_body_to_point=None, bhv_scan_field=None, body_advance_ball=None, body_clear_ball=None, body_dribble=None, body_go_to_point_dodge=None, body_hold_ball=None, body_intercept=None, body_kick_one_step=None, body_stop_ball=None, body_stop_dash=None, body_tackle_to_point=None, body_turn_to_angle=None, body_turn_to_ball=None, body_turn_to_point=None, focus_move_to_point=None, focus_reset=None, neck_scan_field=None, neck_scan_players=None, neck_turn_to_ball_and_player=None, neck_turn_to_ball_or_scan=None, neck_turn_to_ball=None, neck_turn_to_goalie_or_scan=None, neck_turn_to_low_conf_teammate=None, neck_turn_to_player_or_scan=None, neck_turn_to_point=None, neck_turn_to_relative=None, view_change_width=None, view_normal=None, view_synch=None, view_wide=None, helios_goalie=None, helios_goalie_move=None, helios_goalie_kick=None, helios_shoot=None, helios_offensive_planner=None, helios_basic_offensive=None, helios_basic_move=None, helios_set_play=None, helios_penalty=None, helios_communication=None, bhv_do_force_kick=None,): self.dash = dash self.turn = turn self.kick = kick @@ -9440,6 +9503,7 @@ def __init__(self, dash=None, turn=None, kick=None, tackle=None, catch_action=No self.helios_set_play = helios_set_play self.helios_penalty = helios_penalty self.helios_communication = helios_communication + self.bhv_do_force_kick = bhv_do_force_kick def read(self, iprot): if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: @@ -9834,6 +9898,12 @@ def read(self, iprot): self.helios_communication.read(iprot) else: iprot.skip(ftype) + elif fid == 65: + if ftype == TType.STRUCT: + self.bhv_do_force_kick = bhv_doForceKick() + self.bhv_do_force_kick.read(iprot) + else: + iprot.skip(ftype) else: iprot.skip(ftype) iprot.readFieldEnd() @@ -10100,6 +10170,10 @@ def write(self, oprot): oprot.writeFieldBegin('helios_communication', TType.STRUCT, 64) self.helios_communication.write(oprot) oprot.writeFieldEnd() + if self.bhv_do_force_kick is not None: + oprot.writeFieldBegin('bhv_do_force_kick', TType.STRUCT, 65) + self.bhv_do_force_kick.write(oprot) + oprot.writeFieldEnd() oprot.writeFieldStop() oprot.writeStructEnd() @@ -15145,6 +15219,8 @@ def __ne__(self, other): (33, TType.DOUBLE, 'their_defense_line_x', None, None, ), # 33 (34, TType.DOUBLE, 'our_defense_player_line_x', None, None, ), # 34 (35, TType.DOUBLE, 'their_defense_player_line_x', None, None, ), # 35 + (36, TType.BOOL, 'kickable_teammate_existance', None, None, ), # 36 + (37, TType.BOOL, 'kickable_opponent_existance', None, None, ), # 37 ) all_structs.append(State) State.thrift_spec = ( @@ -15721,6 +15797,9 @@ def __ne__(self, other): all_structs.append(HeliosCommunicaion) HeliosCommunicaion.thrift_spec = ( ) +all_structs.append(bhv_doForceKick) +bhv_doForceKick.thrift_spec = ( +) all_structs.append(PlayerAction) PlayerAction.thrift_spec = ( None, # 0 @@ -15788,6 +15867,7 @@ def __ne__(self, other): (62, TType.STRUCT, 'helios_set_play', [HeliosSetPlay, None], None, ), # 62 (63, TType.STRUCT, 'helios_penalty', [HeliosPenalty, None], None, ), # 63 (64, TType.STRUCT, 'helios_communication', [HeliosCommunicaion, None], None, ), # 64 + (65, TType.STRUCT, 'bhv_do_force_kick', [bhv_doForceKick, None], None, ), # 65 ) all_structs.append(PlayerActions) PlayerActions.thrift_spec = ( diff --git a/soccer/ttypes.pyi b/soccer/ttypes.pyi index 44c49ba..9211d4a 100644 --- a/soccer/ttypes.pyi +++ b/soccer/ttypes.pyi @@ -250,7 +250,7 @@ class GameModeType(Enum): MODE_MAX = auto() class WorldModel(object): - def __init__(self, intercept_table: InterceptTable = None, our_team_name: str = None, their_team_name: str = None, our_side: Side = None, last_set_play_start_time: int = None, myself: Self = None, ball: Ball = None, teammates: List[Player] = None, opponents: List[Player] = None, unknowns: List[Player] = None, our_players_dict: Dict[int, Player] = None, their_players_dict: Dict[int, Player] = None, our_goalie_uniform_number: int = None, their_goalie_uniform_number: int = None, offside_line_x: float = None, offside_line_x_count: int = None, kickable_teammate_id: int = None, kickable_opponent_id: int = None, last_kick_side: Side = None, last_kicker_uniform_number: int = None, cycle: int = None, game_mode_type: GameModeType = None, left_team_score: int = None, right_team_score: int = None, is_our_set_play: bool = None, is_their_set_play: bool = None, stoped_cycle: int = None, our_team_score: int = None, their_team_score: int = None, is_penalty_kick_mode: bool = None, helios_home_positions: Dict[int, RpcVector2D] = None, our_defense_line_x: float = None, their_defense_line_x: float = None, our_defense_player_line_x: float = None, their_defense_player_line_x: float = None): + def __init__(self, intercept_table: InterceptTable = None, our_team_name: str = None, their_team_name: str = None, our_side: Side = None, last_set_play_start_time: int = None, myself: Self = None, ball: Ball = None, teammates: List[Player] = None, opponents: List[Player] = None, unknowns: List[Player] = None, our_players_dict: Dict[int, Player] = None, their_players_dict: Dict[int, Player] = None, our_goalie_uniform_number: int = None, their_goalie_uniform_number: int = None, offside_line_x: float = None, offside_line_x_count: int = None, kickable_teammate_id: int = None, kickable_opponent_id: int = None, last_kick_side: Side = None, last_kicker_uniform_number: int = None, cycle: int = None, game_mode_type: GameModeType = None, left_team_score: int = None, right_team_score: int = None, is_our_set_play: bool = None, is_their_set_play: bool = None, stoped_cycle: int = None, our_team_score: int = None, their_team_score: int = None, is_penalty_kick_mode: bool = None, helios_home_positions: Dict[int, RpcVector2D] = None, our_defense_line_x: float = None, their_defense_line_x: float = None, our_defense_player_line_x: float = None, their_defense_player_line_x: float = None, kickable_teammate_existance: bool = None, kickable_opponent_existance: bool = None): pass intercept_table: InterceptTable our_team_name: str @@ -287,6 +287,8 @@ class WorldModel(object): their_defense_line_x: float our_defense_player_line_x: float their_defense_player_line_x: float + kickable_teammate_existance: bool + kickable_opponent_existance: bool class State(object): def __init__(self, register_response: RegisterResponse = None, world_model: WorldModel = None, full_world_model: WorldModel = None, need_preprocess: bool = None): @@ -917,8 +919,13 @@ class HeliosCommunicaion(object): pass pass +class bhv_doForceKick(object): + def __init__(self, ): + pass + pass + class PlayerAction(object): - def __init__(self, dash: Dash = None, turn: Turn = None, kick: Kick = None, tackle: Tackle = None, catch_action: Catch = None, move: Move = None, turn_neck: TurnNeck = None, change_view: ChangeView = None, say: Say = None, point_to: PointTo = None, point_to_of: PointToOf = None, attention_to: AttentionTo = None, attention_to_of: AttentionToOf = None, log: Log = None, debug_client: DebugClient = None, body_go_to_point: Body_GoToPoint = None, body_smart_kick: Body_SmartKick = None, bhv_before_kick_off: Bhv_BeforeKickOff = None, bhv_body_neck_to_ball: Bhv_BodyNeckToBall = None, bhv_body_neck_to_point: Bhv_BodyNeckToPoint = None, bhv_emergency: Bhv_Emergency = None, bhv_go_to_point_look_ball: Bhv_GoToPointLookBall = None, bhv_neck_body_to_ball: Bhv_NeckBodyToBall = None, bhv_neck_body_to_point: Bhv_NeckBodyToPoint = None, bhv_scan_field: Bhv_ScanField = None, body_advance_ball: Body_AdvanceBall = None, body_clear_ball: Body_ClearBall = None, body_dribble: Body_Dribble = None, body_go_to_point_dodge: Body_GoToPointDodge = None, body_hold_ball: Body_HoldBall = None, body_intercept: Body_Intercept = None, body_kick_one_step: Body_KickOneStep = None, body_stop_ball: Body_StopBall = None, body_stop_dash: Body_StopDash = None, body_tackle_to_point: Body_TackleToPoint = None, body_turn_to_angle: Body_TurnToAngle = None, body_turn_to_ball: Body_TurnToBall = None, body_turn_to_point: Body_TurnToPoint = None, focus_move_to_point: Focus_MoveToPoint = None, focus_reset: Focus_Reset = None, neck_scan_field: Neck_ScanField = None, neck_scan_players: Neck_ScanPlayers = None, neck_turn_to_ball_and_player: Neck_TurnToBallAndPlayer = None, neck_turn_to_ball_or_scan: Neck_TurnToBallOrScan = None, neck_turn_to_ball: Neck_TurnToBall = None, neck_turn_to_goalie_or_scan: Neck_TurnToGoalieOrScan = None, neck_turn_to_low_conf_teammate: Neck_TurnToLowConfTeammate = None, neck_turn_to_player_or_scan: Neck_TurnToPlayerOrScan = None, neck_turn_to_point: Neck_TurnToPoint = None, neck_turn_to_relative: Neck_TurnToRelative = None, view_change_width: View_ChangeWidth = None, view_normal: View_Normal = None, view_synch: View_Synch = None, view_wide: View_Wide = None, helios_goalie: HeliosGoalie = None, helios_goalie_move: HeliosGoalieMove = None, helios_goalie_kick: HeliosGoalieKick = None, helios_shoot: HeliosShoot = None, helios_offensive_planner: HeliosOffensivePlanner = None, helios_basic_offensive: HeliosBasicOffensive = None, helios_basic_move: HeliosBasicMove = None, helios_set_play: HeliosSetPlay = None, helios_penalty: HeliosPenalty = None, helios_communication: HeliosCommunicaion = None): + def __init__(self, dash: Dash = None, turn: Turn = None, kick: Kick = None, tackle: Tackle = None, catch_action: Catch = None, move: Move = None, turn_neck: TurnNeck = None, change_view: ChangeView = None, say: Say = None, point_to: PointTo = None, point_to_of: PointToOf = None, attention_to: AttentionTo = None, attention_to_of: AttentionToOf = None, log: Log = None, debug_client: DebugClient = None, body_go_to_point: Body_GoToPoint = None, body_smart_kick: Body_SmartKick = None, bhv_before_kick_off: Bhv_BeforeKickOff = None, bhv_body_neck_to_ball: Bhv_BodyNeckToBall = None, bhv_body_neck_to_point: Bhv_BodyNeckToPoint = None, bhv_emergency: Bhv_Emergency = None, bhv_go_to_point_look_ball: Bhv_GoToPointLookBall = None, bhv_neck_body_to_ball: Bhv_NeckBodyToBall = None, bhv_neck_body_to_point: Bhv_NeckBodyToPoint = None, bhv_scan_field: Bhv_ScanField = None, body_advance_ball: Body_AdvanceBall = None, body_clear_ball: Body_ClearBall = None, body_dribble: Body_Dribble = None, body_go_to_point_dodge: Body_GoToPointDodge = None, body_hold_ball: Body_HoldBall = None, body_intercept: Body_Intercept = None, body_kick_one_step: Body_KickOneStep = None, body_stop_ball: Body_StopBall = None, body_stop_dash: Body_StopDash = None, body_tackle_to_point: Body_TackleToPoint = None, body_turn_to_angle: Body_TurnToAngle = None, body_turn_to_ball: Body_TurnToBall = None, body_turn_to_point: Body_TurnToPoint = None, focus_move_to_point: Focus_MoveToPoint = None, focus_reset: Focus_Reset = None, neck_scan_field: Neck_ScanField = None, neck_scan_players: Neck_ScanPlayers = None, neck_turn_to_ball_and_player: Neck_TurnToBallAndPlayer = None, neck_turn_to_ball_or_scan: Neck_TurnToBallOrScan = None, neck_turn_to_ball: Neck_TurnToBall = None, neck_turn_to_goalie_or_scan: Neck_TurnToGoalieOrScan = None, neck_turn_to_low_conf_teammate: Neck_TurnToLowConfTeammate = None, neck_turn_to_player_or_scan: Neck_TurnToPlayerOrScan = None, neck_turn_to_point: Neck_TurnToPoint = None, neck_turn_to_relative: Neck_TurnToRelative = None, view_change_width: View_ChangeWidth = None, view_normal: View_Normal = None, view_synch: View_Synch = None, view_wide: View_Wide = None, helios_goalie: HeliosGoalie = None, helios_goalie_move: HeliosGoalieMove = None, helios_goalie_kick: HeliosGoalieKick = None, helios_shoot: HeliosShoot = None, helios_offensive_planner: HeliosOffensivePlanner = None, helios_basic_offensive: HeliosBasicOffensive = None, helios_basic_move: HeliosBasicMove = None, helios_set_play: HeliosSetPlay = None, helios_penalty: HeliosPenalty = None, helios_communication: HeliosCommunicaion = None, bhv_do_force_kick: bhv_doForceKick = None): pass dash: Dash turn: Turn @@ -984,6 +991,7 @@ class PlayerAction(object): helios_set_play: HeliosSetPlay helios_penalty: HeliosPenalty helios_communication: HeliosCommunicaion + bhv_do_force_kick: bhv_doForceKick class PlayerActions(object): def __init__(self, actions: List[PlayerAction] = None, ignore_preprocess: bool = None): From f523c4e06c277ed300a27cdf328048acec66d98e Mon Sep 17 00:00:00 2001 From: naderzare Date: Mon, 30 Sep 2024 21:43:40 -0300 Subject: [PATCH 3/9] improve logger --- server.py | 50 ++++++++++++++++++++++++++++--------------- start-team.py | 30 ++++++++++++++++++-------- start-team.sh | 13 ++++++++++- utils/logger_utils.py | 50 +++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 116 insertions(+), 27 deletions(-) create mode 100644 utils/logger_utils.py diff --git a/server.py b/server.py index beb4f08..ab681f2 100644 --- a/server.py +++ b/server.py @@ -15,9 +15,13 @@ import logging from pyrusgeom.vector_2d import Vector2D import argparse +from utils.logger_utils import setup_logger -logging.basicConfig(level=logging.DEBUG) +console_logging_level = logging.INFO +file_logging_level = logging.DEBUG + +main_logger = setup_logger("pmservice", "logs/pmservice.log", console_level=console_logging_level, file_level=file_logging_level) class GameHandler: @@ -28,9 +32,11 @@ def __init__(self, shared_lock, shared_number_of_connections): self.debug_mode: bool = False self.shared_lock = shared_lock self.shared_number_of_connections = shared_number_of_connections + self.logger: logging.Logger = setup_logger("Agent", "logs/Agent.log", console_level=console_logging_level, file_level=file_logging_level) def GetPlayerActions(self, state: State): - logging.debug(f"GetPlayerActions unum {state.register_response.uniform_number} at {state.world_model.cycle}") + self.logger.debug(f"================================= cycle={state.world_model.cycle}.{state.world_model.stoped_cycle} =================================") + self.logger.debug(f"GetPlayerActions unum {state.register_response.uniform_number} at {state.world_model.cycle}") actions = [] if state.world_model.game_mode_type == GameModeType.PlayOn: if state.world_model.myself.is_goalie: @@ -53,19 +59,24 @@ def GetPlayerActions(self, state: State): actions.append(PlayerAction(helios_set_play=HeliosSetPlay())) res = PlayerActions(actions=actions) + self.logger.debug(f"Actions: {res}") return res def GetCoachActions(self, state: State): - logging.debug(f"GetCoachActions coach at {state.world_model.cycle}") + self.logger.debug(f"================================= cycle={state.world_model.cycle}.{state.world_model.stoped_cycle} =================================") + self.logger.debug(f"GetCoachActions coach at {state.world_model.cycle}") actions = [] actions.append(CoachAction(do_helios_substitute=DoHeliosSubstitute())) - return CoachActions(actions=actions) + res = CoachActions(actions=actions) + self.logger.debug(f"Actions: {res}") + return res def GetTrainerActions(self, state: State): - logging.debug(f"GetTrainerActions trainer at {state.world_model.cycle}") + self.logger.debug(f"================================= cycle={state.world_model.cycle}.{state.world_model.stoped_cycle} =================================") + self.logger.debug(f"GetTrainerActions trainer at {state.world_model.cycle}") actions = [] if state.world_model.cycle % 100 == 99: - logging.debug(f"Trainer at cycle {state.world_model.cycle}") + self.logger.debug(f"Trainer at cycle {state.world_model.cycle}") if len(state.world_model.teammates) == 0: return TrainerActions() player = state.world_model.teammates[0] @@ -95,42 +106,47 @@ def GetTrainerActions(self, state: State): )), TrainerAction(do_change_mode=DoChangeMode(game_mode_type=GameModeType.PlayOn)) ] - return TrainerActions(actions=actions) + res = TrainerActions(actions=actions) + self.logger.debug(f"Actions: {res}") + return res def SendServerParams(self, serverParams: ServerParam): - logging.debug(f"Server params received unum {serverParams.register_response.uniform_number}") + self.logger.debug(f"Server params received unum {serverParams.register_response.uniform_number}") self.server_params = serverParams res = Empty() return res def SendPlayerParams(self, playerParams: PlayerParam): - logging.debug(f"Player params received unum {playerParams.register_response.uniform_number}") + self.logger.debug(f"Player params received unum {playerParams.register_response.uniform_number}") self.player_params = playerParams res = Empty() return res def SendPlayerType(self, playerType: PlayerType): - logging.debug(f"Player type received unum {playerType.register_response.uniform_number}") + self.logger.debug(f"Player type received unum {playerType.register_response.uniform_number}") self.player_types[playerType.id] = playerType res = Empty() return res def SendInitMessage(self, initMessage: InitMessage): - logging.debug(f"Init message received unum {initMessage.register_response.uniform_number}") + self.logger.debug(f"Init message received unum {initMessage.register_response.uniform_number}") self.debug_mode = initMessage.debug_mode res = Empty() return res def Register(self, register_request: RegisterRequest): - logging.debug(f"received register request from team_name: {register_request.team_name} " + self.logger.debug(f"received register request from team_name: {register_request.team_name} " f"unum: {register_request.uniform_number} " f"agent_type: {register_request.agent_type}") with self.shared_lock: self.shared_number_of_connections.value += 1 - logging.debug(f"Number of connections {self.shared_number_of_connections.value}") + self.logger.debug(f"Number of connections {self.shared_number_of_connections.value}") team_name = register_request.team_name uniform_number = register_request.uniform_number agent_type = register_request.agent_type + self.logger: logging.Logger = setup_logger(f"Agent{register_request.uniform_number}-{self.shared_number_of_connections.value}", + "logs/Agent{register_request.uniform_number}-{self.shared_number_of_connections.value}.log", + console_level=console_logging_level, file_level=file_logging_level) res = RegisterResponse(client_id=self.shared_number_of_connections.value, team_name=team_name, uniform_number=uniform_number, @@ -138,17 +154,17 @@ def Register(self, register_request: RegisterRequest): return res def SendByeCommand(self, register_response: RegisterResponse): - logging.debug(f"Bye command received unum {register_response.uniform_number}") + self.logger.debug(f"Bye command received unum {register_response.uniform_number}") with self.shared_lock: pass res = Empty() return res def GetBestPlannerAction(self, pairs: BestPlannerActionRequest): - logging.debug(f"GetBestPlannerAction cycle:{pairs.state.world_model.cycle} pairs:{len(pairs.pairs)} unum:{pairs.register_response.uniform_number}") + self.logger.debug(f"GetBestPlannerAction cycle:{pairs.state.world_model.cycle} pairs:{len(pairs.pairs)} unum:{pairs.register_response.uniform_number}") pairs_list: list[int, RpcActionState] = [(k, v) for k, v in pairs.pairs.items()] pairs_list.sort(key=lambda x: x[0]) best_action = max(pairs_list, key=lambda x: -1000 if x[1].action.parent_index != -1 else x[1].predict_state.ball_position.x) - logging.debug(f"Best action: {best_action[0]} {best_action[1].action.description} to {best_action[1].action.target_unum} in ({round(best_action[1].action.target_point.x, 2)},{round(best_action[1].action.target_point.y, 2)}) e:{round(best_action[1].evaluation,2)}") + self.logger.debug(f"Best action: {best_action[0]} {best_action[1].action.description} to {best_action[1].action.target_unum} in ({round(best_action[1].action.target_point.x, 2)},{round(best_action[1].action.target_point.y, 2)}) e:{round(best_action[1].evaluation,2)}") res = BestPlannerActionResponse(index=best_action[0]) return res @@ -162,7 +178,7 @@ def serve(port, shared_lock, shared_number_of_connections): server = PFProcessServer(processor, transport, tfactory, pfactory) # server = TThreadedServer(processor, transport, tfactory, pfactory) - logging.info(f"Starting server on port {port}") + main_logger.info(f"Starting server on port {port}") try: server.serve() except KeyboardInterrupt: diff --git a/start-team.py b/start-team.py index 5fd4fd4..1135c4b 100644 --- a/start-team.py +++ b/start-team.py @@ -5,10 +5,14 @@ import logging import argparse import check_requirements +from utils.logger_utils import setup_logger +# remove logs directory +os.system("rm -rf logs") # Set up logging -logging.basicConfig(level=logging.DEBUG, format='%(asctime)s - %(levelname)s - %(message)s') +start_team_logger = setup_logger('start-team', 'logs/start-team.log', console_level=logging.DEBUG, file_level=logging.DEBUG, console_format_str='%(message)s') + def run_server_script(args): # Start the server.py script as a new process group @@ -31,10 +35,18 @@ def run_start_script(args): ) return process -def stream_output(process, prefix): +def stream_output_to_console(process, prefix): + # Stream output from the process and log it with a prefix + for line in iter(process.stdout.readline, b''): + start_team_logger.debug(f'{prefix} {line.decode().strip()}') + process.stdout.close() + +def stream_output_to_file(process, prefix): # Stream output from the process and log it with a prefix + logger = setup_logger(prefix, console_level=None, file_level=logging.DEBUG) for line in iter(process.stdout.readline, b''): - logging.debug(f'{prefix} {line.decode().strip()}') + logger.info(line.decode().strip()) + pass process.stdout.close() def kill_process_group(process): @@ -52,20 +64,20 @@ def kill_process_group(process): try: # Check Python requirements - logging.debug("Checking Python requirements...") + start_team_logger.debug("Checking Python requirements...") check_requirements.check_requirements() # Run the server.py script first server_process = run_server_script(args) - logging.debug(f"Started server.py process with PID: {server_process.pid}") + start_team_logger.debug(f"Started server.py process with PID: {server_process.pid}") # Run the start.sh script after server.py with the given arguments start_process = run_start_script(args) - logging.debug(f"Started start.sh process with PID: {start_process.pid} with team name {args=}") + start_team_logger.debug(f"Started start.sh process with PID: {start_process.pid} with team name {args=}") # Monitor both processes and log their outputs - server_thread = threading.Thread(target=stream_output, args=(server_process, 'server:')) - start_thread = threading.Thread(target=stream_output, args=(start_process, 'team:')) + server_thread = threading.Thread(target=stream_output_to_console, args=(server_process, 'server:')) + start_thread = threading.Thread(target=stream_output_to_file, args=(start_process, 'proxy:')) server_thread.start() start_thread.start() @@ -75,7 +87,7 @@ def kill_process_group(process): start_thread.join() except KeyboardInterrupt: - logging.debug("Interrupted! Killing all processes.") + start_team_logger.debug("Interrupted! Killing all processes.") kill_process_group(server_process) kill_process_group(start_process) diff --git a/start-team.sh b/start-team.sh index 7a15503..5ae5d09 100755 --- a/start-team.sh +++ b/start-team.sh @@ -1,5 +1,12 @@ #!/bin/bash +# remove logs directory +rm -rf logs +# create logs directory +if [ ! -d "./logs" ]; then + mkdir -p "./logs" +fi + # Ensure the script exits if any command fails set -e # check scripts/proxy directory does not exist, raise error @@ -67,8 +74,12 @@ sleep 2 # Start start.sh script in the correct directory with arguments echo "Starting start.sh with team name: $team_name and ..." + +log_dir="logs/proxy.log" +abspath=$(realpath $log_dir) + cd scripts/proxy -bash start.sh -t "$team_name" --rpc-port $rpc_port & +bash start.sh -t "$team_name" --rpc-port $rpc_port --rpc-type grpc >> $abspath 2>&1 & start_pid=$! # Wait for both background processes to finish diff --git a/utils/logger_utils.py b/utils/logger_utils.py new file mode 100644 index 0000000..5f73f7d --- /dev/null +++ b/utils/logger_utils.py @@ -0,0 +1,50 @@ +import logging +import os + + +def setup_logger(name, log_file=None, console_level=logging.INFO, file_level=logging.DEBUG, console_format_str=None, file_format_str=None): + """ + Set up a logger that writes to both a file and the console, with different formats and levels. + + :param name: Name of the logger. + :param log_file: Path to the log file. + :param console_level: Logging level for the console output. + :param file_level: Logging level for the file output. + :return: Configured logger. + """ + have_console_handler = console_level is not None + have_file_handler = file_level is not None + if log_file is None: + log_file = os.path.join('logs', f'{name}.log') + # Directory + directory = os.path.dirname(log_file) + if directory and not os.path.exists(directory): + os.makedirs(directory) + + print(f"have_console_handler={have_console_handler}, have_file_handler={have_file_handler}", log_file, directory) + # Create a custom logger + logger = logging.getLogger(name) + + if not logger.hasHandlers(): + logger.setLevel(logging.DEBUG) # Set the overall logger level to the lowest level you want to capture + # Console handler + if have_console_handler: + console_handler = logging.StreamHandler() # For console output + console_handler.setLevel(console_level) + if not console_format_str: + console_format_str = '%(name)s - %(levelname)s - %(message)s' + console_format = logging.Formatter(console_format_str) + console_handler.setFormatter(console_format) + logger.addHandler(console_handler) + + # File handler + if have_file_handler: + file_handler = logging.FileHandler(log_file) # For file output + file_handler.setLevel(file_level) + if not file_format_str: + file_format_str = '%(asctime)s - %(name)s - %(levelname)s - %(message)s' + file_format = logging.Formatter(file_format_str) + file_handler.setFormatter(file_format) + logger.addHandler(file_handler) + + return logger From 9f5a0ab4163c259a3f8c4494ac787d6ddadd81ac Mon Sep 17 00:00:00 2001 From: naderzare Date: Mon, 30 Sep 2024 21:45:11 -0300 Subject: [PATCH 4/9] run proxy in debug mode --- start-team.py | 4 +++- start-team.sh | 11 +++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/start-team.py b/start-team.py index 1135c4b..8efbd4a 100644 --- a/start-team.py +++ b/start-team.py @@ -27,7 +27,7 @@ def run_server_script(args): def run_start_script(args): # Start the start.sh script in its own directory as a new process group process = subprocess.Popen( - ['bash', 'start.sh', '-t', args.team_name, '--rpc-port', args.rpc_port], + ['bash', 'start.sh' if not args.debug else 'start-debug.sh', '-t', args.team_name, '--rpc-port', args.rpc_port, '--rpc-type', 'grpc'], cwd='scripts/proxy', # Corrected directory to where start.sh is located preexec_fn=os.setsid, # Create a new session and set the process group ID stdout=subprocess.PIPE, @@ -60,6 +60,8 @@ def kill_process_group(process): parser = argparse.ArgumentParser(description='Run server and team scripts.') parser.add_argument('-t', '--team_name', required=False, help='The name of the team', default='CLS') parser.add_argument('--rpc-port', required=False, help='The port of the server', default='50051') + parser.add_argument('-d', '--debug', required=False, help='Enable debug mode', default=False, action='store_true') + args = parser.parse_args() try: diff --git a/start-team.sh b/start-team.sh index 5ae5d09..d60b35b 100755 --- a/start-team.sh +++ b/start-team.sh @@ -17,6 +17,7 @@ fi team_name="CLS" rpc_port=50051 +debug=false # help function usage() { @@ -38,6 +39,9 @@ do rpc_port=$2 shift ;; + -d|--debug) + debug=true + ;; *) echo 1>&2 echo "invalid option \"${1}\"." 1>&2 @@ -79,8 +83,11 @@ log_dir="logs/proxy.log" abspath=$(realpath $log_dir) cd scripts/proxy -bash start.sh -t "$team_name" --rpc-port $rpc_port --rpc-type grpc >> $abspath 2>&1 & -start_pid=$! +if [ "$debug" = true ]; then + bash start-debug.sh -t "$team_name" --rpc-port $rpc_port --rpc-type grpc >> $abspath 2>&1 & +else + bash start.sh -t "$team_name" --rpc-port $rpc_port --rpc-type grpc >> $abspath 2>&1 & +fistart_pid=$! # Wait for both background processes to finish wait $server_pid From e207988d01ae5b9d54c2d2f26cb38886c18cb75f Mon Sep 17 00:00:00 2001 From: naderzare Date: Mon, 30 Sep 2024 21:54:19 -0300 Subject: [PATCH 5/9] fix bugs --- server.py | 2 +- start-team.py | 2 +- start-team.sh | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/server.py b/server.py index ab681f2..fa615f4 100644 --- a/server.py +++ b/server.py @@ -145,7 +145,7 @@ def Register(self, register_request: RegisterRequest): uniform_number = register_request.uniform_number agent_type = register_request.agent_type self.logger: logging.Logger = setup_logger(f"Agent{register_request.uniform_number}-{self.shared_number_of_connections.value}", - "logs/Agent{register_request.uniform_number}-{self.shared_number_of_connections.value}.log", + f"logs/Agent{register_request.uniform_number}-{self.shared_number_of_connections.value}.log", console_level=console_logging_level, file_level=file_logging_level) res = RegisterResponse(client_id=self.shared_number_of_connections.value, team_name=team_name, diff --git a/start-team.py b/start-team.py index 8efbd4a..e9ba3d0 100644 --- a/start-team.py +++ b/start-team.py @@ -27,7 +27,7 @@ def run_server_script(args): def run_start_script(args): # Start the start.sh script in its own directory as a new process group process = subprocess.Popen( - ['bash', 'start.sh' if not args.debug else 'start-debug.sh', '-t', args.team_name, '--rpc-port', args.rpc_port, '--rpc-type', 'grpc'], + ['bash', 'start.sh' if not args.debug else 'start-debug.sh', '-t', args.team_name, '--rpc-port', args.rpc_port, '--rpc-type', 'thrift'], cwd='scripts/proxy', # Corrected directory to where start.sh is located preexec_fn=os.setsid, # Create a new session and set the process group ID stdout=subprocess.PIPE, diff --git a/start-team.sh b/start-team.sh index d60b35b..0fa559d 100755 --- a/start-team.sh +++ b/start-team.sh @@ -84,9 +84,9 @@ abspath=$(realpath $log_dir) cd scripts/proxy if [ "$debug" = true ]; then - bash start-debug.sh -t "$team_name" --rpc-port $rpc_port --rpc-type grpc >> $abspath 2>&1 & + bash start-debug.sh -t "$team_name" --rpc-port $rpc_port --rpc-type thrift >> $abspath 2>&1 & else - bash start.sh -t "$team_name" --rpc-port $rpc_port --rpc-type grpc >> $abspath 2>&1 & + bash start.sh -t "$team_name" --rpc-port $rpc_port --rpc-type thrift >> $abspath 2>&1 & fistart_pid=$! # Wait for both background processes to finish From 5aba3bcadfd7144c431fceabd09b0bd1a87d9154 Mon Sep 17 00:00:00 2001 From: naderzare Date: Tue, 1 Oct 2024 21:18:56 -0300 Subject: [PATCH 6/9] improve logger --- server.py | 14 +++++++++++--- start-team.py | 15 +++++++-------- start-team.sh | 23 ++++++++++++----------- utils/logger_utils.py | 14 ++++++-------- 4 files changed, 36 insertions(+), 30 deletions(-) diff --git a/server.py b/server.py index fa615f4..815cc7e 100644 --- a/server.py +++ b/server.py @@ -16,12 +16,14 @@ from pyrusgeom.vector_2d import Vector2D import argparse from utils.logger_utils import setup_logger +import datetime console_logging_level = logging.INFO file_logging_level = logging.DEBUG -main_logger = setup_logger("pmservice", "logs/pmservice.log", console_level=console_logging_level, file_level=file_logging_level) +main_logger = None +log_dir = None class GameHandler: @@ -32,7 +34,7 @@ def __init__(self, shared_lock, shared_number_of_connections): self.debug_mode: bool = False self.shared_lock = shared_lock self.shared_number_of_connections = shared_number_of_connections - self.logger: logging.Logger = setup_logger("Agent", "logs/Agent.log", console_level=console_logging_level, file_level=file_logging_level) + self.logger: logging.Logger = setup_logger("Agent", log_dir, console_level=console_logging_level, file_level=file_logging_level) def GetPlayerActions(self, state: State): self.logger.debug(f"================================= cycle={state.world_model.cycle}.{state.world_model.stoped_cycle} =================================") @@ -145,7 +147,7 @@ def Register(self, register_request: RegisterRequest): uniform_number = register_request.uniform_number agent_type = register_request.agent_type self.logger: logging.Logger = setup_logger(f"Agent{register_request.uniform_number}-{self.shared_number_of_connections.value}", - f"logs/Agent{register_request.uniform_number}-{self.shared_number_of_connections.value}.log", + log_dir, console_level=console_logging_level, file_level=file_logging_level) res = RegisterResponse(client_id=self.shared_number_of_connections.value, team_name=team_name, @@ -187,12 +189,18 @@ def serve(port, shared_lock, shared_number_of_connections): def main(): + global main_logger, log_dir manager = Manager() shared_lock = Lock() # Create a Lock for synchronization shared_number_of_connections = manager.Value('i', 0) parser = argparse.ArgumentParser(description='Run play maker server') parser.add_argument('-p', '--rpc-port', required=False, help='The port of the server', default=50051) + parser.add_argument('-l', '--log-dir', required=False, help='The directory of the log file', + default=f'logs/{datetime.datetime.now().strftime("%Y-%m-%d_%H-%M-%S")}') args = parser.parse_args() + log_dir = args.log_dir + main_logger = setup_logger("pmservice", log_dir, console_level=console_logging_level, file_level=file_logging_level) + serve(args.rpc_port, shared_lock, shared_number_of_connections) diff --git a/start-team.py b/start-team.py index e9ba3d0..11e89e1 100644 --- a/start-team.py +++ b/start-team.py @@ -6,18 +6,17 @@ import argparse import check_requirements from utils.logger_utils import setup_logger - -# remove logs directory -os.system("rm -rf logs") +import datetime # Set up logging -start_team_logger = setup_logger('start-team', 'logs/start-team.log', console_level=logging.DEBUG, file_level=logging.DEBUG, console_format_str='%(message)s') +log_dir = os.path.join(os.getcwd(), 'logs', datetime.datetime.now().strftime('%Y-%m-%d_%H-%M-%S')) +start_team_logger = setup_logger('start-team', log_dir, console_level=logging.DEBUG, file_level=logging.DEBUG, console_format_str='%(message)s') def run_server_script(args): # Start the server.py script as a new process group process = subprocess.Popen( - ['python3', 'server.py', '--rpc-port', args.rpc_port], + ['python3', 'server.py', '--rpc-port', args.rpc_port, '--log-dir', log_dir], preexec_fn=os.setsid, # Create a new session and set the process group ID stdout=subprocess.PIPE, stderr=subprocess.STDOUT # Capture stderr and redirect it to stdout @@ -43,7 +42,7 @@ def stream_output_to_console(process, prefix): def stream_output_to_file(process, prefix): # Stream output from the process and log it with a prefix - logger = setup_logger(prefix, console_level=None, file_level=logging.DEBUG) + logger = setup_logger(prefix, log_dir, console_level=None, file_level=logging.DEBUG) for line in iter(process.stdout.readline, b''): logger.info(line.decode().strip()) pass @@ -78,8 +77,8 @@ def kill_process_group(process): start_team_logger.debug(f"Started start.sh process with PID: {start_process.pid} with team name {args=}") # Monitor both processes and log their outputs - server_thread = threading.Thread(target=stream_output_to_console, args=(server_process, 'server:')) - start_thread = threading.Thread(target=stream_output_to_file, args=(start_process, 'proxy:')) + server_thread = threading.Thread(target=stream_output_to_console, args=(server_process, 'server')) + start_thread = threading.Thread(target=stream_output_to_file, args=(start_process, 'proxy')) server_thread.start() start_thread.start() diff --git a/start-team.sh b/start-team.sh index 0fa559d..0f7a9b3 100755 --- a/start-team.sh +++ b/start-team.sh @@ -1,12 +1,13 @@ #!/bin/bash -# remove logs directory -rm -rf logs -# create logs directory -if [ ! -d "./logs" ]; then - mkdir -p "./logs" +# create a log directory with the current date and time +log_dir="logs/$(date +'%Y-%m-%d_%H-%M-%S')" +if [ ! -d $log_dir ]; then + mkdir -p $log_dir fi +abs_log_dir_path=$(realpath $log_dir) + # Ensure the script exits if any command fails set -e # check scripts/proxy directory does not exist, raise error @@ -60,7 +61,7 @@ python3 check_requirements.py # Start server.py in the background echo "Starting server.py..." -python3 server.py --rpc-port $rpc_port & +python3 server.py --rpc-port $rpc_port --log-dir $abs_log_dir_path & server_pid=$! # Function to kill server and team processes on exit @@ -79,16 +80,16 @@ sleep 2 # Start start.sh script in the correct directory with arguments echo "Starting start.sh with team name: $team_name and ..." -log_dir="logs/proxy.log" -abspath=$(realpath $log_dir) +start_log_path="$abs_log_dir_path/proxy.log" cd scripts/proxy if [ "$debug" = true ]; then - bash start-debug.sh -t "$team_name" --rpc-port $rpc_port --rpc-type thrift >> $abspath 2>&1 & + bash start-debug.sh -t "$team_name" --rpc-port $rpc_port --rpc-type thrift >> $start_log_path 2>&1 & else - bash start.sh -t "$team_name" --rpc-port $rpc_port --rpc-type thrift >> $abspath 2>&1 & + bash start.sh -t "$team_name" --rpc-port $rpc_port --rpc-type thrift >> $start_log_path 2>&1 & +fi fistart_pid=$! # Wait for both background processes to finish wait $server_pid -wait $start_pid +wait $start_pid \ No newline at end of file diff --git a/utils/logger_utils.py b/utils/logger_utils.py index 5f73f7d..58b8778 100644 --- a/utils/logger_utils.py +++ b/utils/logger_utils.py @@ -2,7 +2,7 @@ import os -def setup_logger(name, log_file=None, console_level=logging.INFO, file_level=logging.DEBUG, console_format_str=None, file_format_str=None): +def setup_logger(name, log_dir, console_level=logging.INFO, file_level=logging.DEBUG, console_format_str=None, file_format_str=None): """ Set up a logger that writes to both a file and the console, with different formats and levels. @@ -14,14 +14,12 @@ def setup_logger(name, log_file=None, console_level=logging.INFO, file_level=log """ have_console_handler = console_level is not None have_file_handler = file_level is not None - if log_file is None: - log_file = os.path.join('logs', f'{name}.log') - # Directory - directory = os.path.dirname(log_file) - if directory and not os.path.exists(directory): - os.makedirs(directory) + + if not os.path.exists(log_dir): + os.makedirs(log_dir) - print(f"have_console_handler={have_console_handler}, have_file_handler={have_file_handler}", log_file, directory) + log_file = os.path.join(log_dir, f'{name}.log') + # Create a custom logger logger = logging.getLogger(name) From f50dbf20d7827f265427ce87822ff3b9b8c554cb Mon Sep 17 00:00:00 2001 From: Nader Zare Date: Fri, 11 Oct 2024 22:53:24 -0300 Subject: [PATCH 7/9] Update README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 523cb15..e6a9845 100644 --- a/README.md +++ b/README.md @@ -77,6 +77,7 @@ To create a Python virtual environment and install the dependencies, you can run python3 -m venv venv source venv/bin/activate pip install -r requirements.txt +./generate.sh # To generate thrift python files ``` ## Running a game From b051bbab6f9c9ea918f0247e4825daf11cc76939 Mon Sep 17 00:00:00 2001 From: SK2iP Date: Sat, 19 Oct 2024 20:59:26 +0330 Subject: [PATCH 8/9] add version 1.4 --- idl/soccer_service.thrift | 28 ++++- soccer/ttypes.py | 259 +++++++++++++++++++++++++++++++++++++- soccer/ttypes.pyi | 30 ++++- 3 files changed, 304 insertions(+), 13 deletions(-) diff --git a/idl/soccer_service.thrift b/idl/soccer_service.thrift index 657027e..541e92b 100644 --- a/idl/soccer_service.thrift +++ b/idl/soccer_service.thrift @@ -1,4 +1,4 @@ -// version 1.1 +// version 1.4 namespace cpp soccer namespace py soccer @@ -105,6 +105,16 @@ enum CardType { RED = 2 } +struct PenaltyKickState { + 1: Side on_field_side, + 2: Side current_taker_side, + 3: i32 our_taker_counter, + 4: i32 their_taker_counter, + 5: i32 our_score, + 6: i32 their_score, + 7: bool is_kick_taker +} + struct Player { 1: RpcVector2D position, 2: RpcVector2D seen_position, @@ -178,7 +188,8 @@ struct Self { 37: double recovery, 38: double stamina_capacity, 39: CardType card, - 40: i32 catch_time + 40: i32 catch_time, + 41: double effort } enum InterceptActionType { @@ -287,7 +298,9 @@ struct WorldModel { 34: double our_defense_player_line_x, 35: double their_defense_player_line_x, 36: bool kickable_teammate_existance, - 37: bool kickable_opponent_existance + 37: bool kickable_opponent_existance, + 38: PenaltyKickState penalty_kick_state, + 39: i32 see_time } struct State { @@ -770,6 +783,8 @@ struct HeliosCommunicaion {} struct bhv_doForceKick {} +struct bhv_doHeardPassRecieve {} + struct PlayerAction { 1: optional Dash dash, 2: optional Turn turn, @@ -835,12 +850,15 @@ struct PlayerAction { 62: optional HeliosSetPlay helios_set_play, 63: optional HeliosPenalty helios_penalty, 64: optional HeliosCommunicaion helios_communication, - 65: optional bhv_doForceKick bhv_do_force_kick + 65: optional bhv_doForceKick bhv_do_force_kick, + 66: optional bhv_doHeardPassRecieve bhv_do_heard_pass_recieve } struct PlayerActions { 1: list actions, - 2: bool ignore_preprocess + 2: bool ignore_preprocess, + 3: bool ignore_doforcekick, + 4: bool ignore_doHeardPassRecieve } struct ChangePlayerType { diff --git a/soccer/ttypes.py b/soccer/ttypes.py index 64bcce8..5539eaa 100644 --- a/soccer/ttypes.py +++ b/soccer/ttypes.py @@ -876,6 +876,129 @@ def __ne__(self, other): return not (self == other) +class PenaltyKickState(object): + """ + Attributes: + - on_field_side + - current_taker_side + - our_taker_counter + - their_taker_counter + - our_score + - their_score + - is_kick_taker + + """ + + + def __init__(self, on_field_side=None, current_taker_side=None, our_taker_counter=None, their_taker_counter=None, our_score=None, their_score=None, is_kick_taker=None,): + self.on_field_side = on_field_side + self.current_taker_side = current_taker_side + self.our_taker_counter = our_taker_counter + self.their_taker_counter = their_taker_counter + self.our_score = our_score + self.their_score = their_score + self.is_kick_taker = is_kick_taker + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.I32: + self.on_field_side = iprot.readI32() + else: + iprot.skip(ftype) + elif fid == 2: + if ftype == TType.I32: + self.current_taker_side = iprot.readI32() + else: + iprot.skip(ftype) + elif fid == 3: + if ftype == TType.I32: + self.our_taker_counter = iprot.readI32() + else: + iprot.skip(ftype) + elif fid == 4: + if ftype == TType.I32: + self.their_taker_counter = iprot.readI32() + else: + iprot.skip(ftype) + elif fid == 5: + if ftype == TType.I32: + self.our_score = iprot.readI32() + else: + iprot.skip(ftype) + elif fid == 6: + if ftype == TType.I32: + self.their_score = iprot.readI32() + else: + iprot.skip(ftype) + elif fid == 7: + if ftype == TType.BOOL: + self.is_kick_taker = iprot.readBool() + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('PenaltyKickState') + if self.on_field_side is not None: + oprot.writeFieldBegin('on_field_side', TType.I32, 1) + oprot.writeI32(self.on_field_side) + oprot.writeFieldEnd() + if self.current_taker_side is not None: + oprot.writeFieldBegin('current_taker_side', TType.I32, 2) + oprot.writeI32(self.current_taker_side) + oprot.writeFieldEnd() + if self.our_taker_counter is not None: + oprot.writeFieldBegin('our_taker_counter', TType.I32, 3) + oprot.writeI32(self.our_taker_counter) + oprot.writeFieldEnd() + if self.their_taker_counter is not None: + oprot.writeFieldBegin('their_taker_counter', TType.I32, 4) + oprot.writeI32(self.their_taker_counter) + oprot.writeFieldEnd() + if self.our_score is not None: + oprot.writeFieldBegin('our_score', TType.I32, 5) + oprot.writeI32(self.our_score) + oprot.writeFieldEnd() + if self.their_score is not None: + oprot.writeFieldBegin('their_score', TType.I32, 6) + oprot.writeI32(self.their_score) + oprot.writeFieldEnd() + if self.is_kick_taker is not None: + oprot.writeFieldBegin('is_kick_taker', TType.BOOL, 7) + oprot.writeBool(self.is_kick_taker) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + + class Player(object): """ Attributes: @@ -1300,11 +1423,12 @@ class Self(object): - stamina_capacity - card - catch_time + - effort """ - def __init__(self, position=None, seen_position=None, heard_position=None, velocity=None, seen_velocity=None, pos_count=None, seen_pos_count=None, heard_pos_count=None, vel_count=None, seen_vel_count=None, ghost_count=None, id=None, side=None, uniform_number=None, uniform_number_count=None, is_goalie=None, body_direction=None, body_direction_count=None, face_direction=None, face_direction_count=None, point_to_direction=None, point_to_direction_count=None, is_kicking=None, dist_from_ball=None, angle_from_ball=None, ball_reach_steps=None, is_tackling=None, relative_neck_direction=None, stamina=None, is_kickable=None, catch_probability=None, tackle_probability=None, foul_probability=None, view_width=None, type_id=None, kick_rate=None, recovery=None, stamina_capacity=None, card=None, catch_time=None,): + def __init__(self, position=None, seen_position=None, heard_position=None, velocity=None, seen_velocity=None, pos_count=None, seen_pos_count=None, heard_pos_count=None, vel_count=None, seen_vel_count=None, ghost_count=None, id=None, side=None, uniform_number=None, uniform_number_count=None, is_goalie=None, body_direction=None, body_direction_count=None, face_direction=None, face_direction_count=None, point_to_direction=None, point_to_direction_count=None, is_kicking=None, dist_from_ball=None, angle_from_ball=None, ball_reach_steps=None, is_tackling=None, relative_neck_direction=None, stamina=None, is_kickable=None, catch_probability=None, tackle_probability=None, foul_probability=None, view_width=None, type_id=None, kick_rate=None, recovery=None, stamina_capacity=None, card=None, catch_time=None, effort=None,): self.position = position self.seen_position = seen_position self.heard_position = heard_position @@ -1345,6 +1469,7 @@ def __init__(self, position=None, seen_position=None, heard_position=None, veloc self.stamina_capacity = stamina_capacity self.card = card self.catch_time = catch_time + self.effort = effort def read(self, iprot): if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: @@ -1560,6 +1685,11 @@ def read(self, iprot): self.catch_time = iprot.readI32() else: iprot.skip(ftype) + elif fid == 41: + if ftype == TType.DOUBLE: + self.effort = iprot.readDouble() + else: + iprot.skip(ftype) else: iprot.skip(ftype) iprot.readFieldEnd() @@ -1730,6 +1860,10 @@ def write(self, oprot): oprot.writeFieldBegin('catch_time', TType.I32, 40) oprot.writeI32(self.catch_time) oprot.writeFieldEnd() + if self.effort is not None: + oprot.writeFieldBegin('effort', TType.DOUBLE, 41) + oprot.writeDouble(self.effort) + oprot.writeFieldEnd() oprot.writeFieldStop() oprot.writeStructEnd() @@ -2110,11 +2244,13 @@ class WorldModel(object): - their_defense_player_line_x - kickable_teammate_existance - kickable_opponent_existance + - penalty_kick_state + - see_time """ - def __init__(self, intercept_table=None, our_team_name=None, their_team_name=None, our_side=None, last_set_play_start_time=None, myself=None, ball=None, teammates=None, opponents=None, unknowns=None, our_players_dict=None, their_players_dict=None, our_goalie_uniform_number=None, their_goalie_uniform_number=None, offside_line_x=None, offside_line_x_count=None, kickable_teammate_id=None, kickable_opponent_id=None, last_kick_side=None, last_kicker_uniform_number=None, cycle=None, game_mode_type=None, left_team_score=None, right_team_score=None, is_our_set_play=None, is_their_set_play=None, stoped_cycle=None, our_team_score=None, their_team_score=None, is_penalty_kick_mode=None, helios_home_positions=None, our_defense_line_x=None, their_defense_line_x=None, our_defense_player_line_x=None, their_defense_player_line_x=None, kickable_teammate_existance=None, kickable_opponent_existance=None,): + def __init__(self, intercept_table=None, our_team_name=None, their_team_name=None, our_side=None, last_set_play_start_time=None, myself=None, ball=None, teammates=None, opponents=None, unknowns=None, our_players_dict=None, their_players_dict=None, our_goalie_uniform_number=None, their_goalie_uniform_number=None, offside_line_x=None, offside_line_x_count=None, kickable_teammate_id=None, kickable_opponent_id=None, last_kick_side=None, last_kicker_uniform_number=None, cycle=None, game_mode_type=None, left_team_score=None, right_team_score=None, is_our_set_play=None, is_their_set_play=None, stoped_cycle=None, our_team_score=None, their_team_score=None, is_penalty_kick_mode=None, helios_home_positions=None, our_defense_line_x=None, their_defense_line_x=None, our_defense_player_line_x=None, their_defense_player_line_x=None, kickable_teammate_existance=None, kickable_opponent_existance=None, penalty_kick_state=None, see_time=None,): self.intercept_table = intercept_table self.our_team_name = our_team_name self.their_team_name = their_team_name @@ -2152,6 +2288,8 @@ def __init__(self, intercept_table=None, our_team_name=None, their_team_name=Non self.their_defense_player_line_x = their_defense_player_line_x self.kickable_teammate_existance = kickable_teammate_existance self.kickable_opponent_existance = kickable_opponent_existance + self.penalty_kick_state = penalty_kick_state + self.see_time = see_time def read(self, iprot): if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: @@ -2389,6 +2527,17 @@ def read(self, iprot): self.kickable_opponent_existance = iprot.readBool() else: iprot.skip(ftype) + elif fid == 38: + if ftype == TType.STRUCT: + self.penalty_kick_state = PenaltyKickState() + self.penalty_kick_state.read(iprot) + else: + iprot.skip(ftype) + elif fid == 39: + if ftype == TType.I32: + self.see_time = iprot.readI32() + else: + iprot.skip(ftype) else: iprot.skip(ftype) iprot.readFieldEnd() @@ -2568,6 +2717,14 @@ def write(self, oprot): oprot.writeFieldBegin('kickable_opponent_existance', TType.BOOL, 37) oprot.writeBool(self.kickable_opponent_existance) oprot.writeFieldEnd() + if self.penalty_kick_state is not None: + oprot.writeFieldBegin('penalty_kick_state', TType.STRUCT, 38) + self.penalty_kick_state.write(oprot) + oprot.writeFieldEnd() + if self.see_time is not None: + oprot.writeFieldBegin('see_time', TType.I32, 39) + oprot.writeI32(self.see_time) + oprot.writeFieldEnd() oprot.writeFieldStop() oprot.writeStructEnd() @@ -9366,6 +9523,46 @@ def __ne__(self, other): return not (self == other) +class bhv_doHeardPassRecieve(object): + + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('bhv_doHeardPassRecieve') + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + + class PlayerAction(object): """ Attributes: @@ -9434,11 +9631,12 @@ class PlayerAction(object): - helios_penalty - helios_communication - bhv_do_force_kick + - bhv_do_heard_pass_recieve """ - def __init__(self, dash=None, turn=None, kick=None, tackle=None, catch_action=None, move=None, turn_neck=None, change_view=None, say=None, point_to=None, point_to_of=None, attention_to=None, attention_to_of=None, log=None, debug_client=None, body_go_to_point=None, body_smart_kick=None, bhv_before_kick_off=None, bhv_body_neck_to_ball=None, bhv_body_neck_to_point=None, bhv_emergency=None, bhv_go_to_point_look_ball=None, bhv_neck_body_to_ball=None, bhv_neck_body_to_point=None, bhv_scan_field=None, body_advance_ball=None, body_clear_ball=None, body_dribble=None, body_go_to_point_dodge=None, body_hold_ball=None, body_intercept=None, body_kick_one_step=None, body_stop_ball=None, body_stop_dash=None, body_tackle_to_point=None, body_turn_to_angle=None, body_turn_to_ball=None, body_turn_to_point=None, focus_move_to_point=None, focus_reset=None, neck_scan_field=None, neck_scan_players=None, neck_turn_to_ball_and_player=None, neck_turn_to_ball_or_scan=None, neck_turn_to_ball=None, neck_turn_to_goalie_or_scan=None, neck_turn_to_low_conf_teammate=None, neck_turn_to_player_or_scan=None, neck_turn_to_point=None, neck_turn_to_relative=None, view_change_width=None, view_normal=None, view_synch=None, view_wide=None, helios_goalie=None, helios_goalie_move=None, helios_goalie_kick=None, helios_shoot=None, helios_offensive_planner=None, helios_basic_offensive=None, helios_basic_move=None, helios_set_play=None, helios_penalty=None, helios_communication=None, bhv_do_force_kick=None,): + def __init__(self, dash=None, turn=None, kick=None, tackle=None, catch_action=None, move=None, turn_neck=None, change_view=None, say=None, point_to=None, point_to_of=None, attention_to=None, attention_to_of=None, log=None, debug_client=None, body_go_to_point=None, body_smart_kick=None, bhv_before_kick_off=None, bhv_body_neck_to_ball=None, bhv_body_neck_to_point=None, bhv_emergency=None, bhv_go_to_point_look_ball=None, bhv_neck_body_to_ball=None, bhv_neck_body_to_point=None, bhv_scan_field=None, body_advance_ball=None, body_clear_ball=None, body_dribble=None, body_go_to_point_dodge=None, body_hold_ball=None, body_intercept=None, body_kick_one_step=None, body_stop_ball=None, body_stop_dash=None, body_tackle_to_point=None, body_turn_to_angle=None, body_turn_to_ball=None, body_turn_to_point=None, focus_move_to_point=None, focus_reset=None, neck_scan_field=None, neck_scan_players=None, neck_turn_to_ball_and_player=None, neck_turn_to_ball_or_scan=None, neck_turn_to_ball=None, neck_turn_to_goalie_or_scan=None, neck_turn_to_low_conf_teammate=None, neck_turn_to_player_or_scan=None, neck_turn_to_point=None, neck_turn_to_relative=None, view_change_width=None, view_normal=None, view_synch=None, view_wide=None, helios_goalie=None, helios_goalie_move=None, helios_goalie_kick=None, helios_shoot=None, helios_offensive_planner=None, helios_basic_offensive=None, helios_basic_move=None, helios_set_play=None, helios_penalty=None, helios_communication=None, bhv_do_force_kick=None, bhv_do_heard_pass_recieve=None,): self.dash = dash self.turn = turn self.kick = kick @@ -9504,6 +9702,7 @@ def __init__(self, dash=None, turn=None, kick=None, tackle=None, catch_action=No self.helios_penalty = helios_penalty self.helios_communication = helios_communication self.bhv_do_force_kick = bhv_do_force_kick + self.bhv_do_heard_pass_recieve = bhv_do_heard_pass_recieve def read(self, iprot): if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: @@ -9904,6 +10103,12 @@ def read(self, iprot): self.bhv_do_force_kick.read(iprot) else: iprot.skip(ftype) + elif fid == 66: + if ftype == TType.STRUCT: + self.bhv_do_heard_pass_recieve = bhv_doHeardPassRecieve() + self.bhv_do_heard_pass_recieve.read(iprot) + else: + iprot.skip(ftype) else: iprot.skip(ftype) iprot.readFieldEnd() @@ -10174,6 +10379,10 @@ def write(self, oprot): oprot.writeFieldBegin('bhv_do_force_kick', TType.STRUCT, 65) self.bhv_do_force_kick.write(oprot) oprot.writeFieldEnd() + if self.bhv_do_heard_pass_recieve is not None: + oprot.writeFieldBegin('bhv_do_heard_pass_recieve', TType.STRUCT, 66) + self.bhv_do_heard_pass_recieve.write(oprot) + oprot.writeFieldEnd() oprot.writeFieldStop() oprot.writeStructEnd() @@ -10197,13 +10406,17 @@ class PlayerActions(object): Attributes: - actions - ignore_preprocess + - ignore_doforcekick + - ignore_doHeardPassRecieve """ - def __init__(self, actions=None, ignore_preprocess=None,): + def __init__(self, actions=None, ignore_preprocess=None, ignore_doforcekick=None, ignore_doHeardPassRecieve=None,): self.actions = actions self.ignore_preprocess = ignore_preprocess + self.ignore_doforcekick = ignore_doforcekick + self.ignore_doHeardPassRecieve = ignore_doHeardPassRecieve def read(self, iprot): if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: @@ -10230,6 +10443,16 @@ def read(self, iprot): self.ignore_preprocess = iprot.readBool() else: iprot.skip(ftype) + elif fid == 3: + if ftype == TType.BOOL: + self.ignore_doforcekick = iprot.readBool() + else: + iprot.skip(ftype) + elif fid == 4: + if ftype == TType.BOOL: + self.ignore_doHeardPassRecieve = iprot.readBool() + else: + iprot.skip(ftype) else: iprot.skip(ftype) iprot.readFieldEnd() @@ -10251,6 +10474,14 @@ def write(self, oprot): oprot.writeFieldBegin('ignore_preprocess', TType.BOOL, 2) oprot.writeBool(self.ignore_preprocess) oprot.writeFieldEnd() + if self.ignore_doforcekick is not None: + oprot.writeFieldBegin('ignore_doforcekick', TType.BOOL, 3) + oprot.writeBool(self.ignore_doforcekick) + oprot.writeFieldEnd() + if self.ignore_doHeardPassRecieve is not None: + oprot.writeFieldBegin('ignore_doHeardPassRecieve', TType.BOOL, 4) + oprot.writeBool(self.ignore_doHeardPassRecieve) + oprot.writeFieldEnd() oprot.writeFieldStop() oprot.writeStructEnd() @@ -15075,6 +15306,17 @@ def __ne__(self, other): (16, TType.DOUBLE, 'dist_from_self', None, None, ), # 16 (17, TType.DOUBLE, 'angle_from_self', None, None, ), # 17 ) +all_structs.append(PenaltyKickState) +PenaltyKickState.thrift_spec = ( + None, # 0 + (1, TType.I32, 'on_field_side', None, None, ), # 1 + (2, TType.I32, 'current_taker_side', None, None, ), # 2 + (3, TType.I32, 'our_taker_counter', None, None, ), # 3 + (4, TType.I32, 'their_taker_counter', None, None, ), # 4 + (5, TType.I32, 'our_score', None, None, ), # 5 + (6, TType.I32, 'their_score', None, None, ), # 6 + (7, TType.BOOL, 'is_kick_taker', None, None, ), # 7 +) all_structs.append(Player) Player.thrift_spec = ( None, # 0 @@ -15152,6 +15394,7 @@ def __ne__(self, other): (38, TType.DOUBLE, 'stamina_capacity', None, None, ), # 38 (39, TType.I32, 'card', None, None, ), # 39 (40, TType.I32, 'catch_time', None, None, ), # 40 + (41, TType.DOUBLE, 'effort', None, None, ), # 41 ) all_structs.append(InterceptInfo) InterceptInfo.thrift_spec = ( @@ -15221,6 +15464,8 @@ def __ne__(self, other): (35, TType.DOUBLE, 'their_defense_player_line_x', None, None, ), # 35 (36, TType.BOOL, 'kickable_teammate_existance', None, None, ), # 36 (37, TType.BOOL, 'kickable_opponent_existance', None, None, ), # 37 + (38, TType.STRUCT, 'penalty_kick_state', [PenaltyKickState, None], None, ), # 38 + (39, TType.I32, 'see_time', None, None, ), # 39 ) all_structs.append(State) State.thrift_spec = ( @@ -15800,6 +16045,9 @@ def __ne__(self, other): all_structs.append(bhv_doForceKick) bhv_doForceKick.thrift_spec = ( ) +all_structs.append(bhv_doHeardPassRecieve) +bhv_doHeardPassRecieve.thrift_spec = ( +) all_structs.append(PlayerAction) PlayerAction.thrift_spec = ( None, # 0 @@ -15868,12 +16116,15 @@ def __ne__(self, other): (63, TType.STRUCT, 'helios_penalty', [HeliosPenalty, None], None, ), # 63 (64, TType.STRUCT, 'helios_communication', [HeliosCommunicaion, None], None, ), # 64 (65, TType.STRUCT, 'bhv_do_force_kick', [bhv_doForceKick, None], None, ), # 65 + (66, TType.STRUCT, 'bhv_do_heard_pass_recieve', [bhv_doHeardPassRecieve, None], None, ), # 66 ) all_structs.append(PlayerActions) PlayerActions.thrift_spec = ( None, # 0 (1, TType.LIST, 'actions', (TType.STRUCT, [PlayerAction, None], False), None, ), # 1 (2, TType.BOOL, 'ignore_preprocess', None, None, ), # 2 + (3, TType.BOOL, 'ignore_doforcekick', None, None, ), # 3 + (4, TType.BOOL, 'ignore_doHeardPassRecieve', None, None, ), # 4 ) all_structs.append(ChangePlayerType) ChangePlayerType.thrift_spec = ( diff --git a/soccer/ttypes.pyi b/soccer/ttypes.pyi index 9211d4a..b99807c 100644 --- a/soccer/ttypes.pyi +++ b/soccer/ttypes.pyi @@ -102,6 +102,17 @@ class CardType(Enum): YELLOW = auto() RED = auto() +class PenaltyKickState(object): + def __init__(self, on_field_side: Side = None, current_taker_side: Side = None, our_taker_counter: int = None, their_taker_counter: int = None, our_score: int = None, their_score: int = None, is_kick_taker: bool = None): + pass + on_field_side: Side + current_taker_side: Side + our_taker_counter: int + their_taker_counter: int + our_score: int + their_score: int + is_kick_taker: bool + class Player(object): def __init__(self, position: RpcVector2D = None, seen_position: RpcVector2D = None, heard_position: RpcVector2D = None, velocity: RpcVector2D = None, seen_velocity: RpcVector2D = None, pos_count: int = None, seen_pos_count: int = None, heard_pos_count: int = None, vel_count: int = None, seen_vel_count: int = None, ghost_count: int = None, dist_from_self: float = None, angle_from_self: float = None, id: int = None, side: Side = None, uniform_number: int = None, uniform_number_count: int = None, is_goalie: bool = None, body_direction: float = None, body_direction_count: int = None, face_direction: float = None, face_direction_count: int = None, point_to_direction: float = None, point_to_direction_count: int = None, is_kicking: bool = None, dist_from_ball: float = None, angle_from_ball: float = None, ball_reach_steps: int = None, is_tackling: bool = None, type_id: int = None): pass @@ -137,7 +148,7 @@ class Player(object): type_id: int class Self(object): - def __init__(self, position: RpcVector2D = None, seen_position: RpcVector2D = None, heard_position: RpcVector2D = None, velocity: RpcVector2D = None, seen_velocity: RpcVector2D = None, pos_count: int = None, seen_pos_count: int = None, heard_pos_count: int = None, vel_count: int = None, seen_vel_count: int = None, ghost_count: int = None, id: int = None, side: Side = None, uniform_number: int = None, uniform_number_count: int = None, is_goalie: bool = None, body_direction: float = None, body_direction_count: int = None, face_direction: float = None, face_direction_count: int = None, point_to_direction: float = None, point_to_direction_count: int = None, is_kicking: bool = None, dist_from_ball: float = None, angle_from_ball: float = None, ball_reach_steps: int = None, is_tackling: bool = None, relative_neck_direction: float = None, stamina: float = None, is_kickable: bool = None, catch_probability: float = None, tackle_probability: float = None, foul_probability: float = None, view_width: ViewWidth = None, type_id: int = None, kick_rate: float = None, recovery: float = None, stamina_capacity: float = None, card: CardType = None, catch_time: int = None): + def __init__(self, position: RpcVector2D = None, seen_position: RpcVector2D = None, heard_position: RpcVector2D = None, velocity: RpcVector2D = None, seen_velocity: RpcVector2D = None, pos_count: int = None, seen_pos_count: int = None, heard_pos_count: int = None, vel_count: int = None, seen_vel_count: int = None, ghost_count: int = None, id: int = None, side: Side = None, uniform_number: int = None, uniform_number_count: int = None, is_goalie: bool = None, body_direction: float = None, body_direction_count: int = None, face_direction: float = None, face_direction_count: int = None, point_to_direction: float = None, point_to_direction_count: int = None, is_kicking: bool = None, dist_from_ball: float = None, angle_from_ball: float = None, ball_reach_steps: int = None, is_tackling: bool = None, relative_neck_direction: float = None, stamina: float = None, is_kickable: bool = None, catch_probability: float = None, tackle_probability: float = None, foul_probability: float = None, view_width: ViewWidth = None, type_id: int = None, kick_rate: float = None, recovery: float = None, stamina_capacity: float = None, card: CardType = None, catch_time: int = None, effort: float = None): pass position: RpcVector2D seen_position: RpcVector2D @@ -179,6 +190,7 @@ class Self(object): stamina_capacity: float card: CardType catch_time: int + effort: float class InterceptActionType(Enum): UNKNOWN_Intercept_Action_Type = auto() @@ -250,7 +262,7 @@ class GameModeType(Enum): MODE_MAX = auto() class WorldModel(object): - def __init__(self, intercept_table: InterceptTable = None, our_team_name: str = None, their_team_name: str = None, our_side: Side = None, last_set_play_start_time: int = None, myself: Self = None, ball: Ball = None, teammates: List[Player] = None, opponents: List[Player] = None, unknowns: List[Player] = None, our_players_dict: Dict[int, Player] = None, their_players_dict: Dict[int, Player] = None, our_goalie_uniform_number: int = None, their_goalie_uniform_number: int = None, offside_line_x: float = None, offside_line_x_count: int = None, kickable_teammate_id: int = None, kickable_opponent_id: int = None, last_kick_side: Side = None, last_kicker_uniform_number: int = None, cycle: int = None, game_mode_type: GameModeType = None, left_team_score: int = None, right_team_score: int = None, is_our_set_play: bool = None, is_their_set_play: bool = None, stoped_cycle: int = None, our_team_score: int = None, their_team_score: int = None, is_penalty_kick_mode: bool = None, helios_home_positions: Dict[int, RpcVector2D] = None, our_defense_line_x: float = None, their_defense_line_x: float = None, our_defense_player_line_x: float = None, their_defense_player_line_x: float = None, kickable_teammate_existance: bool = None, kickable_opponent_existance: bool = None): + def __init__(self, intercept_table: InterceptTable = None, our_team_name: str = None, their_team_name: str = None, our_side: Side = None, last_set_play_start_time: int = None, myself: Self = None, ball: Ball = None, teammates: List[Player] = None, opponents: List[Player] = None, unknowns: List[Player] = None, our_players_dict: Dict[int, Player] = None, their_players_dict: Dict[int, Player] = None, our_goalie_uniform_number: int = None, their_goalie_uniform_number: int = None, offside_line_x: float = None, offside_line_x_count: int = None, kickable_teammate_id: int = None, kickable_opponent_id: int = None, last_kick_side: Side = None, last_kicker_uniform_number: int = None, cycle: int = None, game_mode_type: GameModeType = None, left_team_score: int = None, right_team_score: int = None, is_our_set_play: bool = None, is_their_set_play: bool = None, stoped_cycle: int = None, our_team_score: int = None, their_team_score: int = None, is_penalty_kick_mode: bool = None, helios_home_positions: Dict[int, RpcVector2D] = None, our_defense_line_x: float = None, their_defense_line_x: float = None, our_defense_player_line_x: float = None, their_defense_player_line_x: float = None, kickable_teammate_existance: bool = None, kickable_opponent_existance: bool = None, penalty_kick_state: PenaltyKickState = None, see_time: int = None): pass intercept_table: InterceptTable our_team_name: str @@ -289,6 +301,8 @@ class WorldModel(object): their_defense_player_line_x: float kickable_teammate_existance: bool kickable_opponent_existance: bool + penalty_kick_state: PenaltyKickState + see_time: int class State(object): def __init__(self, register_response: RegisterResponse = None, world_model: WorldModel = None, full_world_model: WorldModel = None, need_preprocess: bool = None): @@ -924,8 +938,13 @@ class bhv_doForceKick(object): pass pass +class bhv_doHeardPassRecieve(object): + def __init__(self, ): + pass + pass + class PlayerAction(object): - def __init__(self, dash: Dash = None, turn: Turn = None, kick: Kick = None, tackle: Tackle = None, catch_action: Catch = None, move: Move = None, turn_neck: TurnNeck = None, change_view: ChangeView = None, say: Say = None, point_to: PointTo = None, point_to_of: PointToOf = None, attention_to: AttentionTo = None, attention_to_of: AttentionToOf = None, log: Log = None, debug_client: DebugClient = None, body_go_to_point: Body_GoToPoint = None, body_smart_kick: Body_SmartKick = None, bhv_before_kick_off: Bhv_BeforeKickOff = None, bhv_body_neck_to_ball: Bhv_BodyNeckToBall = None, bhv_body_neck_to_point: Bhv_BodyNeckToPoint = None, bhv_emergency: Bhv_Emergency = None, bhv_go_to_point_look_ball: Bhv_GoToPointLookBall = None, bhv_neck_body_to_ball: Bhv_NeckBodyToBall = None, bhv_neck_body_to_point: Bhv_NeckBodyToPoint = None, bhv_scan_field: Bhv_ScanField = None, body_advance_ball: Body_AdvanceBall = None, body_clear_ball: Body_ClearBall = None, body_dribble: Body_Dribble = None, body_go_to_point_dodge: Body_GoToPointDodge = None, body_hold_ball: Body_HoldBall = None, body_intercept: Body_Intercept = None, body_kick_one_step: Body_KickOneStep = None, body_stop_ball: Body_StopBall = None, body_stop_dash: Body_StopDash = None, body_tackle_to_point: Body_TackleToPoint = None, body_turn_to_angle: Body_TurnToAngle = None, body_turn_to_ball: Body_TurnToBall = None, body_turn_to_point: Body_TurnToPoint = None, focus_move_to_point: Focus_MoveToPoint = None, focus_reset: Focus_Reset = None, neck_scan_field: Neck_ScanField = None, neck_scan_players: Neck_ScanPlayers = None, neck_turn_to_ball_and_player: Neck_TurnToBallAndPlayer = None, neck_turn_to_ball_or_scan: Neck_TurnToBallOrScan = None, neck_turn_to_ball: Neck_TurnToBall = None, neck_turn_to_goalie_or_scan: Neck_TurnToGoalieOrScan = None, neck_turn_to_low_conf_teammate: Neck_TurnToLowConfTeammate = None, neck_turn_to_player_or_scan: Neck_TurnToPlayerOrScan = None, neck_turn_to_point: Neck_TurnToPoint = None, neck_turn_to_relative: Neck_TurnToRelative = None, view_change_width: View_ChangeWidth = None, view_normal: View_Normal = None, view_synch: View_Synch = None, view_wide: View_Wide = None, helios_goalie: HeliosGoalie = None, helios_goalie_move: HeliosGoalieMove = None, helios_goalie_kick: HeliosGoalieKick = None, helios_shoot: HeliosShoot = None, helios_offensive_planner: HeliosOffensivePlanner = None, helios_basic_offensive: HeliosBasicOffensive = None, helios_basic_move: HeliosBasicMove = None, helios_set_play: HeliosSetPlay = None, helios_penalty: HeliosPenalty = None, helios_communication: HeliosCommunicaion = None, bhv_do_force_kick: bhv_doForceKick = None): + def __init__(self, dash: Dash = None, turn: Turn = None, kick: Kick = None, tackle: Tackle = None, catch_action: Catch = None, move: Move = None, turn_neck: TurnNeck = None, change_view: ChangeView = None, say: Say = None, point_to: PointTo = None, point_to_of: PointToOf = None, attention_to: AttentionTo = None, attention_to_of: AttentionToOf = None, log: Log = None, debug_client: DebugClient = None, body_go_to_point: Body_GoToPoint = None, body_smart_kick: Body_SmartKick = None, bhv_before_kick_off: Bhv_BeforeKickOff = None, bhv_body_neck_to_ball: Bhv_BodyNeckToBall = None, bhv_body_neck_to_point: Bhv_BodyNeckToPoint = None, bhv_emergency: Bhv_Emergency = None, bhv_go_to_point_look_ball: Bhv_GoToPointLookBall = None, bhv_neck_body_to_ball: Bhv_NeckBodyToBall = None, bhv_neck_body_to_point: Bhv_NeckBodyToPoint = None, bhv_scan_field: Bhv_ScanField = None, body_advance_ball: Body_AdvanceBall = None, body_clear_ball: Body_ClearBall = None, body_dribble: Body_Dribble = None, body_go_to_point_dodge: Body_GoToPointDodge = None, body_hold_ball: Body_HoldBall = None, body_intercept: Body_Intercept = None, body_kick_one_step: Body_KickOneStep = None, body_stop_ball: Body_StopBall = None, body_stop_dash: Body_StopDash = None, body_tackle_to_point: Body_TackleToPoint = None, body_turn_to_angle: Body_TurnToAngle = None, body_turn_to_ball: Body_TurnToBall = None, body_turn_to_point: Body_TurnToPoint = None, focus_move_to_point: Focus_MoveToPoint = None, focus_reset: Focus_Reset = None, neck_scan_field: Neck_ScanField = None, neck_scan_players: Neck_ScanPlayers = None, neck_turn_to_ball_and_player: Neck_TurnToBallAndPlayer = None, neck_turn_to_ball_or_scan: Neck_TurnToBallOrScan = None, neck_turn_to_ball: Neck_TurnToBall = None, neck_turn_to_goalie_or_scan: Neck_TurnToGoalieOrScan = None, neck_turn_to_low_conf_teammate: Neck_TurnToLowConfTeammate = None, neck_turn_to_player_or_scan: Neck_TurnToPlayerOrScan = None, neck_turn_to_point: Neck_TurnToPoint = None, neck_turn_to_relative: Neck_TurnToRelative = None, view_change_width: View_ChangeWidth = None, view_normal: View_Normal = None, view_synch: View_Synch = None, view_wide: View_Wide = None, helios_goalie: HeliosGoalie = None, helios_goalie_move: HeliosGoalieMove = None, helios_goalie_kick: HeliosGoalieKick = None, helios_shoot: HeliosShoot = None, helios_offensive_planner: HeliosOffensivePlanner = None, helios_basic_offensive: HeliosBasicOffensive = None, helios_basic_move: HeliosBasicMove = None, helios_set_play: HeliosSetPlay = None, helios_penalty: HeliosPenalty = None, helios_communication: HeliosCommunicaion = None, bhv_do_force_kick: bhv_doForceKick = None, bhv_do_heard_pass_recieve: bhv_doHeardPassRecieve = None): pass dash: Dash turn: Turn @@ -992,12 +1011,15 @@ class PlayerAction(object): helios_penalty: HeliosPenalty helios_communication: HeliosCommunicaion bhv_do_force_kick: bhv_doForceKick + bhv_do_heard_pass_recieve: bhv_doHeardPassRecieve class PlayerActions(object): - def __init__(self, actions: List[PlayerAction] = None, ignore_preprocess: bool = None): + def __init__(self, actions: List[PlayerAction] = None, ignore_preprocess: bool = None, ignore_doforcekick: bool = None, ignore_doHeardPassRecieve: bool = None): pass actions: List[PlayerAction] ignore_preprocess: bool + ignore_doforcekick: bool + ignore_doHeardPassRecieve: bool class ChangePlayerType(object): def __init__(self, uniform_number: int = None, type: int = None): From 475d8bc4b1ec5e6c71454d4647cae54389d45a1f Mon Sep 17 00:00:00 2001 From: SK2iP Date: Sun, 20 Oct 2024 00:54:06 +0330 Subject: [PATCH 9/9] add version 1.6 and __init__ for utils --- idl/soccer_service.thrift | 16 ++++--- server.py | 4 +- soccer/ttypes.py | 88 ++++++++++++++++++++++++++++++++++++++- soccer/ttypes.pyi | 11 ++++- utils/__init__.py | 0 5 files changed, 108 insertions(+), 11 deletions(-) create mode 100644 utils/__init__.py diff --git a/idl/soccer_service.thrift b/idl/soccer_service.thrift index 541e92b..d57aa95 100644 --- a/idl/soccer_service.thrift +++ b/idl/soccer_service.thrift @@ -1,4 +1,4 @@ -// version 1.4 +// version 1.6 namespace cpp soccer namespace py soccer @@ -300,7 +300,10 @@ struct WorldModel { 36: bool kickable_teammate_existance, 37: bool kickable_opponent_existance, 38: PenaltyKickState penalty_kick_state, - 39: i32 see_time + 39: i32 see_time, + 40: i32 time_stopped, + 41: i32 set_play_count, + 42: Side game_mode_side } struct State { @@ -1142,7 +1145,11 @@ struct ServerParam { 219: double their_penalty_area_line_x, 220: double penalty_area_half_width, 221: double penalty_area_length, - 222: double goal_width + 222: double goal_width, + 223: double goal_area_width, + 224: double goal_area_length, + 225: double center_circle_r, + 226: double goal_post_radius } struct PlayerParam { @@ -1282,5 +1289,4 @@ service Game { RegisterResponse Register(1: RegisterRequest request), Empty SendByeCommand(1: RegisterResponse register_response), BestPlannerActionResponse GetBestPlannerAction(1: BestPlannerActionRequest best_planner_action_request) -} - +} \ No newline at end of file diff --git a/server.py b/server.py index 815cc7e..db7d7e2 100644 --- a/server.py +++ b/server.py @@ -53,7 +53,7 @@ def GetPlayerActions(self, state: State): simple_shoot=True, simple_dribble=True, cross=True, - server_side_decision=False))) + server_side_decision=True))) actions.append(PlayerAction(helios_shoot=HeliosShoot())) else: actions.append(PlayerAction(helios_basic_move=HeliosBasicMove())) @@ -162,7 +162,7 @@ def SendByeCommand(self, register_response: RegisterResponse): res = Empty() return res def GetBestPlannerAction(self, pairs: BestPlannerActionRequest): - self.logger.debug(f"GetBestPlannerAction cycle:{pairs.state.world_model.cycle} pairs:{len(pairs.pairs)} unum:{pairs.register_response.uniform_number}") + self.logger.debug(f"GetBestPlannerAction cycle:{pairs.state.world_model.cycle} pairs:{len(pairs.pairs)} unum:{pairs.state.register_response.uniform_number}") pairs_list: list[int, RpcActionState] = [(k, v) for k, v in pairs.pairs.items()] pairs_list.sort(key=lambda x: x[0]) best_action = max(pairs_list, key=lambda x: -1000 if x[1].action.parent_index != -1 else x[1].predict_state.ball_position.x) diff --git a/soccer/ttypes.py b/soccer/ttypes.py index 5539eaa..3608be0 100644 --- a/soccer/ttypes.py +++ b/soccer/ttypes.py @@ -2246,11 +2246,14 @@ class WorldModel(object): - kickable_opponent_existance - penalty_kick_state - see_time + - time_stopped + - set_play_count + - game_mode_side """ - def __init__(self, intercept_table=None, our_team_name=None, their_team_name=None, our_side=None, last_set_play_start_time=None, myself=None, ball=None, teammates=None, opponents=None, unknowns=None, our_players_dict=None, their_players_dict=None, our_goalie_uniform_number=None, their_goalie_uniform_number=None, offside_line_x=None, offside_line_x_count=None, kickable_teammate_id=None, kickable_opponent_id=None, last_kick_side=None, last_kicker_uniform_number=None, cycle=None, game_mode_type=None, left_team_score=None, right_team_score=None, is_our_set_play=None, is_their_set_play=None, stoped_cycle=None, our_team_score=None, their_team_score=None, is_penalty_kick_mode=None, helios_home_positions=None, our_defense_line_x=None, their_defense_line_x=None, our_defense_player_line_x=None, their_defense_player_line_x=None, kickable_teammate_existance=None, kickable_opponent_existance=None, penalty_kick_state=None, see_time=None,): + def __init__(self, intercept_table=None, our_team_name=None, their_team_name=None, our_side=None, last_set_play_start_time=None, myself=None, ball=None, teammates=None, opponents=None, unknowns=None, our_players_dict=None, their_players_dict=None, our_goalie_uniform_number=None, their_goalie_uniform_number=None, offside_line_x=None, offside_line_x_count=None, kickable_teammate_id=None, kickable_opponent_id=None, last_kick_side=None, last_kicker_uniform_number=None, cycle=None, game_mode_type=None, left_team_score=None, right_team_score=None, is_our_set_play=None, is_their_set_play=None, stoped_cycle=None, our_team_score=None, their_team_score=None, is_penalty_kick_mode=None, helios_home_positions=None, our_defense_line_x=None, their_defense_line_x=None, our_defense_player_line_x=None, their_defense_player_line_x=None, kickable_teammate_existance=None, kickable_opponent_existance=None, penalty_kick_state=None, see_time=None, time_stopped=None, set_play_count=None, game_mode_side=None,): self.intercept_table = intercept_table self.our_team_name = our_team_name self.their_team_name = their_team_name @@ -2290,6 +2293,9 @@ def __init__(self, intercept_table=None, our_team_name=None, their_team_name=Non self.kickable_opponent_existance = kickable_opponent_existance self.penalty_kick_state = penalty_kick_state self.see_time = see_time + self.time_stopped = time_stopped + self.set_play_count = set_play_count + self.game_mode_side = game_mode_side def read(self, iprot): if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: @@ -2538,6 +2544,21 @@ def read(self, iprot): self.see_time = iprot.readI32() else: iprot.skip(ftype) + elif fid == 40: + if ftype == TType.I32: + self.time_stopped = iprot.readI32() + else: + iprot.skip(ftype) + elif fid == 41: + if ftype == TType.I32: + self.set_play_count = iprot.readI32() + else: + iprot.skip(ftype) + elif fid == 42: + if ftype == TType.I32: + self.game_mode_side = iprot.readI32() + else: + iprot.skip(ftype) else: iprot.skip(ftype) iprot.readFieldEnd() @@ -2725,6 +2746,18 @@ def write(self, oprot): oprot.writeFieldBegin('see_time', TType.I32, 39) oprot.writeI32(self.see_time) oprot.writeFieldEnd() + if self.time_stopped is not None: + oprot.writeFieldBegin('time_stopped', TType.I32, 40) + oprot.writeI32(self.time_stopped) + oprot.writeFieldEnd() + if self.set_play_count is not None: + oprot.writeFieldBegin('set_play_count', TType.I32, 41) + oprot.writeI32(self.set_play_count) + oprot.writeFieldEnd() + if self.game_mode_side is not None: + oprot.writeFieldBegin('game_mode_side', TType.I32, 42) + oprot.writeI32(self.game_mode_side) + oprot.writeFieldEnd() oprot.writeFieldStop() oprot.writeStructEnd() @@ -11593,11 +11626,15 @@ class ServerParam(object): - penalty_area_half_width - penalty_area_length - goal_width + - goal_area_width + - goal_area_length + - center_circle_r + - goal_post_radius """ - def __init__(self, register_response=None, inertia_moment=None, player_size=None, player_decay=None, player_rand=None, player_weight=None, player_speed_max=None, player_accel_max=None, stamina_max=None, stamina_inc_max=None, recover_init=None, recover_dec_thr=None, recover_min=None, recover_dec=None, effort_init=None, effort_dec_thr=None, effort_min=None, effort_dec=None, effort_inc_thr=None, effort_inc=None, kick_rand=None, team_actuator_noise=None, player_rand_factor_l=None, player_rand_factor_r=None, kick_rand_factor_l=None, kick_rand_factor_r=None, ball_size=None, ball_decay=None, ball_rand=None, ball_weight=None, ball_speed_max=None, ball_accel_max=None, dash_power_rate=None, kick_power_rate=None, kickable_margin=None, control_radius=None, control_radius_width=None, max_power=None, min_power=None, max_moment=None, min_moment=None, max_neck_moment=None, min_neck_moment=None, max_neck_angle=None, min_neck_angle=None, visible_angle=None, visible_distance=None, wind_dir=None, wind_force=None, wind_angle=None, wind_rand=None, kickable_area=None, catch_area_l=None, catch_area_w=None, catch_probability=None, goalie_max_moves=None, corner_kick_margin=None, offside_active_area_size=None, wind_none=None, use_wind_random=None, coach_say_count_max=None, coach_say_msg_size=None, clang_win_size=None, clang_define_win=None, clang_meta_win=None, clang_advice_win=None, clang_info_win=None, clang_mess_delay=None, clang_mess_per_cycle=None, half_time=None, simulator_step=None, send_step=None, recv_step=None, sense_body_step=None, lcm_step=None, player_say_msg_size=None, player_hear_max=None, player_hear_inc=None, player_hear_decay=None, catch_ban_cycle=None, slow_down_factor=None, use_offside=None, kickoff_offside=None, offside_kick_margin=None, audio_cut_dist=None, dist_quantize_step=None, landmark_dist_quantize_step=None, dir_quantize_step=None, dist_quantize_step_l=None, dist_quantize_step_r=None, landmark_dist_quantize_step_l=None, landmark_dist_quantize_step_r=None, dir_quantize_step_l=None, dir_quantize_step_r=None, coach_mode=None, coach_with_referee_mode=None, use_old_coach_hear=None, slowness_on_top_for_left_team=None, slowness_on_top_for_right_team=None, start_goal_l=None, start_goal_r=None, fullstate_l=None, fullstate_r=None, drop_ball_time=None, synch_mode=None, synch_offset=None, synch_micro_sleep=None, point_to_ban=None, point_to_duration=None, player_port=None, trainer_port=None, online_coach_port=None, verbose_mode=None, coach_send_vi_step=None, replay_file=None, landmark_file=None, send_comms=None, text_logging=None, game_logging=None, game_log_version=None, text_log_dir=None, game_log_dir=None, text_log_fixed_name=None, game_log_fixed_name=None, use_text_log_fixed=None, use_game_log_fixed=None, use_text_log_dated=None, use_game_log_dated=None, log_date_format=None, log_times=None, record_message=None, text_log_compression=None, game_log_compression=None, use_profile=None, tackle_dist=None, tackle_back_dist=None, tackle_width=None, tackle_exponent=None, tackle_cycles=None, tackle_power_rate=None, freeform_wait_period=None, freeform_send_period=None, free_kick_faults=None, back_passes=None, proper_goal_kicks=None, stopped_ball_vel=None, max_goal_kicks=None, clang_del_win=None, clang_rule_win=None, auto_mode=None, kick_off_wait=None, connect_wait=None, game_over_wait=None, team_l_start=None, team_r_start=None, keepaway_mode=None, keepaway_length=None, keepaway_width=None, keepaway_logging=None, keepaway_log_dir=None, keepaway_log_fixed_name=None, keepaway_log_fixed=None, keepaway_log_dated=None, keepaway_start=None, nr_normal_halfs=None, nr_extra_halfs=None, penalty_shoot_outs=None, pen_before_setup_wait=None, pen_setup_wait=None, pen_ready_wait=None, pen_taken_wait=None, pen_nr_kicks=None, pen_max_extra_kicks=None, pen_dist_x=None, pen_random_winner=None, pen_allow_mult_kicks=None, pen_max_goalie_dist_x=None, pen_coach_moves_players=None, module_dir=None, ball_stuck_area=None, coach_msg_file=None, max_tackle_power=None, max_back_tackle_power=None, player_speed_max_min=None, extra_stamina=None, synch_see_offset=None, extra_half_time=None, stamina_capacity=None, max_dash_angle=None, min_dash_angle=None, dash_angle_step=None, side_dash_rate=None, back_dash_rate=None, max_dash_power=None, min_dash_power=None, tackle_rand_factor=None, foul_detect_probability=None, foul_exponent=None, foul_cycles=None, golden_goal=None, red_card_probability=None, illegal_defense_duration=None, illegal_defense_number=None, illegal_defense_dist_x=None, illegal_defense_width=None, fixed_teamname_l=None, fixed_teamname_r=None, max_catch_angle=None, min_catch_angle=None, random_seed=None, long_kick_power_factor=None, long_kick_delay=None, max_monitors=None, catchable_area=None, real_speed_max=None, pitch_half_length=None, pitch_half_width=None, our_penalty_area_line_x=None, their_penalty_area_line_x=None, penalty_area_half_width=None, penalty_area_length=None, goal_width=None,): + def __init__(self, register_response=None, inertia_moment=None, player_size=None, player_decay=None, player_rand=None, player_weight=None, player_speed_max=None, player_accel_max=None, stamina_max=None, stamina_inc_max=None, recover_init=None, recover_dec_thr=None, recover_min=None, recover_dec=None, effort_init=None, effort_dec_thr=None, effort_min=None, effort_dec=None, effort_inc_thr=None, effort_inc=None, kick_rand=None, team_actuator_noise=None, player_rand_factor_l=None, player_rand_factor_r=None, kick_rand_factor_l=None, kick_rand_factor_r=None, ball_size=None, ball_decay=None, ball_rand=None, ball_weight=None, ball_speed_max=None, ball_accel_max=None, dash_power_rate=None, kick_power_rate=None, kickable_margin=None, control_radius=None, control_radius_width=None, max_power=None, min_power=None, max_moment=None, min_moment=None, max_neck_moment=None, min_neck_moment=None, max_neck_angle=None, min_neck_angle=None, visible_angle=None, visible_distance=None, wind_dir=None, wind_force=None, wind_angle=None, wind_rand=None, kickable_area=None, catch_area_l=None, catch_area_w=None, catch_probability=None, goalie_max_moves=None, corner_kick_margin=None, offside_active_area_size=None, wind_none=None, use_wind_random=None, coach_say_count_max=None, coach_say_msg_size=None, clang_win_size=None, clang_define_win=None, clang_meta_win=None, clang_advice_win=None, clang_info_win=None, clang_mess_delay=None, clang_mess_per_cycle=None, half_time=None, simulator_step=None, send_step=None, recv_step=None, sense_body_step=None, lcm_step=None, player_say_msg_size=None, player_hear_max=None, player_hear_inc=None, player_hear_decay=None, catch_ban_cycle=None, slow_down_factor=None, use_offside=None, kickoff_offside=None, offside_kick_margin=None, audio_cut_dist=None, dist_quantize_step=None, landmark_dist_quantize_step=None, dir_quantize_step=None, dist_quantize_step_l=None, dist_quantize_step_r=None, landmark_dist_quantize_step_l=None, landmark_dist_quantize_step_r=None, dir_quantize_step_l=None, dir_quantize_step_r=None, coach_mode=None, coach_with_referee_mode=None, use_old_coach_hear=None, slowness_on_top_for_left_team=None, slowness_on_top_for_right_team=None, start_goal_l=None, start_goal_r=None, fullstate_l=None, fullstate_r=None, drop_ball_time=None, synch_mode=None, synch_offset=None, synch_micro_sleep=None, point_to_ban=None, point_to_duration=None, player_port=None, trainer_port=None, online_coach_port=None, verbose_mode=None, coach_send_vi_step=None, replay_file=None, landmark_file=None, send_comms=None, text_logging=None, game_logging=None, game_log_version=None, text_log_dir=None, game_log_dir=None, text_log_fixed_name=None, game_log_fixed_name=None, use_text_log_fixed=None, use_game_log_fixed=None, use_text_log_dated=None, use_game_log_dated=None, log_date_format=None, log_times=None, record_message=None, text_log_compression=None, game_log_compression=None, use_profile=None, tackle_dist=None, tackle_back_dist=None, tackle_width=None, tackle_exponent=None, tackle_cycles=None, tackle_power_rate=None, freeform_wait_period=None, freeform_send_period=None, free_kick_faults=None, back_passes=None, proper_goal_kicks=None, stopped_ball_vel=None, max_goal_kicks=None, clang_del_win=None, clang_rule_win=None, auto_mode=None, kick_off_wait=None, connect_wait=None, game_over_wait=None, team_l_start=None, team_r_start=None, keepaway_mode=None, keepaway_length=None, keepaway_width=None, keepaway_logging=None, keepaway_log_dir=None, keepaway_log_fixed_name=None, keepaway_log_fixed=None, keepaway_log_dated=None, keepaway_start=None, nr_normal_halfs=None, nr_extra_halfs=None, penalty_shoot_outs=None, pen_before_setup_wait=None, pen_setup_wait=None, pen_ready_wait=None, pen_taken_wait=None, pen_nr_kicks=None, pen_max_extra_kicks=None, pen_dist_x=None, pen_random_winner=None, pen_allow_mult_kicks=None, pen_max_goalie_dist_x=None, pen_coach_moves_players=None, module_dir=None, ball_stuck_area=None, coach_msg_file=None, max_tackle_power=None, max_back_tackle_power=None, player_speed_max_min=None, extra_stamina=None, synch_see_offset=None, extra_half_time=None, stamina_capacity=None, max_dash_angle=None, min_dash_angle=None, dash_angle_step=None, side_dash_rate=None, back_dash_rate=None, max_dash_power=None, min_dash_power=None, tackle_rand_factor=None, foul_detect_probability=None, foul_exponent=None, foul_cycles=None, golden_goal=None, red_card_probability=None, illegal_defense_duration=None, illegal_defense_number=None, illegal_defense_dist_x=None, illegal_defense_width=None, fixed_teamname_l=None, fixed_teamname_r=None, max_catch_angle=None, min_catch_angle=None, random_seed=None, long_kick_power_factor=None, long_kick_delay=None, max_monitors=None, catchable_area=None, real_speed_max=None, pitch_half_length=None, pitch_half_width=None, our_penalty_area_line_x=None, their_penalty_area_line_x=None, penalty_area_half_width=None, penalty_area_length=None, goal_width=None, goal_area_width=None, goal_area_length=None, center_circle_r=None, goal_post_radius=None,): self.register_response = register_response self.inertia_moment = inertia_moment self.player_size = player_size @@ -11820,6 +11857,10 @@ def __init__(self, register_response=None, inertia_moment=None, player_size=None self.penalty_area_half_width = penalty_area_half_width self.penalty_area_length = penalty_area_length self.goal_width = goal_width + self.goal_area_width = goal_area_width + self.goal_area_length = goal_area_length + self.center_circle_r = center_circle_r + self.goal_post_radius = goal_post_radius def read(self, iprot): if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: @@ -12941,6 +12982,26 @@ def read(self, iprot): self.goal_width = iprot.readDouble() else: iprot.skip(ftype) + elif fid == 223: + if ftype == TType.DOUBLE: + self.goal_area_width = iprot.readDouble() + else: + iprot.skip(ftype) + elif fid == 224: + if ftype == TType.DOUBLE: + self.goal_area_length = iprot.readDouble() + else: + iprot.skip(ftype) + elif fid == 225: + if ftype == TType.DOUBLE: + self.center_circle_r = iprot.readDouble() + else: + iprot.skip(ftype) + elif fid == 226: + if ftype == TType.DOUBLE: + self.goal_post_radius = iprot.readDouble() + else: + iprot.skip(ftype) else: iprot.skip(ftype) iprot.readFieldEnd() @@ -13839,6 +13900,22 @@ def write(self, oprot): oprot.writeFieldBegin('goal_width', TType.DOUBLE, 222) oprot.writeDouble(self.goal_width) oprot.writeFieldEnd() + if self.goal_area_width is not None: + oprot.writeFieldBegin('goal_area_width', TType.DOUBLE, 223) + oprot.writeDouble(self.goal_area_width) + oprot.writeFieldEnd() + if self.goal_area_length is not None: + oprot.writeFieldBegin('goal_area_length', TType.DOUBLE, 224) + oprot.writeDouble(self.goal_area_length) + oprot.writeFieldEnd() + if self.center_circle_r is not None: + oprot.writeFieldBegin('center_circle_r', TType.DOUBLE, 225) + oprot.writeDouble(self.center_circle_r) + oprot.writeFieldEnd() + if self.goal_post_radius is not None: + oprot.writeFieldBegin('goal_post_radius', TType.DOUBLE, 226) + oprot.writeDouble(self.goal_post_radius) + oprot.writeFieldEnd() oprot.writeFieldStop() oprot.writeStructEnd() @@ -15466,6 +15543,9 @@ def __ne__(self, other): (37, TType.BOOL, 'kickable_opponent_existance', None, None, ), # 37 (38, TType.STRUCT, 'penalty_kick_state', [PenaltyKickState, None], None, ), # 38 (39, TType.I32, 'see_time', None, None, ), # 39 + (40, TType.I32, 'time_stopped', None, None, ), # 40 + (41, TType.I32, 'set_play_count', None, None, ), # 41 + (42, TType.I32, 'game_mode_side', None, None, ), # 42 ) all_structs.append(State) State.thrift_spec = ( @@ -16423,6 +16503,10 @@ def __ne__(self, other): (220, TType.DOUBLE, 'penalty_area_half_width', None, None, ), # 220 (221, TType.DOUBLE, 'penalty_area_length', None, None, ), # 221 (222, TType.DOUBLE, 'goal_width', None, None, ), # 222 + (223, TType.DOUBLE, 'goal_area_width', None, None, ), # 223 + (224, TType.DOUBLE, 'goal_area_length', None, None, ), # 224 + (225, TType.DOUBLE, 'center_circle_r', None, None, ), # 225 + (226, TType.DOUBLE, 'goal_post_radius', None, None, ), # 226 ) all_structs.append(PlayerParam) PlayerParam.thrift_spec = ( diff --git a/soccer/ttypes.pyi b/soccer/ttypes.pyi index b99807c..df5d940 100644 --- a/soccer/ttypes.pyi +++ b/soccer/ttypes.pyi @@ -262,7 +262,7 @@ class GameModeType(Enum): MODE_MAX = auto() class WorldModel(object): - def __init__(self, intercept_table: InterceptTable = None, our_team_name: str = None, their_team_name: str = None, our_side: Side = None, last_set_play_start_time: int = None, myself: Self = None, ball: Ball = None, teammates: List[Player] = None, opponents: List[Player] = None, unknowns: List[Player] = None, our_players_dict: Dict[int, Player] = None, their_players_dict: Dict[int, Player] = None, our_goalie_uniform_number: int = None, their_goalie_uniform_number: int = None, offside_line_x: float = None, offside_line_x_count: int = None, kickable_teammate_id: int = None, kickable_opponent_id: int = None, last_kick_side: Side = None, last_kicker_uniform_number: int = None, cycle: int = None, game_mode_type: GameModeType = None, left_team_score: int = None, right_team_score: int = None, is_our_set_play: bool = None, is_their_set_play: bool = None, stoped_cycle: int = None, our_team_score: int = None, their_team_score: int = None, is_penalty_kick_mode: bool = None, helios_home_positions: Dict[int, RpcVector2D] = None, our_defense_line_x: float = None, their_defense_line_x: float = None, our_defense_player_line_x: float = None, their_defense_player_line_x: float = None, kickable_teammate_existance: bool = None, kickable_opponent_existance: bool = None, penalty_kick_state: PenaltyKickState = None, see_time: int = None): + def __init__(self, intercept_table: InterceptTable = None, our_team_name: str = None, their_team_name: str = None, our_side: Side = None, last_set_play_start_time: int = None, myself: Self = None, ball: Ball = None, teammates: List[Player] = None, opponents: List[Player] = None, unknowns: List[Player] = None, our_players_dict: Dict[int, Player] = None, their_players_dict: Dict[int, Player] = None, our_goalie_uniform_number: int = None, their_goalie_uniform_number: int = None, offside_line_x: float = None, offside_line_x_count: int = None, kickable_teammate_id: int = None, kickable_opponent_id: int = None, last_kick_side: Side = None, last_kicker_uniform_number: int = None, cycle: int = None, game_mode_type: GameModeType = None, left_team_score: int = None, right_team_score: int = None, is_our_set_play: bool = None, is_their_set_play: bool = None, stoped_cycle: int = None, our_team_score: int = None, their_team_score: int = None, is_penalty_kick_mode: bool = None, helios_home_positions: Dict[int, RpcVector2D] = None, our_defense_line_x: float = None, their_defense_line_x: float = None, our_defense_player_line_x: float = None, their_defense_player_line_x: float = None, kickable_teammate_existance: bool = None, kickable_opponent_existance: bool = None, penalty_kick_state: PenaltyKickState = None, see_time: int = None, time_stopped: int = None, set_play_count: int = None, game_mode_side: Side = None): pass intercept_table: InterceptTable our_team_name: str @@ -303,6 +303,9 @@ class WorldModel(object): kickable_opponent_existance: bool penalty_kick_state: PenaltyKickState see_time: int + time_stopped: int + set_play_count: int + game_mode_side: Side class State(object): def __init__(self, register_response: RegisterResponse = None, world_model: WorldModel = None, full_world_model: WorldModel = None, need_preprocess: bool = None): @@ -1102,7 +1105,7 @@ class TrainerActions(object): actions: List[TrainerAction] class ServerParam(object): - def __init__(self, register_response: RegisterResponse = None, inertia_moment: float = None, player_size: float = None, player_decay: float = None, player_rand: float = None, player_weight: float = None, player_speed_max: float = None, player_accel_max: float = None, stamina_max: float = None, stamina_inc_max: float = None, recover_init: float = None, recover_dec_thr: float = None, recover_min: float = None, recover_dec: float = None, effort_init: float = None, effort_dec_thr: float = None, effort_min: float = None, effort_dec: float = None, effort_inc_thr: float = None, effort_inc: float = None, kick_rand: float = None, team_actuator_noise: bool = None, player_rand_factor_l: float = None, player_rand_factor_r: float = None, kick_rand_factor_l: float = None, kick_rand_factor_r: float = None, ball_size: float = None, ball_decay: float = None, ball_rand: float = None, ball_weight: float = None, ball_speed_max: float = None, ball_accel_max: float = None, dash_power_rate: float = None, kick_power_rate: float = None, kickable_margin: float = None, control_radius: float = None, control_radius_width: float = None, max_power: float = None, min_power: float = None, max_moment: float = None, min_moment: float = None, max_neck_moment: float = None, min_neck_moment: float = None, max_neck_angle: float = None, min_neck_angle: float = None, visible_angle: float = None, visible_distance: float = None, wind_dir: float = None, wind_force: float = None, wind_angle: float = None, wind_rand: float = None, kickable_area: float = None, catch_area_l: float = None, catch_area_w: float = None, catch_probability: float = None, goalie_max_moves: int = None, corner_kick_margin: float = None, offside_active_area_size: float = None, wind_none: bool = None, use_wind_random: bool = None, coach_say_count_max: int = None, coach_say_msg_size: int = None, clang_win_size: int = None, clang_define_win: int = None, clang_meta_win: int = None, clang_advice_win: int = None, clang_info_win: int = None, clang_mess_delay: int = None, clang_mess_per_cycle: int = None, half_time: int = None, simulator_step: int = None, send_step: int = None, recv_step: int = None, sense_body_step: int = None, lcm_step: int = None, player_say_msg_size: int = None, player_hear_max: int = None, player_hear_inc: int = None, player_hear_decay: int = None, catch_ban_cycle: int = None, slow_down_factor: int = None, use_offside: bool = None, kickoff_offside: bool = None, offside_kick_margin: float = None, audio_cut_dist: float = None, dist_quantize_step: float = None, landmark_dist_quantize_step: float = None, dir_quantize_step: float = None, dist_quantize_step_l: float = None, dist_quantize_step_r: float = None, landmark_dist_quantize_step_l: float = None, landmark_dist_quantize_step_r: float = None, dir_quantize_step_l: float = None, dir_quantize_step_r: float = None, coach_mode: bool = None, coach_with_referee_mode: bool = None, use_old_coach_hear: bool = None, slowness_on_top_for_left_team: float = None, slowness_on_top_for_right_team: float = None, start_goal_l: int = None, start_goal_r: int = None, fullstate_l: bool = None, fullstate_r: bool = None, drop_ball_time: int = None, synch_mode: bool = None, synch_offset: int = None, synch_micro_sleep: int = None, point_to_ban: int = None, point_to_duration: int = None, player_port: int = None, trainer_port: int = None, online_coach_port: int = None, verbose_mode: bool = None, coach_send_vi_step: int = None, replay_file: str = None, landmark_file: str = None, send_comms: bool = None, text_logging: bool = None, game_logging: bool = None, game_log_version: int = None, text_log_dir: str = None, game_log_dir: str = None, text_log_fixed_name: str = None, game_log_fixed_name: str = None, use_text_log_fixed: bool = None, use_game_log_fixed: bool = None, use_text_log_dated: bool = None, use_game_log_dated: bool = None, log_date_format: str = None, log_times: bool = None, record_message: bool = None, text_log_compression: int = None, game_log_compression: int = None, use_profile: bool = None, tackle_dist: float = None, tackle_back_dist: float = None, tackle_width: float = None, tackle_exponent: float = None, tackle_cycles: int = None, tackle_power_rate: float = None, freeform_wait_period: int = None, freeform_send_period: int = None, free_kick_faults: bool = None, back_passes: bool = None, proper_goal_kicks: bool = None, stopped_ball_vel: float = None, max_goal_kicks: int = None, clang_del_win: int = None, clang_rule_win: int = None, auto_mode: bool = None, kick_off_wait: int = None, connect_wait: int = None, game_over_wait: int = None, team_l_start: str = None, team_r_start: str = None, keepaway_mode: bool = None, keepaway_length: float = None, keepaway_width: float = None, keepaway_logging: bool = None, keepaway_log_dir: str = None, keepaway_log_fixed_name: str = None, keepaway_log_fixed: bool = None, keepaway_log_dated: bool = None, keepaway_start: int = None, nr_normal_halfs: int = None, nr_extra_halfs: int = None, penalty_shoot_outs: bool = None, pen_before_setup_wait: int = None, pen_setup_wait: int = None, pen_ready_wait: int = None, pen_taken_wait: int = None, pen_nr_kicks: int = None, pen_max_extra_kicks: int = None, pen_dist_x: float = None, pen_random_winner: bool = None, pen_allow_mult_kicks: bool = None, pen_max_goalie_dist_x: float = None, pen_coach_moves_players: bool = None, module_dir: str = None, ball_stuck_area: float = None, coach_msg_file: str = None, max_tackle_power: float = None, max_back_tackle_power: float = None, player_speed_max_min: float = None, extra_stamina: float = None, synch_see_offset: int = None, extra_half_time: int = None, stamina_capacity: float = None, max_dash_angle: float = None, min_dash_angle: float = None, dash_angle_step: float = None, side_dash_rate: float = None, back_dash_rate: float = None, max_dash_power: float = None, min_dash_power: float = None, tackle_rand_factor: float = None, foul_detect_probability: float = None, foul_exponent: float = None, foul_cycles: int = None, golden_goal: bool = None, red_card_probability: float = None, illegal_defense_duration: int = None, illegal_defense_number: int = None, illegal_defense_dist_x: float = None, illegal_defense_width: float = None, fixed_teamname_l: str = None, fixed_teamname_r: str = None, max_catch_angle: float = None, min_catch_angle: float = None, random_seed: int = None, long_kick_power_factor: float = None, long_kick_delay: int = None, max_monitors: int = None, catchable_area: float = None, real_speed_max: float = None, pitch_half_length: float = None, pitch_half_width: float = None, our_penalty_area_line_x: float = None, their_penalty_area_line_x: float = None, penalty_area_half_width: float = None, penalty_area_length: float = None, goal_width: float = None): + def __init__(self, register_response: RegisterResponse = None, inertia_moment: float = None, player_size: float = None, player_decay: float = None, player_rand: float = None, player_weight: float = None, player_speed_max: float = None, player_accel_max: float = None, stamina_max: float = None, stamina_inc_max: float = None, recover_init: float = None, recover_dec_thr: float = None, recover_min: float = None, recover_dec: float = None, effort_init: float = None, effort_dec_thr: float = None, effort_min: float = None, effort_dec: float = None, effort_inc_thr: float = None, effort_inc: float = None, kick_rand: float = None, team_actuator_noise: bool = None, player_rand_factor_l: float = None, player_rand_factor_r: float = None, kick_rand_factor_l: float = None, kick_rand_factor_r: float = None, ball_size: float = None, ball_decay: float = None, ball_rand: float = None, ball_weight: float = None, ball_speed_max: float = None, ball_accel_max: float = None, dash_power_rate: float = None, kick_power_rate: float = None, kickable_margin: float = None, control_radius: float = None, control_radius_width: float = None, max_power: float = None, min_power: float = None, max_moment: float = None, min_moment: float = None, max_neck_moment: float = None, min_neck_moment: float = None, max_neck_angle: float = None, min_neck_angle: float = None, visible_angle: float = None, visible_distance: float = None, wind_dir: float = None, wind_force: float = None, wind_angle: float = None, wind_rand: float = None, kickable_area: float = None, catch_area_l: float = None, catch_area_w: float = None, catch_probability: float = None, goalie_max_moves: int = None, corner_kick_margin: float = None, offside_active_area_size: float = None, wind_none: bool = None, use_wind_random: bool = None, coach_say_count_max: int = None, coach_say_msg_size: int = None, clang_win_size: int = None, clang_define_win: int = None, clang_meta_win: int = None, clang_advice_win: int = None, clang_info_win: int = None, clang_mess_delay: int = None, clang_mess_per_cycle: int = None, half_time: int = None, simulator_step: int = None, send_step: int = None, recv_step: int = None, sense_body_step: int = None, lcm_step: int = None, player_say_msg_size: int = None, player_hear_max: int = None, player_hear_inc: int = None, player_hear_decay: int = None, catch_ban_cycle: int = None, slow_down_factor: int = None, use_offside: bool = None, kickoff_offside: bool = None, offside_kick_margin: float = None, audio_cut_dist: float = None, dist_quantize_step: float = None, landmark_dist_quantize_step: float = None, dir_quantize_step: float = None, dist_quantize_step_l: float = None, dist_quantize_step_r: float = None, landmark_dist_quantize_step_l: float = None, landmark_dist_quantize_step_r: float = None, dir_quantize_step_l: float = None, dir_quantize_step_r: float = None, coach_mode: bool = None, coach_with_referee_mode: bool = None, use_old_coach_hear: bool = None, slowness_on_top_for_left_team: float = None, slowness_on_top_for_right_team: float = None, start_goal_l: int = None, start_goal_r: int = None, fullstate_l: bool = None, fullstate_r: bool = None, drop_ball_time: int = None, synch_mode: bool = None, synch_offset: int = None, synch_micro_sleep: int = None, point_to_ban: int = None, point_to_duration: int = None, player_port: int = None, trainer_port: int = None, online_coach_port: int = None, verbose_mode: bool = None, coach_send_vi_step: int = None, replay_file: str = None, landmark_file: str = None, send_comms: bool = None, text_logging: bool = None, game_logging: bool = None, game_log_version: int = None, text_log_dir: str = None, game_log_dir: str = None, text_log_fixed_name: str = None, game_log_fixed_name: str = None, use_text_log_fixed: bool = None, use_game_log_fixed: bool = None, use_text_log_dated: bool = None, use_game_log_dated: bool = None, log_date_format: str = None, log_times: bool = None, record_message: bool = None, text_log_compression: int = None, game_log_compression: int = None, use_profile: bool = None, tackle_dist: float = None, tackle_back_dist: float = None, tackle_width: float = None, tackle_exponent: float = None, tackle_cycles: int = None, tackle_power_rate: float = None, freeform_wait_period: int = None, freeform_send_period: int = None, free_kick_faults: bool = None, back_passes: bool = None, proper_goal_kicks: bool = None, stopped_ball_vel: float = None, max_goal_kicks: int = None, clang_del_win: int = None, clang_rule_win: int = None, auto_mode: bool = None, kick_off_wait: int = None, connect_wait: int = None, game_over_wait: int = None, team_l_start: str = None, team_r_start: str = None, keepaway_mode: bool = None, keepaway_length: float = None, keepaway_width: float = None, keepaway_logging: bool = None, keepaway_log_dir: str = None, keepaway_log_fixed_name: str = None, keepaway_log_fixed: bool = None, keepaway_log_dated: bool = None, keepaway_start: int = None, nr_normal_halfs: int = None, nr_extra_halfs: int = None, penalty_shoot_outs: bool = None, pen_before_setup_wait: int = None, pen_setup_wait: int = None, pen_ready_wait: int = None, pen_taken_wait: int = None, pen_nr_kicks: int = None, pen_max_extra_kicks: int = None, pen_dist_x: float = None, pen_random_winner: bool = None, pen_allow_mult_kicks: bool = None, pen_max_goalie_dist_x: float = None, pen_coach_moves_players: bool = None, module_dir: str = None, ball_stuck_area: float = None, coach_msg_file: str = None, max_tackle_power: float = None, max_back_tackle_power: float = None, player_speed_max_min: float = None, extra_stamina: float = None, synch_see_offset: int = None, extra_half_time: int = None, stamina_capacity: float = None, max_dash_angle: float = None, min_dash_angle: float = None, dash_angle_step: float = None, side_dash_rate: float = None, back_dash_rate: float = None, max_dash_power: float = None, min_dash_power: float = None, tackle_rand_factor: float = None, foul_detect_probability: float = None, foul_exponent: float = None, foul_cycles: int = None, golden_goal: bool = None, red_card_probability: float = None, illegal_defense_duration: int = None, illegal_defense_number: int = None, illegal_defense_dist_x: float = None, illegal_defense_width: float = None, fixed_teamname_l: str = None, fixed_teamname_r: str = None, max_catch_angle: float = None, min_catch_angle: float = None, random_seed: int = None, long_kick_power_factor: float = None, long_kick_delay: int = None, max_monitors: int = None, catchable_area: float = None, real_speed_max: float = None, pitch_half_length: float = None, pitch_half_width: float = None, our_penalty_area_line_x: float = None, their_penalty_area_line_x: float = None, penalty_area_half_width: float = None, penalty_area_length: float = None, goal_width: float = None, goal_area_width: float = None, goal_area_length: float = None, center_circle_r: float = None, goal_post_radius: float = None): pass register_response: RegisterResponse inertia_moment: float @@ -1326,6 +1329,10 @@ class ServerParam(object): penalty_area_half_width: float penalty_area_length: float goal_width: float + goal_area_width: float + goal_area_length: float + center_circle_r: float + goal_post_radius: float class PlayerParam(object): def __init__(self, register_response: RegisterResponse = None, player_types: int = None, subs_max: int = None, pt_max: int = None, allow_mult_default_type: bool = None, player_speed_max_delta_min: float = None, player_speed_max_delta_max: float = None, stamina_inc_max_delta_factor: float = None, player_decay_delta_min: float = None, player_decay_delta_max: float = None, inertia_moment_delta_factor: float = None, dash_power_rate_delta_min: float = None, dash_power_rate_delta_max: float = None, player_size_delta_factor: float = None, kickable_margin_delta_min: float = None, kickable_margin_delta_max: float = None, kick_rand_delta_factor: float = None, extra_stamina_delta_min: float = None, extra_stamina_delta_max: float = None, effort_max_delta_factor: float = None, effort_min_delta_factor: float = None, random_seed: int = None, new_dash_power_rate_delta_min: float = None, new_dash_power_rate_delta_max: float = None, new_stamina_inc_max_delta_factor: float = None, kick_power_rate_delta_min: float = None, kick_power_rate_delta_max: float = None, foul_detect_probability_delta_factor: float = None, catchable_area_l_stretch_min: float = None, catchable_area_l_stretch_max: float = None): diff --git a/utils/__init__.py b/utils/__init__.py new file mode 100644 index 0000000..e69de29