-
Notifications
You must be signed in to change notification settings - Fork 21
/
Copy pathtest_simple_navigation.py
36 lines (31 loc) · 1.04 KB
/
test_simple_navigation.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
# Copyright (c) 2019 Horizon Robotics. All Rights Reserved.
import gym
import random
import social_bot
import logging
import time
import psutil
import os
def main():
env = gym.make("SocialBot-SimpleNavigationLanguage-v0")
steps = 0
t0 = time.time()
proc = psutil.Process(os.getpid())
logging.info(" mem=%dM" % (proc.memory_info().rss // 1e6))
for _ in range(10000000):
obs = env.reset()
control = [random.random() * 0.2, random.random() * 0.2]
while True:
obs, reward, done, info = env.step(
dict(control=control, sentence="hello"))
steps += 1
if done:
logging.info("reward: " + str(reward) + "sent: " +
str(obs["sentence"]))
break
logging.info("steps=%s" % steps +
" frame_rate=%s" % (steps / (time.time() - t0)) +
" mem=%dM" % (proc.memory_info().rss // 1e6))
if __name__ == "__main__":
logging.basicConfig(level=logging.INFO)
main()