Exemple #1
0
def construct_training_scene():
    speaker = Speaker(Vec2(0, 0))
    scene = Scene(3)

    table = Landmark(
        'table',
        RectangleRepresentation(
            rect=BoundingBox([Vec2(-0.4, 0.4), Vec2(0.4, 1.0)])), None,
        ObjectClass.TABLE)

    obj1 = Landmark(
        'green_cup',
        RectangleRepresentation(rect=BoundingBox(
            [Vec2(0.05 - 0.035, 0.9 - 0.035),
             Vec2(0.05 + 0.035, 0.9 + 0.035)]),
                                landmarks_to_get=[]), None, ObjectClass.CUP,
        Color.GREEN)

    obj2 = Landmark(
        'blue_cup',
        RectangleRepresentation(rect=BoundingBox(
            [Vec2(0.05 - 0.035, 0.7 - 0.035),
             Vec2(0.05 + 0.035, 0.7 + 0.035)]),
                                landmarks_to_get=[]), None, ObjectClass.CUP,
        Color.BLUE)

    obj3 = Landmark(
        'pink_cup',
        RectangleRepresentation(rect=BoundingBox(
            [Vec2(0 - 0.035, 0.55 - 0.035),
             Vec2(0 + 0.035, 0.55 + 0.035)]),
                                landmarks_to_get=[]), None, ObjectClass.CUP,
        Color.PINK)

    obj4 = Landmark(
        'purple_prism',
        RectangleRepresentation(rect=BoundingBox(
            [Vec2(-0.3 - 0.03, 0.7 - 0.05),
             Vec2(-0.3 + 0.03, 0.7 + 0.05)]),
                                landmarks_to_get=[]), None, ObjectClass.PRISM,
        Color.PURPLE)

    obj5 = Landmark(
        'orange_prism',
        RectangleRepresentation(rect=BoundingBox(
            [Vec2(0.3 - 0.03, 0.7 - 0.05),
             Vec2(0.3 + 0.03, 0.7 + 0.05)]),
                                landmarks_to_get=[]), None, ObjectClass.PRISM,
        Color.ORANGE)

    scene.add_landmark(table)

    for obj in (obj1, obj2, obj3, obj4, obj5):
        obj.representation.alt_representations = []
        scene.add_landmark(obj)

    return scene, speaker