Пример #1
0
    def be_attacker(self, myi, robot_pos, team):
        stuff = 0
        point = 0
        if (myi['x'] < robot_pos['x']) if team else (
                myi['x'] > robot_pos['x']):

            #print(intercepts)
            x = fit_parabola(myi, robot_pos, {
                'x': (0.0 if team else 1.0),
                "y": 0.5
            })
            if not passes_boundary(x):
                point = get_tangent_point(robot_pos, x, team)
                ball_angle, robot_angle = self.get_angles(point, robot_pos)

                return goTo(point['x'], point['y'], robot_pos, robot_angle)

            else:
                ball_angle, robot_angle = self.get_angles(myi, robot_pos)

                return goTo(myi['x'], myi['y'], robot_pos, robot_angle)

        else:
            ball_angle, robot_angle = self.get_angles(myi, robot_pos)

            return goTo(myi['x'], myi['y'], robot_pos, robot_angle)
 def be_goalie(self, ball_pos, robot_pos, team):
     Designated_pos = [[0.58, 0]] if team else [[-0.58,0]]
     DesiredPos = coor_recalc(Designated_pos[0][0],Designated_pos[0][1], team=team)
     if (ball_pos['x'] > DesiredPos['x']) if team else (ball_pos['x'] < DesiredPos['x']):
         DesiredPos = ball_pos
     else:
         DesiredPos['y'] = goalie_cal_Y(ball_pos)
     
     ball_angle, robot_angle = self.get_angles(ball_pos, robot_pos)
     return goTo(DesiredPos["x"], DesiredPos["y"], robot_pos, robot_angle) #0 right motor, 1 left motor 
Пример #3
0
    def be_backup(self, robot_pos, data, Team):
        DesiredPos = support_position(data, Team)

        ball_angle, robot_angle = self.get_angles(DesiredPos, robot_pos)
        return goTo(DesiredPos["x"], DesiredPos["y"], robot_pos,
                    robot_angle)  #0 right motor, 1 left motor