Quantcast
Channel: Recent Questions - Stack Overflow
Viewing all articles
Browse latest Browse all 12141

In PyBullet, the soft body and rigid body do not attach properly

$
0
0

In PyBullet, I'm trying to attach a soft body to a rigid body using p.createConstraint(), but it's not working properly. I referred to the following code: https://github.com/bulletphysics/bullet3/blob/master/examples/pybullet/examples/reduced_deformable_cube.py

import pybullet as pfrom time import sleepimport pybullet_dataphysicsClient = p.connect(p.GUI)p.setAdditionalSearchPath(pybullet_data.getDataPath())p.resetSimulation(p.RESET_USE_REDUCED_DEFORMABLE_WORLD)p.resetDebugVisualizerCamera(4,-40,-30,[0, 0, 0])p.setGravity(0, 0, -10)tex = p.loadTexture("uvmap.png")planeId = p.loadURDF("plane.urdf", [0,0,-2])boxId = p.loadURDF("cube.urdf", [1,2,1],useMaximalCoordinates = True)cube = p.loadURDF("reduced_cube/reduced_cube.urdf", [1,1,1])p.changeVisualShape(cube, -1, rgbaColor=[1,1,1,1], textureUniqueId=tex, flags=0)p.setPhysicsEngineParameter(sparseSdfVoxelSize=0.25)p.setRealTimeSimulation(0)p.createConstraint(parentBodyUniqueId= cube, parentLinkIndex=-1, childBodyUniqueId = boxId, childLinkIndex = -1, jointType = p.JOINT_FIXED, jointAxis=(0, 0, 0),                    parentFramePosition=(1, 0.0, 0.0), childFramePosition=(1, 0.0, 0.0))while p.isConnected():  p.stepSimulation()  p.getCameraImage(320,200)  p.setGravity(0,0,-10)

Error message is below.

File "/home/ericlab/デスクトップ/sato/bullet3/examples/pybullet/examples/reduced_deformable_cube.py", line 27, in <module>    p.createConstraint(parentBodyUniqueId= cube, parentLinkIndex=-1, childBodyUniqueId = boxId, childLinkIndex = -1, jointType = p.JOINT_FIXED, jointAxis=(0, 0, 0),pybullet.error: createConstraint failed.

Viewing all articles
Browse latest Browse all 12141

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>