Ejemplo n.º 1
0
class BalonAlArcoStrategy(TeamStrategyBase):
    CONTROL_SERVER = ('0.0.0.0', 9003)
    serializer_class = VsssSerializerSimulator
    do_visualize = True
    latency = 100
    print_iteration_time = False
    visualizer_class = TrajectoryVisualizer

    def set_up(self):
        super(BalonAlArcoStrategy, self).set_up()
        self.controller = Controller()
        self.traj = TrajectorySCurve(r=10)

    def strategy(self, data):
        global trajectory
        print "TEAM", data.teams
        team = data.teams[self.team]
        ball = data.ball
        if my_side == 0:
            goal = Position(-80,0)
        else:
            goal = Position(80,0)
        Abg = ball.angle_to(goal)   # angulo ball to goal
        obj = RobotPosition(ball.x, ball.y, Abg)
        current = team[1]

        if current.distance_to(ball) <= 8:
            new_obj = move_by_radius(ball.tonp(), 10, Abg)
            obj = RobotPosition(new_obj[0], new_obj[1], Abg)
        move = self.controller.go_with_trajectory(obj, current)
        trajectory = self.traj.get_trajectory(obj, current, 10)

        out_data = VsssOutData(moves=[
            Move(0,0),
            move,
            Move(0,0),
        ])
        return out_data
Ejemplo n.º 2
0
 def set_up(self):
     super(BalonAlArcoStrategy, self).set_up()
     self.controller = Controller()
     self.traj = TrajectorySCurve(r=10)