File size: 4,161 Bytes
8fc2b4e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
"""Integration tests for dvnets tasks."""

from absl.testing import absltest
from absl.testing import parameterized
from cliport import tasks
from cliport.environments import environment

ASSETS_PATH = 'cliport/environments/assets/'


class TaskTest(parameterized.TestCase):

    def _create_env(self):
        assets_root = ASSETS_PATH
        env = environment.Environment(assets_root)
        env.seed(0)
        return env

    def _run_oracle_in_env(self, env):
        agent = env.task.oracle(env)
        obs = env.reset()
        info = None
        done = False
        for _ in range(10):
            act = agent.act(obs, info)
            obs, _, done, info = env.step(act)
            if done:
                break

    @parameterized.named_parameters((
    # demo conditioned
            'AlignBoxCorner',
            tasks.AlignBoxCorner(),
    ), (
            'AssemblingKits',
            tasks.AssemblingKits(),
    ), (
            'AssemblingKitsEasy',
            tasks.AssemblingKitsEasy(),
    ), (
            'BlockInsertion',
            tasks.BlockInsertion(),
    ), (
            'ManipulatingRope',
            tasks.ManipulatingRope(),
    ), (
            'PackingBoxes',
            tasks.PackingBoxes(),
    ), (
            'PalletizingBoxes',
            tasks.PalletizingBoxes(),
    ), (
            'PlaceRedInGreen',
            tasks.PlaceRedInGreen(),
    ), (
            'StackBlockPyramid',
            tasks.StackBlockPyramid(),
    ), (
            'SweepingPiles',
            tasks.SweepingPiles(),
    ), (
            'TowersOfHanoi',
            tasks.TowersOfHanoi(),

    # goal conditioned
    ), (
            'AlignRope',
            tasks.AlignRope(),
    ), (
            'AssemblingKitsSeqSeenColors',
            tasks.AssemblingKitsSeqSeenColors(),
    ), (
            'AssemblingKitsSeqUnseenColors',
            tasks.AssemblingKitsSeqUnseenColors(),
    ), (
            'AssemblingKitsSeqFull',
            tasks.AssemblingKitsSeqFull(),
    ), (
            'PackingShapes',
            tasks.PackingShapes(),
    ), (
            'PackingBoxesPairsSeenColors',
            tasks.PackingBoxesPairsSeenColors(),
    ), (
            'PackingBoxesPairsUnseenColors',
            tasks.PackingBoxesPairsUnseenColors(),
    ), (
            'PackingBoxesPairsFull',
            tasks.PackingBoxesPairsFull(),
    ), (
            'PackingSeenGoogleObjectsSeq',
            tasks.PackingSeenGoogleObjectsSeq(),
    ), (
            'PackingUnseenGoogleObjectsSeq',
            tasks.PackingUnseenGoogleObjectsSeq(),
    ), (
            'PackingSeenGoogleObjectsGroup',
            tasks.PackingSeenGoogleObjectsGroup(),
    ), (
            'PackingUnseenGoogleObjectsGroup',
            tasks.PackingUnseenGoogleObjectsGroup(),
    ), (
            'PutBlockInBowlSeenColors',
            tasks.PutBlockInBowlSeenColors(),
    ), (
            'PutBlockInBowlUnseenColors',
            tasks.PutBlockInBowlUnseenColors(),
    ), (
            'PutBlockInBowlFull',
            tasks.PutBlockInBowlFull(),
    ), (
            'StackBlockPyramidSeqSeenColors',
            tasks.StackBlockPyramidSeqSeenColors(),
    ), (
            'StackBlockPyramidSeqUnseenColors',
            tasks.StackBlockPyramidSeqUnseenColors(),
    ), (
            'StackBlockPyramidSeqFull',
            tasks.StackBlockPyramidSeqFull(),
    ), (
            'SeparatingPilesSeenColors',
            tasks.SeparatingPilesUnseenColors(),
    ), (
            'SeparatingPilesUnseenColors',
            tasks.SeparatingPilesUnseenColors(),
    ), (
            'SeparatingPilesFull',
            tasks.SeparatingPilesFull(),
    ), (
            'TowersOfHanoiSeqSeenColors',
            tasks.TowersOfHanoiSeqSeenColors(),
    ), (
            'TowersOfHanoiSeqUnseenColors',
            tasks.TowersOfHanoiSeqUnseenColors(),
    ), (
            'TowersOfHanoiSeqFull',
            tasks.TowersOfHanoiSeqFull(),
    ))
    def test_all_tasks(self, dvnets_task):
        env = self._create_env()
        env.set_task(dvnets_task)
        self._run_oracle_in_env(env)


if __name__ == '__main__':
    absltest.main()