tweak tensorflow humanoid_running.py demo to be more robust against mouse dragging

(mouse dragging adds energy in the system that can cause explosions/instability):
use solverResidualThreshold and increase number of sub steps, also clamp the max force.
This commit is contained in:
Erwin Coumans
2018-10-27 11:48:21 -07:00
parent f455d3a243
commit bebe12d6d8
2 changed files with 7 additions and 4 deletions

View File

@@ -10,7 +10,7 @@ if (cid<0):
cid = p.connect(p.GUI) #DIRECT is much faster, but GUI shows the running gait
p.setGravity(0,0,-9.8)
p.setPhysicsEngineParameter(fixedTimeStep=1.0/60., numSolverIterations=5, numSubSteps=2)
p.setPhysicsEngineParameter(fixedTimeStep=1.0/60.,solverResidualThreshold=1-10, numSolverIterations=50, numSubSteps=4)
#this mp4 recording requires ffmpeg installed
#mp4log = p.startStateLogging(p.STATE_LOGGING_VIDEO_MP4,"humanoid.mp4")
@@ -180,11 +180,14 @@ def demo_run():
forces = [0.] * len(motors)
for m in range(len(motors)):
forces[m] = motor_power[m]*actions[m]*0.082
limit=15
ac = np.clip(actions[m],-limit,limit)
print (ac)
forces[m] = motor_power[m]*ac*0.082
p.setJointMotorControlArray(human, motors,controlMode=p.TORQUE_CONTROL, forces=forces)
p.stepSimulation()
time.sleep(0.01)
#time.sleep(0.01)
distance=5
yaw = 0
humanPos, humanOrn = p.getBasePositionAndOrientation(human)