Simulating closed loop structure in PyBullet

Official Python bindings with a focus on reinforcement learning and robotics.
Post Reply
prakhar
Posts: 1
Joined: Thu Feb 14, 2019 4:09 pm

Simulating closed loop structure in PyBullet

Post by prakhar »

Hello

I am trying to load an SDF file into the pybullet environment. However, it comes up with the
"error: Cannot load SDF file."
My code is as follows:

import pybullet as p
import time
import pybullet_data
physicsClient = p.connect(p.GUI)
p.setAdditionalSearchPath(pybullet_data.getDataPath())
p.setGravity(0,0,-10)
planeId = p.loadSDF("plane_stadium.sdf")
boxId = p.loadSDF("free_loop.sdf")

for i in range (3000):
p.stepSimulation()
time.sleep(1./240.)
p.disconnect()


I have made sure that the files are in the correct directory.
The free_loop.sdf file has a closed loop structure ( wherein the links are connected in a loop)
I wonder, if it is not possible to load an SDF file into pybullet which has a closed structure (unlike the tree structure of URDF format)?
Is there any easy workaround to this? Any example would be appreciated.
Thank you!
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA
Contact:

Re: Simulating closed loop structure in PyBullet

Post by Erwin Coumans »

SDF and URDF files need to be tree structure/ open loop.

PyBullet provides user constraints to close loops.
See our Minitaur example how to add such constraint.
https://github.com/bulletphysics/bullet ... ur.py#L391
See createConstraint in the examples and PyBullet Quickstart Guide.
https://docs.google.com/document/d/10sX ... e70wns7io3
Post Reply