-
Notifications
You must be signed in to change notification settings - Fork 2
/
test_env.py
64 lines (50 loc) · 1.71 KB
/
test_env.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
import sys
import logging
import time
import numpy as np
from os.path import abspath, dirname, join
from gym.spaces import Tuple
from environment.envs.icra import make_env
from environment.envhandler import EnvHandler
from environment.viewer.env_viewer import EnvViewer
from mujoco_worldgen.util.envs import examine_env
from mujoco_worldgen.util.types import extract_matching_arguments
from mujoco_worldgen.util.parse_arguments import parse_arguments
logger = logging.getLogger(__name__)
def env_test():
env = EnvHandler(make_env())
obs = env.reset()
print(obs)
def main():
core_dir = "./environment"
envs_dir = './environment/envs',
xmls_dir = './environment/assets/xmls',
examine_env("./environment/envs/icra.py", {},
core_dir=core_dir, envs_dir=envs_dir, xmls_dir=xmls_dir,
env_viewer=EnvViewer)
def icra_main():
env = EnvHandler(make_env())
n_agents = 4
act = {'action_movement': np.array([ [0.0, 0.0, 0.0] for _ in range(n_agents)])}
#obs = env.reset()
done = False
start_time = time.time()
obs = env.reset()
#for _ in range(104):
# obs, rew, done, info = env.step(act)
#while not done:
# obs, rew, done, info = env.step(act)
#if done:
# print(obs)
# print(info['true_rew'])
#entities = entity_formatter.concat_encoded_entity_obs(n_agents, 0, obs, env.t)
#print(obs)
#env.render(mode='human')
#print(rew)
print("--- %s seconds ---" % (time.time() - start_time))
if __name__ == '__main__':
logging.getLogger('').handlers = []
logging.basicConfig(format='%(asctime)s %(message)s', level=logging.INFO)
icra_main()
#main()
#env_test()