Guest User

Untitled

a guest
Jan 20th, 2019
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 KB | None | 0 0
  1. import pybullet as p
  2. import time
  3.  
  4. usePhysX = True
  5.  
  6. if usePhysX:
  7. p.connect(p.PhysX)
  8. p.loadPlugin("eglRendererPlugin")
  9. else:
  10. p.connect(p.GUI)
  11. #p.connect(p.DIRECT)
  12. #p.connect(p.DART)
  13. #p.connect(p.MUJOCO)
  14. #p.connect(p.GUI)
  15.  
  16. bodyB = p.loadURDF("plane.urdf",[0,0,0], useFixedBase=True)
  17.  
  18.  
  19. for i in range (50):
  20. bodyA = p.loadURDF("r2d2.urdf",[0,0,1+i*2], useFixedBase=False)#, flags=p.URDF_USE_SELF_COLLISION)
  21.  
  22. numBodies = p.getNumBodies()
  23. print("numBodies=",numBodies)
  24.  
  25. p.setGravity(0,0,-10)
  26. timeStep = 1./240.
  27. p.setPhysicsEngineParameter(fixedTimeStep=timeStep)
  28.  
  29. profile=False
  30. if profile:
  31. logId = p.startStateLogging(p.STATE_LOGGING_PROFILE_TIMINGS, "pybullet.json")
  32. for i in range (100):
  33. p.stepSimulation()
  34. print("stop logging")
  35. p.stopStateLogging(logId)
  36.  
  37. p.stepSimulation()
  38. p.stepSimulation()
  39. time.sleep(3)
  40.  
  41. #while (p.isConnected()):
  42. while (1):
  43. p.stepSimulation()
  44. time.sleep(timeStep)
Add Comment
Please, Sign In to add comment