Пример #1
0
    def __init__(self, game_state, player_id, p_target=Pose(), args=None, time_to_live=DEFAULT_TIME_TO_LIVE):
        Tactic.__init__(self, game_state, player_id, p_target, args, time_to_live=time_to_live)
        assert isinstance(player_id, int)

        self.current_state = self.halt
        self.next_state = self.halt
        self.player_id = player_id
Пример #2
0
    def __init__(self,
                 p_game_state,
                 p_player_id,
                 p_y_top,
                 p_y_bottom,
                 p_x_left,
                 p_x_right,
                 p_is_yellow=False):
        Tactic.__init__(self, p_game_state, p_player_id)
        assert isinstance(p_player_id, int)
        assert PLAYER_PER_TEAM >= p_player_id >= 0
        assert isinstance(p_y_top, (int, float))
        assert isinstance(p_y_bottom, (int, float))
        assert isinstance(p_x_left, (int, float))
        assert isinstance(p_x_right, (int, float))
        assert isinstance(p_is_yellow, bool)

        self.player_id = p_player_id
        self.y_top = p_y_top
        self.y_bottom = p_y_bottom
        self.x_left = p_x_left
        self.x_right = p_x_right
        self.is_yellow = p_is_yellow
        self.current_state = self.cover_zone
        self.next_state = self.cover_zone
        self.status_flag = Flags.WIP
        self.target = Pose(
            Position(int((p_x_right - p_x_left) / 2),
                     int((p_y_top - p_y_bottom) / 2)))
Пример #3
0
 def __init__(self,
              game_state: GameState,
              player: OurPlayer,
              target: Pose = Pose(),
              args: List[str] = None,
              p_y_top: [int, float] = 3000,
              p_y_bottom: [int, float] = -3000,
              p_x_left: [int, float] = -4500,
              p_x_right: [int, float] = 4500,
              p_is_yellow: bool = False):
     Tactic.__init__(self, game_state, player, target, args)
     assert isinstance(p_y_top, (int, float))
     assert isinstance(p_y_bottom, (int, float))
     assert isinstance(p_x_left, (int, float))
     assert isinstance(p_x_right, (int, float))
     assert isinstance(p_is_yellow, bool)
     self.y_top = p_y_top
     self.y_bottom = p_y_bottom
     self.x_left = p_x_left
     self.x_right = p_x_right
     self.is_yellow = p_is_yellow
     self.current_state = self.cover_zone
     self.next_state = self.cover_zone
     self.status_flag = Flags.WIP
     self.target = Pose(
         Position(int((p_x_right - p_x_left) / 2),
                  int((p_y_top - p_y_bottom) / 2)))
Пример #4
0
    def __init__(self, game_state, player_id, target, args=None,):
        Tactic.__init__(self, game_state, player_id, target, args)
        assert isinstance(player_id, int)
        assert PLAYER_PER_TEAM >= player_id >= 0

        self.current_state = self.move_to_catch_ball
        self.next_state = self.move_to_catch_ball
        self.player_id = player_id
Пример #5
0
 def __init__(self,
              game_state: GameState,
              player: OurPlayer,
              target: Pose = Pose(),
              args: List[str] = None):
     Tactic.__init__(self, game_state, player, target, args)
     self.current_state = self.go_between_ball_and_target
     self.next_state = self.go_between_ball_and_target
Пример #6
0
    def __init__(self, game_state, player_id):
        Tactic.__init__(self, game_state, player_id)
        assert isinstance(player_id, int)
        assert PLAYER_PER_TEAM >= player_id >= 0

        self.current_state = self.rotate_towards_ball
        self.next_state = self.rotate_towards_ball
        self.player_id = player_id
Пример #7
0
 def __init__(self,
              game_state: GameState,
              player: OurPlayer,
              target: Pose = Pose(),
              args: List[str] = None):
     Tactic.__init__(self, game_state, player, target, args)
     self.current_state = self.move_to_pass_position
     self.next_state = self.move_to_pass_position
Пример #8
0
 def __init__(self, game_state, team_id, player_id):
     Tactic.__init__(self, game_state, team_id, player_id)
     self.current_state = 'halt'
     self.next_state = 'halt'
     self.dispatch.update({
         'follow_ball': self.follow_ball,
         'follow_next_player': self.follow_next_player
     })
Пример #9
0
 def __init__(self,
              game_state: GameState,
              player: OurPlayer,
              p_target: Pose = Pose(),
              args: List[str] = None):
     Tactic.__init__(self, game_state, player, p_target, args)
     self.robot_to_follow_id = int(args[0])
     self.current_state = self.halt
     self.next_state = self.halt
Пример #10
0
 def __init__(self,
              game_state: GameState,
              player: OurPlayer,
              target: Pose = Pose(),
              args: List[str] = None):
     Tactic.__init__(self, game_state, player, target, args)
     self.current_state = self.kick_charge
     self.next_state = self.kick_charge
     self.last_time = time.time()
     self.target = target
Пример #11
0
 def __init__(self,
              game_state: GameState,
              player: OurPlayer,
              target: Pose = None,
              args: List[str] = None):
     Tactic.__init__(self, game_state, player, target, args)
     self.current_state = self.get_behind_ball
     self.next_state = self.get_behind_ball
     self.last_ball_position = self.game_state.get_ball_position()
     self.last_angle = 0
     self.last_time = time.time()
Пример #12
0
    def __init__(self,
                 game_state: GameState,
                 player: OurPlayer,
                 target: Pose = Pose(),
                 args=None):
        Tactic.__init__(self, game_state, player, target, args)
        self.current_state = self.get_behind_ball
        self.next_state = self.get_behind_ball
        self.debug_interface = DebugInterface()

        self.target = target
Пример #13
0
    def __init__(self,
                 game_state,
                 player_id,
                 p_target,
                 time_to_live=DEFAULT_TIME_TO_LIVE):
        Tactic.__init__(self, game_state, p_target, time_to_live=time_to_live)
        assert isinstance(player_id, int)

        self.current_state = self.halt
        self.next_state = self.halt
        self.player_id = player_id
Пример #14
0
    def __init__(self, game_state, player_id, target=Pose(), args=None):
        Tactic.__init__(self, game_state, player_id, target, args)
        assert isinstance(player_id, int)
        assert PLAYER_PER_TEAM >= player_id >= 0
        assert isinstance(target, Pose)
        # TODO : s'assurer de la target_position soit à l'intérieur du terrain

        self.current_state = self.kick_ball_towards_target
        self.next_state = self.kick_ball_towards_target
        self.player_id = player_id
        self.target_position = target
Пример #15
0
 def __init__(
         self,
         game_state: GameState,
         player: OurPlayer,
         target: Pose = Pose(),
         args: List[str] = None,
 ):
     Tactic.__init__(self, game_state, player, target, args)
     self.is_yellow = self.player.team.team_color == TeamColor.YELLOW_TEAM
     self.current_state = self.protect_goal
     self.next_state = self.protect_goal
     self.status_flag = Flags.WIP
Пример #16
0
    def __init__(self,
                 game_state: GameState,
                 player: OurPlayer,
                 target: Pose = Pose(),
                 args: List[str] = None):
        Tactic.__init__(self, game_state, player, target, args)
        # TODO enemy id ???
        self.enemy_id = 4
        self.current_state = self.go_between_ball_and_enemy
        self.next_state = self.go_between_ball_and_enemy

        self.target = target
Пример #17
0
    def __init__(self, p_game_state, player_id, target=Pose()):
        Tactic.__init__(self, p_game_state, player_id, target)
        assert isinstance(player_id, int)
        assert PLAYER_PER_TEAM >= player_id >= 0

        self.player_id = player_id
        self.current_state = self.get_behind_ball
        self.next_state = self.get_behind_ball

        self.move_action = GoToPosition(self.game_state, self.player_id,
                                        self.game_state.get_player_pose(self.player_id))
        self.move_action.status_flag = Flags.SUCCESS
        self.last_ball_position = self.game_state.get_ball_position()
Пример #18
0
    def __init__(self,
                 game_state: GameState,
                 player: OurPlayer,
                 target: Pose = Pose(),
                 args: List[str] = None):
        Tactic.__init__(self, game_state, player, target, args)
        self.current_state = self.get_behind_ball
        self.next_state = self.get_behind_ball
        self.debug_interface = DebugInterface()
        self.move_action = self._generate_move_to()
        self.move_action.status_flag = Flags.SUCCESS
        self.last_ball_position = self.game_state.get_ball_position()
        self.charge_time = 0
        self.last_time = time.time()

        self.orientation_target = 0
        self.target = target
Пример #19
0
    def __init__(self, game_state: GameState, player: OurPlayer, center_position, target: Pose, args: List[str]=None):
        Tactic.__init__(self, game_state, player, target, args)
        self.ANGLE_INCREMENT = m.pi/8
        self.pose_list = []
        self.index = 0
        self.origin = center_position
        self.initial_position = None
        self.initial_orientation = None
        self.initial_distance = None
        self.initial_angle = None
        self.target_angle = None
        self.delta_angle = None
        self.num_points = None
        self.angle_increment = None

        self.status_flag = Flags.INIT
        self.current_state = self.calculate_path
        self.next_state = self.rotate_around
Пример #20
0
    def __init__(self, p_game_state, player_id, target=Pose(), args=None):
        Tactic.__init__(self, p_game_state, player_id, target, args)
        assert isinstance(player_id, int)
        assert PLAYER_PER_TEAM >= player_id >= 0

        self.player_id = player_id
        self.current_state = self.kick_charge
        self.next_state = self.kick_charge
        self.debug_interface = DebugInterface()
        self.move_action = self._generate_move_to()
        self.move_action.status_flag = Flags.SUCCESS
        self.last_ball_position = self.game_state.get_ball_position()
        self.charge_time = 0
        self.last_time = time.time()

        self.target = target

        self.go_get_ball_tactic = GoGetBall(self.game_state, self.player_id, self.target)
Пример #21
0
    def __init__(self, p_game_state, player_id, target=Pose(), args=None):
        Tactic.__init__(self, p_game_state, player_id, target, args)
        assert isinstance(player_id, int)
        assert PLAYER_PER_TEAM >= player_id >= 0

        self.player_id = player_id
        self.current_state = self.get_behind_ball
        self.next_state = self.get_behind_ball
        self.p_game_state = p_game_state
        self.move_action = \
            GoToPositionNoPathfinder(self.game_state,
                                     self.player_id,
                                     self.game_state.
                                     get_player_pose(self.player_id))
        self.move_action.status_flag = Flags.SUCCESS
        self.last_ball_position = self.game_state.get_ball_position()
        self.last_angle = 0
        self.last_time = time.time()
        self.vector_norm = 1000
        self.debug = DebugInterface()
Пример #22
0
    def __init__(self, p_game_state, p_player_id, target=Pose(), args=None,
                 p_y_top=3000, p_y_bottom=-3000, p_x_left=-4500, p_x_right=4500, p_is_yellow=False):
        Tactic.__init__(self, p_game_state, p_player_id, target, args)
        assert isinstance(p_player_id, int)
        assert PLAYER_PER_TEAM >= p_player_id >= 0
        assert isinstance(p_y_top, (int, float))
        assert isinstance(p_y_bottom, (int, float))
        assert isinstance(p_x_left, (int, float))
        assert isinstance(p_x_right, (int, float))
        assert isinstance(p_is_yellow, bool)

        self.player_id = p_player_id
        self.y_top = p_y_top
        self.y_bottom = p_y_bottom
        self.x_left = p_x_left
        self.x_right = p_x_right
        self.is_yellow = p_is_yellow
        self.current_state = self.cover_zone
        self.next_state = self.cover_zone
        self.status_flag = Flags.WIP
        self.target = Pose(Position(int((p_x_right - p_x_left)/2), int((p_y_top - p_y_bottom)/2)))
Пример #23
0
    def __init__(self, game_state, player_id, center_position, target, args=None,):
        Tactic.__init__(self, game_state, player_id, target, args)
        assert PLAYER_PER_TEAM >= player_id >= 0

        MINIMUM_DISTANCE = 110  # TODO: à mettre dans les constantes
        self.ANGLE_INCREMENT = m.pi/8

        self.pose_list = []
        self.index = 0
        self.origin = center_position
        self.initial_position = None
        self.initial_orientation = None
        self.initial_distance = None
        self.initial_angle = None
        self.target_angle = None
        self.delta_angle = None
        self.num_points = None
        self.angle_increment = None

        self.status_flag = Flags.INIT
        self.current_state = self.calculate_path
        self.next_state = self.rotate_around
Пример #24
0
 def __init__(self, game_state, team_id, player_id, target=Pose(), args=None):
     Tactic.__init__(self, game_state, team_id, player_id, target, args)
     self.current_state = 'halt'
     self.next_state = 'halt'
     self.dispatch.update({'follow_ball': self.follow_ball, 'follow_next_player': self.follow_next_player})
Пример #25
0
 def __init__(self, game_state: GameState, player: OurPlayer, target: Pose, args: List[str]=None,):
     Tactic.__init__(self, game_state, player, target, args)
     self.current_state = self.move_to_catch_ball
     self.next_state = self.move_to_catch_ball
Пример #26
0
 def __init__(self, game_state: GameState, player: OurPlayer, target: Pose=Pose(), args: List[str]=None):
     Tactic.__init__(self, game_state, player, target, args)
     # TODO : s'assurer de la target_position soit à l'intérieur du terrain
     self.current_state = self.kick_ball_towards_target
     self.next_state = self.kick_ball_towards_target
     self.target_position = target