You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to create rope with rigid bodies connected with joints, but rope keep moving even when disturbed as you can see in the video.
this is how i am creating joints between rigid bodies. Could you tell me whats is the problem and also is it a correct way to create joints?
`@classmethod
def bead_joint(cls, num_bead, radius):
ENV_REGEX_NS = "/World/envs/env_0"
stage = sim_utils.SimulationContext().stage
# Start at 1 so that (i-1) is always valid.
for i in range(1,num_bead):
joint_prim_path = f'{ENV_REGEX_NS}/rope/bead_{i - 1}/joint_{i}'
joint = UsdPhysics.SphericalJoint.Define(stage, joint_prim_path)
joint.CreateJointEnabledAttr(True)
joint.CreateBody0Rel().SetTargets([f'{ENV_REGEX_NS}/rope/bead_{i - 1}'])
joint.CreateBody1Rel().SetTargets([f'{ENV_REGEX_NS}/rope/bead_{i}'])
# Set both local positions to zero if the joint is at the bead's center.
joint.CreateLocalPos0Attr().Set(Gf.Vec3f(0.0, -radius, 0.0))
joint.CreateLocalPos1Attr().Set(Gf.Vec3f(0.0, radius, 0.0))
# Optionally, set joint rotations if needed.
rotation = Gf.Quatf(0,0,0,1) # Identity rotation
joint.CreateLocalRot0Attr().Set(rotation)
# joint.CreateLocalRot1Attr().Set(rotation)
# joint.CreateLocalRot1Attr().Set(rotation) # Rotation relative to Cube2
prim = joint.GetPrim()
drive_api = UsdPhysics.DriveAPI.Get(prim, "angular") or UsdPhysics.DriveAPI.Apply(prim, "angular")
stiffness = random.uniform(10,50)
damping = random.uniform(10,50)
drive_api.CreateStiffnessAttr().Set(stiffness)
drive_api.CreateDampingAttr().Set(random.uniform(10,50))
print('Joint Created')
return stiffness, damping`
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Untitled.design.mp4
I am trying to create rope with rigid bodies connected with joints, but rope keep moving even when disturbed as you can see in the video.
this is how i am creating joints between rigid bodies. Could you tell me whats is the problem and also is it a correct way to create joints?
Beta Was this translation helpful? Give feedback.
All reactions