forked from PaulDanielML/MuJoCo_RL_UR5
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexample_agent.py
29 lines (22 loc) · 899 Bytes
/
example_agent.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
#!/usr/bin/env python3
import gym
import numpy as np
from termcolor import colored
import time
env = gym.make('gym_grasper:Grasper-v0', show_obs=False, render=True)
N_EPISODES = 100
N_STEPS = 100
env.print_info()
for episode in range(1, N_EPISODES+1):
obs = env.reset()
for step in range(N_STEPS):
print('#################################################################')
print(colored('EPISODE {} STEP {}'.format(episode, step+1), color='white', attrs=['bold']))
print('#################################################################')
action = env.action_space.sample()
# action = [100,100] # multidiscrete
# action = 20000 #discrete
observation, reward, done, _ = env.step(action, record_grasps=True)
# observation, reward, done, _ = env.step(action, record_grasps=True, render=True)
env.close()
print('Finished.')