add gym examples

This commit is contained in:
Jie Tan
2017-03-10 11:22:38 -08:00
parent d3ee7f68a1
commit 923fbe8588
8 changed files with 430 additions and 0 deletions

View File

@@ -0,0 +1,27 @@
"""One-line documentation for gym_example module.
A detailed description of gym_example.
"""
import gym
from envs.bullet.minitaur import MinitaurWalkEnv
import setuptools
import time
import numpy as np
def main():
env = gym.make('MinitaurWalkEnv-v0')
for i_episode in range(1):
observation = env.reset()
done = False
while not done:
print(observation)
action = np.array([1.3, 0, 0, 0, 1.3, 0, 0, 0, 1.3, 3.14, 0, 0, 1.3, 3.14, 0, 0])
print(action)
observation, reward, done, info = env.step(action)
if done:
print("Episode finished after {} timesteps".format(t+1))
break
main()