Skip to content

Instantly share code, notes, and snippets.

@erwincoumans
Last active December 19, 2020 05:16
Show Gist options
  • Save erwincoumans/1e3cf6552f51c2259927b962b70131b1 to your computer and use it in GitHub Desktop.
Save erwincoumans/1e3cf6552f51c2259927b962b70131b1 to your computer and use it in GitHub Desktop.
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)
@erwincoumans
Copy link
Author

Probably not, the plugin has very limited features.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment