improve the new pybullet gym environments, follow camera, disable 2D GUI, disable rendering during loading (makes it faster)

disable vsync on Mac
fix setup.py file
This commit is contained in:
Erwin Coumans
2017-08-20 18:11:53 -07:00
parent c4112ec5cc
commit c06ea72a4c
14 changed files with 125 additions and 46 deletions

View File

@@ -26,24 +26,40 @@ class SmallReactivePolicy:
def demo_run():
env = gym.make("HopperBulletEnv-v0")
cid = p.connect(p.SHARED_MEMORY) # only show graphics if the browser is already running....
if cid < 0:
cid = p.connect(p.DIRECT)
cid = p.connect(p.GUI)
p.configureDebugVisualizer(p.COV_ENABLE_GUI,0)
pi = SmallReactivePolicy(env.observation_space, env.action_space)
p.configureDebugVisualizer(p.COV_ENABLE_RENDERING,0)
env.reset()
p.configureDebugVisualizer(p.COV_ENABLE_RENDERING,1)
for i in range (p.getNumBodies()):
print(p.getBodyInfo(i))
if (p.getBodyInfo(i)[1].decode() == "hopper"):
torsoId=i
print("found torso")
print(p.getNumJoints(torsoId))
for j in range (p.getNumJoints(torsoId)):
print(p.getJointInfo(torsoId,j))#LinkState(torsoId,j))
while 1:
frame = 0
score = 0
restart_delay = 0
#disable rendering during reset, makes loading much faster
p.configureDebugVisualizer(p.COV_ENABLE_RENDERING,0)
obs = env.reset()
p.configureDebugVisualizer(p.COV_ENABLE_RENDERING,1)
while 1:
time.sleep(0.01)
time.sleep(0.001)
a = pi.act(obs)
obs, r, done, _ = env.step(a)
score += r
frame += 1
distance=5
yaw = 0
humanPos = p.getLinkState(torsoId,4)[0]
p.resetDebugVisualizerCamera(distance,yaw,-20,humanPos);
still_open = env.render("human")
if still_open==False:
return