Files
bullet3/examples/pybullet/examples/humanoid_benchmark.py
2017-05-05 17:42:43 -07:00

23 lines
594 B
Python

import pybullet as p
import time
p.connect(p.GUI)
p.setGravity(0,0,-10)
p.setPhysicsEngineParameter(numSolverIterations=5)
p.setPhysicsEngineParameter(fixedTimeStep=1./240.)
p.setPhysicsEngineParameter(numSubSteps=1)
p.loadMJCF("mjcf/humanoid_symmetric.xml")
#first let the humanoid fall
p.setRealTimeSimulation(1)
time.sleep(3)
p.setRealTimeSimulation(0)
#now do a benchmark
print("Starting benchmark")
logId = p.startStateLogging(p.STATE_LOGGING_PROFILE_TIMINGS,"pybullet_humanoid_timings.json")
for i in range(1000):
p.stepSimulation()
p.stopStateLogging(logId)
print("ended benchmark")