def move(self, robot_id, idx, idx_opp, defense_angle, attack_angle, cur_posture, cur_posture_opp, previous_ball, cur_ball, predicted_ball, cross=False, shoot=False, quickpass=False, jump=False, dribble=False): self.action.update_state(cur_posture, cur_ball) if helper.ball_is_own_goal(predicted_ball, self.field, self.goal_area): x = -4.5 y = -0.5 self.flag = 1 elif helper.ball_is_own_penalty(predicted_ball, self.field, self.penalty_area): x = -4.5 y = -0.5 self.flag = 2 elif helper.ball_is_own_field(predicted_ball): x = cur_ball[X] y = cur_ball[Y] self.flag = 3 elif helper.ball_is_opp_goal(predicted_ball, self.field, self.goal_area): x = cur_ball[X] y = cur_ball[Y] self.flag = 4 if cur_posture[robot_id][BALL_POSSESSION]: shoot = True self.flag = 5 elif helper.ball_is_opp_penalty(predicted_ball, self.field, self.penalty_area): x = cur_ball[X] y = cur_ball[Y] self.flag = 6 if cur_posture[robot_id][BALL_POSSESSION]: shoot = True self.flag = 7 else: x = cur_ball[X] y = cur_ball[Y] self.flag = 8 left_wheel, right_wheel = self.action.go_to(robot_id, x, y) kick_speed, kick_angle = self.action.kick(cross, shoot, quickpass) jump_speed = self.action.jump(jump) dribble_mode = self.action.dribble(dribble) return left_wheel, right_wheel, kick_speed, kick_angle, jump_speed, dribble_mode
def move(self, robot_id, idx, idx_opp, defense_angle, attack_angle, cur_posture, cur_posture_opp, previous_ball, cur_ball, predicted_ball, cross=False, shoot=False, quickpass=False, jump=False, dribble=False): self.action.update_state(cur_posture, cur_ball) protection_radius = self.goal_area[Y] / 2 - 0.1 angle = defense_angle protection_x = math.cos(angle) * protection_radius - self.field[X] / 2 protection_y = math.sin(angle) * protection_radius if helper.ball_is_own_goal(predicted_ball, self.field, self.goal_area): x = protection_x y = protection_y self.flag = 1 elif helper.ball_is_own_penalty(predicted_ball, self.field, self.penalty_area): x = protection_x y = protection_y self.flag = 2 elif helper.ball_is_own_field(predicted_ball): x = protection_x y = protection_y self.flag = 3 elif helper.ball_is_opp_goal(predicted_ball, self.field, self.goal_area): x = protection_x y = protection_y self.flag = 4 elif helper.ball_is_opp_penalty(predicted_ball, self.field, self.penalty_area): x = protection_x y = protection_y self.flag = 5 else: x = protection_x y = protection_y self.flag = 6 left_wheel, right_wheel = self.action.go_to(robot_id, x, y) kick_speed, kick_angle = self.action.kick(cross, shoot, quickpass) jump_speed = self.action.jump(jump) dribble_mode = self.action.dribble(dribble) return left_wheel, right_wheel, kick_speed, kick_angle, jump_speed, dribble_mode
def move(self, id, idx_d, idx_a, cur_posture, cur_posture_opp, previous_ball, cur_ball, predicted_ball): speeds = [0, 0, 0, 0] ball_dist = helper.distance(cur_posture[id][X], cur_ball[X], cur_posture[id][Y], cur_ball[Y]) min_x = 0 max_x = 0 min_y = 0 max_y = 0 if helper.ball_is_own_goal(predicted_ball, self.field, self.goal_area): x = -0.5 y = 1 speeds[3] = 0 elif helper.ball_is_own_penalty(predicted_ball, self.field, self.penalty_area): x = -0.5 y = 1 speeds[3] = 2 elif helper.ball_is_own_field(predicted_ball): x = -0.5 y = 1 speeds[3] = 4 elif helper.ball_is_opp_goal(predicted_ball, self.field, self.goal_area): x = -0.5 y = 1 speeds[3] = 6 elif helper.ball_is_opp_penalty(predicted_ball, self.field, self.penalty_area): x = -0.5 y = 1 speeds[3] = 8 else: # ball is opp field x = -0.5 y = 1 speeds[3] = 10 speeds[0], speeds[1] = helper.go_to(self, id, x, y, cur_posture, cur_ball) return speeds
def move(self, id, idx_d, idx_a, cur_posture, cur_posture_opp, previous_ball, cur_ball, predicted_ball): # speed list: left wheel, right wheel, front slider, bottom slider speeds = [0, 0, 0, 0] ball_dist = helper.distance(cur_posture[id][X], cur_ball[X], cur_posture[id][Y], cur_ball[Y]) min_x = -self.field[X] / 2 # = -3.9 max_x = -self.field[X] / 2 + self.penalty_area[X] # = -3 min_y = -self.goal_area[Y] / 2 # = -0.5 max_y = self.goal_area[Y] / 2 # = 0.5 if helper.ball_is_own_goal(predicted_ball, self.field, self.goal_area): x = cur_ball[X] y = cur_ball[Y] elif helper.ball_is_own_penalty(predicted_ball, self.field, self.penalty_area): x = min_x y = max_y elif helper.ball_is_own_field(predicted_ball): x = -3 y = 0 elif helper.ball_is_opp_goal(predicted_ball, self.field, self.goal_area): x = cur_posture[1][X] y = cur_posture[1][Y] elif helper.ball_is_opp_penalty(predicted_ball, self.field, self.penalty_area): x = cur_posture_opp[4][X] y = cur_posture_opp[4][Y] else: # ball is opp field x = max_x y = max_y speeds[0], speeds[1] = helper.go_to(self, id, x, y, cur_posture, cur_ball) return speeds