Improve PyBullet ports of Roboschool envs: fix reset (it kept adding stadium objects, causing slowdown), now reset uses saveState/restoreState and reset becomes a few orders of magnitude faster.

Use python -m pybullet_envs.examples.testEnv --env AntBulletEnv-v0 --render=1 --steps 1000 --resetbenchmark=1

Added environments: HumanoidFlagrunBulletEnv-v0, HumanoidFlagrunHarderBulletEnv-v0, StrikerBulletEnv-v0, ThrowerBulletEnv-v0, PusherBulletEnv-v0, ReacherBulletEnv-v0, CartPoleBulletEnv-v0 and register them to OpenAI Gym.
Allow numpy/humanoid_running.py to use abtch or non-batch update (setJointMotorControl2/setJointMotorControlArray)
This commit is contained in:
erwincoumans
2018-01-15 12:48:32 -08:00
parent 9ffb05eb3b
commit 851ca5bfb3
22 changed files with 2173 additions and 102 deletions

View File

@@ -169,9 +169,13 @@ def demo_run():
#p.setJointMotorControl2(human1, motors[m], controlMode=p.TORQUE_CONTROL, force=motor_power[m]*actions[m]*0.082)
forces = [0.] * len(motors)
batch = True
for m in range(len(motors)):
forces[m] = motor_power[m]*actions[m]*0.082
p.setJointMotorControlArray(human, motors,controlMode=p.TORQUE_CONTROL, forces=forces)
if (not batch):
p.setJointMotorControl2(human, motors[m],controlMode=p.TORQUE_CONTROL, force=forces[m])
if (batch):
p.setJointMotorControlArray(human, motors,controlMode=p.TORQUE_CONTROL, forces=forces)
p.stepSimulation()