コード例 #1
0
    def make_remaining_list_shapes(self, data):
        shapes_on_image = []
        list = data.get(VIZ_KEY_BALL_POSSIBLE_LIST, [])

        rectangle_width = 100
        left = self.image_width - rectangle_width

        number = 0
        texts = []
        for ball in list:
            distance = ball.distance
            u = ball.u
            v = ball.v
            rating = ball.rating
            radius = ball.radius
            rating_text = "rat: %.0f" % rating
            distance_text = "Dist: %.0f" % distance
            u_text = "u: %.0f " % u
            v_text = "v: %.0f" % v
            y_start = number * 60 + 10
            start_text = "Ball " + str(number)

            x, y, radius = transform_relative_to_pixel(ball.x, ball.y, radius, self.image_width, self.image_height)

            # make white number
            shapes_on_image.extend(white_text(x, y, str(number)))

            # text for the legend
            legend_string = [start_text, rating_text, distance_text, u_text, v_text]
            texts.extend(legend_string)
            number += 1

        return shapes_on_image, texts
コード例 #2
0
 def make_chosen_ball_shape(self, data):
     shapes = []
     if data[DATA_KEY_BALL_FOUND]:
         ball = data[DATA_KEY_BALL_INFO]
         x, y, radius = transform_relative_to_pixel(ball.x, ball.y, ball.radius, self.image_width, self.image_height)
         shapes.extend(yellow_ball(x, y, radius))
     return shapes
コード例 #3
0
 def make_rated_out_shapes(self, data):
     shapes = []
     for info in data[VIZ_KEY_BALL_RATING_OUT]:
         x, y, radius, rating = info
         x, y, radius = transform_relative_to_pixel(x, y, radius, self.image_width, self.image_height)
         shapes.extend(red_ball(x, y, radius))
         shapes.extend(red_text(x, y, "R: %.0f" % rating))
     return shapes
コード例 #4
0
 def make_small_out_shapes(self, data):
     shapes = []
     for info in data[VIZ_KEY_BALL_SMALL_OUT]:
         x, y, radius, radius_to_be_pic = info
         x, y, radius = transform_relative_to_pixel(x, y, self.image_width, self.image_height)
         relation = radius / radius_to_be_pic
         shapes.extend(red_ball(x, y, radius))
         shapes.extend(green_text(x, y, "S: %.2f" % relation))
     return shapes
コード例 #5
0
 def make_body_out_shapes(self, data):
     shapes = []
     for info in data[VIZ_KEY_BALL_BODY_OUT]:
         x, y, radius, dist = info
         x, y, radius = transform_relative_to_pixel(x, y, radius, self.image_width, self.image_height)
         relation = dist / self.max_distance_to_motor
         shapes.extend(red_ball(x, y, radius))
         shapes.extend(yellow_text(x, y, "B: %.2f" % relation))
     return shapes
コード例 #6
0
 def make_far_out_shapes(self, data):
     shapes = []
     for info in data[VIZ_KEY_BALL_FAR_OUT]:
         x, y, radius, dist = info
         x, y, radius = transform_relative_to_pixel(x, y, radius, self.image_width, self.image_height)
         relation = dist / self.max_ball_distance
         shapes.extend(red_ball(x, y, radius))
         shapes.extend(white_text(x, y, "F: %.0f" % relation))
     return shapes
コード例 #7
0
    def make_candidate_shapes(self, data):
        raw_ball = data.get(DATA_KEY_RAW_BALL, None)
        if raw_ball is None:
            return []

        shapes = []
        for ball in raw_ball:
            rating, (x, y, radius) = ball
            y += radius  # directly delivered footpoint from vision
            x, y, radius = transform_relative_to_pixel(x, y, radius, self.image_width, self.image_height)
            shapes.extend(white_ball(x, y, radius))
        return shapes
コード例 #8
0
    def make_piped_orange_ball_shape(self, data):
        raw_ball = data.get(DATA_KEY_RAW_BALL, None)
        if raw_ball is None:
            return []

        shapes = []
        print raw_ball
        for ball in raw_ball:
            rating, (x, y, radius) = ball
            if rating == -2 and self.activate_orange_ball_hack:
                y += radius  # directly delivered footpoint from vision
                x, y, radius = transform_relative_to_pixel(x, y, radius, self.image_width, self.image_height)
                shapes.extend(violet_ball(x, y, radius))
        return shapes