bulletphysics / bullet3

Bullet Physics SDK: real-time collision detection and multi-physics simulation for VR, games, visual effects, robotics, machine learning etc.
http://bulletphysics.org
Other
12.4k stars 2.86k forks source link

Connecting two loaded URDF models with a gear constraint = crash #4463

Open manas96 opened 1 year ago

manas96 commented 1 year ago

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.

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()

**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 :**

<?xml version="1.0"?>

**mesh.dae** :

<?xml version="1.0" encoding="utf-8"?>

Blender User Blender 3.3.0 commit date:2022-09-06, commit time:15:39, hash:0759f671ce1f 2023-04-15T16:28:44 2023-04-15T16:28:44 Z_UP 0 0 0 1 0.8 0.8 0.8 1 1.45 1 1 1 1 1 -1 1 -1 1 1 -1 -1 -1 1 1 -1 1 -1 -1 -1 1 -1 -1 -1 0 0 1 0 -1 0 -1 0 0 0 0 -1 1 0 0 0 1 0 0.875 0.5 0.625 0.75 0.625 0.5 0.625 0.75 0.375 1 0.375 0.75 0.625 0 0.375 0.25 0.375 0 0.375 0.5 0.125 0.75 0.125 0.5 0.625 0.5 0.375 0.75 0.375 0.5 0.625 0.25 0.375 0.5 0.375 0.25 0.875 0.5 0.875 0.75 0.625 0.75 0.625 0.75 0.625 1 0.375 1 0.625 0 0.625 0.25 0.375 0.25 0.375 0.5 0.375 0.75 0.125 0.75 0.625 0.5 0.625 0.75 0.375 0.75 0.625 0.25 0.625 0.5 0.375 0.5

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

1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1
manas96 commented 1 year ago

image 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.