# Simplifying joint position and rotation

I’m just starting out with Isaac Sim and am finding specifying the joint positions and rotations confusing.

As far as I can tell, the joint positions are specified in terms of the unscaled positions, so that if a cylinder has a z-scale of 3, and you want to put the joint position on the top, then you specify 0.5.

Similarly, the rotations seem to be in terms of the original rotation of the part, before it is rotated. So that if you want a part to rotate around the z axis, but it was rotated 90 degrees, you might instead specify the x or y axis.

Is there a way to specify these joint positions and rotations in terms of the world reference frame after their scaling and rotation instead of in terms of their frame before the scaling and rotations?

Would adding a Xform or TransformOp somehow help simplify this or are those unrelated? Any documentation or videos that breaks this stuff down?

Thanks!

-Dan

Hi,
PhysicsJoint poses are always in local space with respect to the provided bodies.
As explicitly said in the schema:

The attributes are localPos, localRot. Since physics cant really natively support scale, this has to be a in local space, so that once you scale up/scale down your assets, joints will still work, because its just a local space position/rotation.

The joint UsdPrim - UsdPhysicsJoint does not have any transformation nor transformOp, its derived from UsdImageable, so things are rendered under it, but it does not have a transformation.

The joint is always specified as something that connects two bodies, while it hold local pose from body0 and local pose from body1. This defines the joint poses with respect to given bodies. The joint itself does not have a transformation.

Here is an example of creating a joint between two prims, how the relative pose is computed:

``````        to_pose = xfCache.GetLocalToWorldTransform(to_prim)
from_pose = xfCache.GetLocalToWorldTransform(from_prim)
rel_pose = to_pose * from_pose.GetInverse()
rel_pose = rel_pose.RemoveScaleShear()
pos1 = Gf.Vec3f(rel_pose.ExtractTranslation())
rot1 = Gf.Quatf(rel_pose.ExtractRotationQuat())

component.CreateBody0Rel().SetTargets([Sdf.Path(from_path)])
component.CreateBody1Rel().SetTargets([Sdf.Path(to_path)])
component.CreateLocalPos0Attr().Set(pos1)
component.CreateLocalRot0Attr().Set(rot1)
component.CreateLocalPos1Attr().Set(Gf.Vec3f(0.0))
component.CreateLocalRot1Attr().Set(Gf.Quatf(1.0))
``````

Hope that helps,
Regards,
Ales

I didn’t understand everything (I’m new to Omniverse, Isaac Sim, …), but it sounds like you’re saying there’s no way using only the GUI to change reference frames and specify the joint positions/rotations in a non-local manner. Let me know if I misunderstood.

Thanks!

Ah ok, yes you should be able to do so, but unfortunately there is a limitation to that.
If you select the joint you should see a gizmo that allows you to manipulate those local poses. Its not a transformation gizmo for the joint, but it transforms the local poses relative to the bodies.
However this only works if both poses match the same final world position, meaning both poses are aligned. If they are misaligned you see two axis only displayed without a way to modify them. You can right click on the local pose in the property window to align the poses and then you can manipulate it.

I did attached a video showing how to manipulate the joint poses using the gizmo:

Hope that helps,
Regards,
Ales

That’s great – that’s a bunch of of things I didn’t know about – thanks!

Hi Ales, can you expound further on the code you posted? It seems like the local position/rotation for rotation/position 1 is always (0,0,0) with no rotation. But physically a joint should be on the outside of an object since materials can’t pass through each other. Why is this ok? Why won’t it cause a snap warning?

Also, what exactly is the result of multiplying one world coordinate by another world coordinate’s inverse? And why does scale-shear need to be removed?

Thanks!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.