Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import pybullet as p
- import time
- usePhysX = True
- if usePhysX:
- p.connect(p.PhysX)
- p.loadPlugin("eglRendererPlugin")
- else:
- p.connect(p.GUI)
- #p.connect(p.DIRECT)
- #p.connect(p.DART)
- #p.connect(p.MUJOCO)
- #p.connect(p.GUI)
- bodyB = p.loadURDF("plane.urdf",[0,0,0], useFixedBase=True)
- for i in range (50):
- bodyA = p.loadURDF("r2d2.urdf",[0,0,1+i*2], useFixedBase=False)#, flags=p.URDF_USE_SELF_COLLISION)
- numBodies = p.getNumBodies()
- print("numBodies=",numBodies)
- p.setGravity(0,0,-10)
- timeStep = 1./240.
- p.setPhysicsEngineParameter(fixedTimeStep=timeStep)
- profile=False
- if profile:
- logId = p.startStateLogging(p.STATE_LOGGING_PROFILE_TIMINGS, "pybullet.json")
- for i in range (100):
- p.stepSimulation()
- print("stop logging")
- p.stopStateLogging(logId)
- p.stepSimulation()
- p.stepSimulation()
- time.sleep(3)
- #while (p.isConnected()):
- while (1):
- p.stepSimulation()
- time.sleep(timeStep)
Add Comment
Please, Sign In to add comment