Skip to content

Commit d2aa309

Browse files
committed
Use matrix mul to compose rotations in test_pink_ik
calculate_rotation_error used element-wise '*' between two 3x3 rotation matrices where matrix multiplication '@' was intended. The Hadamard product of two rotation matrices is not generally a rotation matrix -- its columns are not orthonormal and its determinant is not 1 -- so the quat_from_matrix consumer downstream produced either a non-unit garbage quaternion (pre-isaac-sim#5609) or NaN (after the unit-norm guard added in that PR). The bug was masked for ~9 months because the Hadamard product of two near-identity matrices is also near-identity, so the resulting quat was close enough to unit for quat_from_matrix to round-trip cleanly. Once IK didn't converge to literal identity -- different seed, different robot, more aggressive setpoint -- the assertion 'Left hand IK rotation error (nan) exceeds tolerance' started firing on develop. Local reproduction on isaaclab_physx with newton rc2 (current develop): - Unfixed: Isaac-PickPlace-GR1T2-Abs-v0 horizontal_movement fails with NaN rotation error on both hands. - Fixed: same parameterization passes with rotation errors at 1e-4 to 1e-7, well within the 0.02 rad tolerance. 11 of 11 GR1T2 cases pass deterministically across re-runs. Bug introduced by isaac-sim#3149.
1 parent a5eb9ad commit d2aa309

2 files changed

Lines changed: 15 additions & 1 deletion

File tree

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
Fixed
2+
^^^^^
3+
4+
* Fixed ``calculate_rotation_error`` in ``source/isaaclab/test/controllers/test_pink_ik.py``
5+
using element-wise multiplication (``*``) instead of matrix multiplication (``@``) to
6+
compose two rotation matrices, producing a non-rotation matrix and propagating ``NaN``
7+
through ``quat_from_matrix`` (after the unit-norm guard added by
8+
`isaac-sim/IsaacLab#5609 <https://github.com/isaac-sim/IsaacLab/pull/5609>`_). The latent
9+
bug was introduced in `isaac-sim/IsaacLab#3149
10+
<https://github.com/isaac-sim/IsaacLab/pull/3149>`_ and masked for ~9 months because the
11+
Hadamard and matrix products of two near-identity rotation matrices are close enough that
12+
``quat_from_matrix`` could still return a near-unit quaternion. Once IK no longer
13+
converged to literal identity (e.g., G1 envs or any seed perturbation), the assertion
14+
``Left hand IK rotation error (nan) exceeds tolerance`` started firing.

source/isaaclab/test/controllers/test_pink_ik.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ def calculate_rotation_error(current_rot, target_rot):
306306
target_rot_tensor = target_rot_tensor.unsqueeze(0).expand(current_rot.shape[0], -1)
307307

308308
return axis_angle_from_quat(
309-
quat_from_matrix(matrix_from_quat(target_rot_tensor) * matrix_from_quat(quat_inv(current_rot)))
309+
quat_from_matrix(matrix_from_quat(target_rot_tensor) @ matrix_from_quat(quat_inv(current_rot)))
310310
)
311311

312312

0 commit comments

Comments
 (0)