I want to connect two rigid objects (or a static world and a rigid object) using a hinge/rotary constraint. Eg. A gear loaded from a URDF file.
Long story short, I cannot use the link feature in a single URDF file. The objects have to be loaded separately using pb.loadURDF().
I am aware I can connect two bodies using createConstraint(). I looked at the mimicJointConstraint.py example and tried to use JOINT_GEAR in a similar way:
import time
import pybullet as pb
import pybullet_data
**The simulation crashes when trying to create the constraint. What am I doing wrong?**
Here is the URDF file data, which describes a thin box:
**slate.urdf :**
This is the error I get, which looks like a memory access violation. How would I go about debugging such an issue?
I am currently trying to build pybullet from source in debug mode to see if I can investigate more.
I want to connect two rigid objects (or a static world and a rigid object) using a hinge/rotary constraint. Eg. A gear loaded from a URDF file.
pb.loadURDF()
.createConstraint()
. I looked at the mimicJointConstraint.py example and tried to use JOINT_GEAR in a similar way:server = pb.connect(pb.GUI)
pb.setAdditionalSearchPath(pybullet_data.getDataPath()) pb.loadURDF('plane100.urdf',[0,0,-2])
slate = './slate.urdf'
body1 = pb.loadURDF(slate) body2 = pb.loadURDF(slate, basePosition=[0,-1,0])
c = pb.createConstraint(body1, -1, body2, -1, jointType=pb.JOINT_GEAR, jointAxis=[1, 0, 0], parentFramePosition=[0, 0, 0], childFramePosition=[0, 0, 0])
while 1: time.sleep(1./240.) pb.stepSimulation()
<?xml version="1.0"?>
<?xml version="1.0" encoding="utf-8"?>
4 0 0 2 0 1 0 0 2 2 1 3 7 1 4 3 1 5 6 2 6 5 2 7 7 2 8 1 3 9 7 3 10 5 3 11 0 4 12 3 4 13 1 4 14 4 5 15 1 5 16 5 5 17 4 0 18 6 0 19 2 0 20 2 1 21 6 1 22 7 1 23 6 2 24 4 2 25 5 2 26 1 3 27 3 3 28 7 3 29 0 4 30 2 4 31 3 4 32 4 5 33 0 5 34 1 5 35