Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

createMultiBody for JOINT_SPHERICAL #4646

Open
unishuai opened this issue Jul 28, 2024 · 0 comments
Open

createMultiBody for JOINT_SPHERICAL #4646

unishuai opened this issue Jul 28, 2024 · 0 comments

Comments

@unishuai
Copy link

unishuai commented Jul 28, 2024

i want to create multibody to simulate cable.And I referred to the code in the snake.py example, but unfortunately, it didn't produce any effect.i check the console ,but there are no problems.my code is here:

visualShapeId = -1
link_Masses = []
linkCollisionShapeIndices = []
linkVisualShapeIndices = []
linkPositions = []
linkOrientations = []
linkInertialFramePositions = []
linkInertialFrameOrientations = []
indices = []
jointTypes = []
axis = []

for i in range(36):
link_Masses.append(5)
colBallId = p.createCollisionShape(p.GEOM_CAPSULE,
radius=sphereRadius, height=height)
linkCollisionShapeIndices.append(colBallId)
linkVisualShapeIndices.append(-1)

# basePosition = [0, i * sphereRadius * 2 + i * height, 0.1]
baseOrientation = p.getQuaternionFromEuler(baseAngle)
linkPositions.append([0, 0, sphereRadius * 2.0 +height])

linkOrientations.append([0,0,0,1])
linkInertialFramePositions.append([0, 0, 0])
linkInertialFrameOrientations.append([0, 0, 0, 1])
indices.append(i)
if i ==0:
    jointTypes.append(p.JOINT_FIXED)
else:
    jointTypes.append(p.JOINT_SPHERICAL)
axis.append([0, 0, 0])

basePosition = [0, 0, 1]
baseOrientation = [0, 0, 0, 1]
sphereUid = p.createMultiBody(mass,
colBallId,
visualShapeId,
basePosition,
baseOrientation,
linkMasses=link_Masses,
linkCollisionShapeIndices=linkCollisionShapeIndices,
linkVisualShapeIndices=linkVisualShapeIndices,
linkPositions=linkPositions,
linkOrientations=linkOrientations,
linkInertialFramePositions=linkInertialFramePositions,
linkInertialFrameOrientations=linkInertialFrameOrientations,
linkParentIndices=indices,
linkJointTypes=jointTypes,
linkJointAxis=axis,
useMaximalCoordinates=useMaximalCoordinates
)
cableTest.txt

it`s similar to the snake.py, but it does not work

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant