@@ -193,11 +193,15 @@ def _eval_rotation_jacobian_blocks(
193193
194194@wp .func
195195def _eval_passive_universal_jacobian_blocks (
196- X_T : wp .mat33f , q_base : wp .quatf , q_follower : wp .quatf , has_base : wp .bool
196+ X_B_T : wp .mat33f ,
197+ X_F_T : wp .mat33f ,
198+ q_base : wp .quatf ,
199+ q_follower : wp .quatf ,
200+ has_base : wp .bool ,
197201) -> tuple [wp .vec4f , wp .vec4f ]:
198202 """Evaluate the base and follower blocks of a passive universal constraint Jacobian."""
199- a_x = X_T [0 ]
200- a_y = X_T [1 ]
203+ a_x = X_B_T [0 ] # x-axis on base
204+ a_y = X_F_T [1 ] # y-axis on follower
201205 jac_q_base = wp .vec4f (0.0 )
202206 if has_base :
203207 a_y_follower = unit_quat_apply (q_follower , a_y )
@@ -970,6 +974,7 @@ def _eval_joint_constraints(
970974 joints_bid_B : wp .array [wp .int32 ],
971975 joints_bid_F : wp .array [wp .int32 ],
972976 joints_X_Bj : wp .array [wp .mat33f ],
977+ joints_X_Fj : wp .array [wp .mat33f ],
973978 joints_B_r_B : wp .array [wp .vec3f ],
974979 joints_F_r_F : wp .array [wp .vec3f ],
975980 bodies_q : wp .array [wp .transformf ],
@@ -996,6 +1001,7 @@ def _eval_joint_constraints(
9961001 joints_bid_B: Joint base body id
9971002 joints_bid_F: Joint follower body id
9981003 joints_X_Bj: Joint local frame on base body
1004+ joints_X_Fj: Joint local frame on follower body
9991005 joints_B_r_B: Joint local position on base body
10001006 joints_F_r_F: Joint local position on follower body
10011007 bodies_q: Body poses
@@ -1059,7 +1065,7 @@ def _eval_joint_constraints(
10591065
10601066 # Compute constraint (dot product between x axis on base and y axis on follower)
10611067 a_x = X_T [0 ]
1062- a_y = X_T [1 ]
1068+ a_y = wp . transpose ( joints_X_Fj [ jt_id_tot ]) [1 ]
10631069 a_x_base = unit_quat_apply (q_base , a_x )
10641070 a_y_follower = unit_quat_apply (q_follower , a_y )
10651071 ct = - wp .dot (a_x_base , a_y_follower )
@@ -1168,6 +1174,7 @@ def _eval_joint_constraints_jacobian(
11681174 joints_bid_B : wp .array [wp .int32 ],
11691175 joints_bid_F : wp .array [wp .int32 ],
11701176 joints_X_Bj : wp .array [wp .mat33f ],
1177+ joints_X_Fj : wp .array [wp .mat33f ],
11711178 joints_B_r_B : wp .array [wp .vec3f ],
11721179 joints_F_r_F : wp .array [wp .vec3f ],
11731180 bodies_q : wp .array [wp .transformf ],
@@ -1191,6 +1198,7 @@ def _eval_joint_constraints_jacobian(
11911198 joints_bid_B: Joint base body id
11921199 joints_bid_F: Joint follower body id
11931200 joints_X_Bj: Joint local frame on base body
1201+ joints_X_Fj: Joint local frame on follower body
11941202 joints_B_r_B: Joint local position on base body
11951203 joints_F_r_F: Joint local position on follower body
11961204 bodies_q: Body poses
@@ -1272,7 +1280,7 @@ def _eval_joint_constraints_jacobian(
12721280
12731281 # Compute constraint Jacobian (cross product between x axis on base and y axis on follower)
12741282 jac_q_base , jac_q_follower = _eval_passive_universal_jacobian_blocks (
1275- X_T , q_base , q_follower , base_id_tot >= 0
1283+ X_T , wp . transpose ( joints_X_Fj [ jt_id_tot ]), q_base , q_follower , base_id_tot >= 0
12761284 )
12771285
12781286 # Write out Jacobian
@@ -1304,6 +1312,7 @@ def _eval_joint_constraints_sparse_jacobian(
13041312 joints_bid_B : wp .array [wp .int32 ],
13051313 joints_bid_F : wp .array [wp .int32 ],
13061314 joints_X_Bj : wp .array [wp .mat33f ],
1315+ joints_X_Fj : wp .array [wp .mat33f ],
13071316 joints_B_r_B : wp .array [wp .vec3f ],
13081317 joints_F_r_F : wp .array [wp .vec3f ],
13091318 bodies_q : wp .array [wp .transformf ],
@@ -1328,6 +1337,7 @@ def _eval_joint_constraints_sparse_jacobian(
13281337 joints_bid_B: Joint base body id
13291338 joints_bid_F: Joint follower body id
13301339 joints_X_Bj: Joint local frame on base body
1340+ joints_X_Fj: Joint local frame on follower body
13311341 joints_B_r_B: Joint local position on base body
13321342 joints_F_r_F: Joint local position on follower body
13331343 bodies_q: Body poses
@@ -1413,7 +1423,7 @@ def _eval_joint_constraints_sparse_jacobian(
14131423
14141424 # Compute constraint Jacobian (cross product between x axis on base and y axis on follower)
14151425 jac_q_base , jac_q_follower = _eval_passive_universal_jacobian_blocks (
1416- X_T , q_base , q_follower , base_id >= 0
1426+ X_T , wp . transpose ( joints_X_Fj [ jt_id_tot ]), q_base , q_follower , base_id >= 0
14171427 )
14181428
14191429 # Write out Jacobian
0 commit comments