-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathexample.py
46 lines (37 loc) · 944 Bytes
/
example.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
import gym
import gym_pepper
import time
import numpy as np
# import cv2
start = time.time()
env = gym.make("PepperPush-v0", gui=True)
end = time.time()
print("=== Make === {}".format(end - start))
start = time.time()
env.reset()
end = time.time()
print("=== Reset === {}".format(end - start))
# start = time.time()
# for _ in range(100):
# env.step([1.0] * 11)
# for _ in range(100):
# env.step([-1.0] * 11)
# end = time.time()
# print("=== Act1 === {}".format(end - start))
# start = time.time()
# env.reset()
# end = time.time()
# print("=== Reset === {}".format(end - start))
start = time.time()
for _ in range(1000):
action = np.random.sample(10) * 2 - 1
o, r, d, i = env.step(action)
# cv2.imshow("synthetic bottom camera", o["camera"])
# cv2.waitKey(1)
if d:
env.reset()
# if r == 1.0:
# print("Touch!")
end = time.time()
print("=== Act2 === {}".format(end - start))
env.close()