forked from StanfordVL/OmniGibson
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_envs.py
96 lines (75 loc) · 2.04 KB
/
test_envs.py
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
import pytest
import omnigibson as og
from omnigibson.macros import gm
def task_tester(task_type):
cfg = {
"scene": {
"type": "InteractiveTraversableScene",
"scene_model": "Rs_int",
"load_object_categories": ["floors", "breakfast_table"],
},
"robots": [
{
"type": "Fetch",
"obs_modalities": [],
}
],
# Task kwargs
"task": {
"type": task_type,
# BehaviorTask-specific
"activity_name": "laying_wood_floors",
"online_object_sampling": True,
},
}
if og.sim is None:
# Make sure GPU dynamics are enabled (GPU dynamics needed for cloth) and no flatcache
gm.ENABLE_OBJECT_STATES = True
gm.USE_GPU_DYNAMICS = True
gm.ENABLE_FLATCACHE = True
gm.ENABLE_TRANSITION_RULES = False
else:
# Make sure sim is stopped
og.sim.stop()
# Create the environment
env = og.Environment(configs=cfg)
env.reset()
for _ in range(5):
env.step(env.robots[0].action_space.sample())
# Clear the sim
og.clear()
def test_dummy_task():
task_tester("DummyTask")
def test_point_reaching_task():
task_tester("PointReachingTask")
def test_point_navigation_task():
task_tester("PointNavigationTask")
def test_behavior_task():
task_tester("BehaviorTask")
def test_rs_int_full_load():
cfg = {
"scene": {
"type": "InteractiveTraversableScene",
"scene_model": "Rs_int",
},
"robots": [
{
"type": "Fetch",
"obs_modalities": [],
}
],
# Task kwargs
"task": {
"type": "DummyTask",
},
}
# Make sure sim is stopped
if og.sim:
og.sim.stop()
# Create the environment
env = og.Environment(configs=cfg)
env.reset()
for _ in range(5):
env.step(env.robots[0].action_space.sample())
# Clear the sim
og.clear()