Last active
December 19, 2020 05:16
-
-
Save erwincoumans/1e3cf6552f51c2259927b962b70131b1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Probably not, the plugin has very limited features.