Skip to content

Instantly share code, notes, and snippets.

@erwincoumans
Last active December 19, 2020 05:16
Show Gist options
  • Select an option

  • Save erwincoumans/1e3cf6552f51c2259927b962b70131b1 to your computer and use it in GitHub Desktop.

Select an option

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)
@tomas-wood

Copy link
Copy Markdown

Sweet

@alexqbi

alexqbi commented Nov 13, 2020

Copy link
Copy Markdown

Hi there!. I tried to use pybullet_physx with urdf models and it was ok, but when i tried to use it with sdf model, it failed with error. It seems that sdf file was wrong, but it works very well in pybullet without any errors and issues .
Is it possible to use pybullet_physx with sdf model?
This is the log of my error:

error: Cannot load SDF file.
pybullet build time: Nov 13 2020 02:52:47
PhysX numCores=1
PhysX using PGS
X11 functions dynamically loaded using dlopen/dlsym OK!
X11 functions dynamically loaded using dlopen/dlsym OK!
Creating context
Created GL 3.3 context
Direct GLX rendering context obtained
Making context current
GL_VENDOR=NVIDIA Corporation
GL_RENDERER=GeForce RTX 3080/PCIe/SSE2
GL_VERSION=3.3.0 NVIDIA 455.32.00
GL_SHADING_LANGUAGE_VERSION=3.30 NVIDIA via Cg compiler
pthread_getconcurrency()=0
Version = 3.3.0 NVIDIA 455.32.00
Vendor = NVIDIA Corporation
Renderer = GeForce RTX 3080/PCIe/SSE2
Unknown command encountered: 1

@erwincoumans

Copy link
Copy Markdown
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