Skip to content

Commit 8e57a3a

Browse files
Adds math tests for transforms, rotations, and conversions (#103) (#2801)
# Description this PR adds tests for: - scale_transform - unscale_transform - saturate - normalize - copysign - convert_quat - quat_conjugate - quat_from_euler_xyz - quat_from_matrix - euler_xyz_from_quat - matrix_from_euler - quat_from_angle_axis - axis_angle_from_quat - skew_symmetric_matrix - combine_transform - subtract_transform - compute_pose_error Fixes # (issue) ## Type of change <!-- As you go through the list, delete the ones that are not applicable. --> - Bug fix (non-breaking change which fixes an issue) - New feature (non-breaking change which adds functionality) ## Checklist - [ ] I have run the [`pre-commit` checks](https://pre-commit.com/) with `./isaaclab.sh --format` - [ ] I have made corresponding changes to the documentation - [ ] My changes generate no new warnings - [ ] I have added tests that prove my fix is effective or that my feature works - [ ] I have updated the changelog and the corresponding version in the extension's `config/extension.toml` file - [ ] I have added my name to the `CONTRIBUTORS.md` or my name already exists there <!-- As you go through the checklist above, you can mark something as done by putting an x character in it For example, - [x] I have done this task - [ ] I have not done this task --> --------- Signed-off-by: James Tigue <166445701+jtigue-bdai@users.noreply.github.com> Signed-off-by: Kelly Guo <kellyg@nvidia.com> Co-authored-by: Kelly Guo <kellyg@nvidia.com>
1 parent 0eb323e commit 8e57a3a

File tree

4 files changed

+400
-8
lines changed

4 files changed

+400
-8
lines changed

source/isaaclab/config/extension.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22

33
# Note: Semantic Versioning is used: https://semver.org/
4-
version = "0.40.16"
4+
version = "0.40.17"
55

66
# Description
77
title = "Isaac Lab framework for Robot Learning"

source/isaaclab/docs/CHANGELOG.rst

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,37 @@
11
Changelog
22
---------
33

4+
0.40.17 (2025-07-10)
5+
~~~~~~~~~~~~~~~~~~~~
6+
7+
Added
8+
^^^^^
9+
10+
* Added unit tests for multiple math functions:
11+
:func:`~isaaclab.utils.math.scale_transform`.
12+
:func:`~isaaclab.utils.math.unscale_transform`.
13+
:func:`~isaaclab.utils.math.saturate`.
14+
:func:`~isaaclab.utils.math.normalize`.
15+
:func:`~isaaclab.utils.math.copysign`.
16+
:func:`~isaaclab.utils.math.convert_quat`.
17+
:func:`~isaaclab.utils.math.quat_conjugate`.
18+
:func:`~isaaclab.utils.math.quat_from_euler_xyz`.
19+
:func:`~isaaclab.utils.math.quat_from_matrix`.
20+
:func:`~isaaclab.utils.math.euler_xyz_from_quat`.
21+
:func:`~isaaclab.utils.math.matrix_from_euler`.
22+
:func:`~isaaclab.utils.math.quat_from_angle_axis`.
23+
:func:`~isaaclab.utils.math.axis_angle_from_quat`.
24+
:func:`~isaaclab.utils.math.skew_symmetric_matrix`.
25+
:func:`~isaaclab.utils.math.combine_transform`.
26+
:func:`~isaaclab.utils.math.subtract_transform`.
27+
:func:`~isaaclab.utils.math.compute_pose_error`.
28+
29+
Changed
30+
^^^^^^^
31+
32+
* Changed the implementation of :func:`~isaaclab.utils.math.copysign` to better reflect the documented functionality.
33+
34+
435
0.40.16 (2025-07-08)
536
~~~~~~~~~~~~~~~~~~~~
637

source/isaaclab/isaaclab/utils/math.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,8 @@ def copysign(mag: float, other: torch.Tensor) -> torch.Tensor:
133133
Returns:
134134
The output tensor.
135135
"""
136-
mag_torch = torch.tensor(mag, device=other.device, dtype=torch.float).repeat(other.shape[0])
137-
return torch.abs(mag_torch) * torch.sign(other)
136+
mag_torch = abs(mag) * torch.ones_like(other)
137+
return torch.copysign(mag_torch, other)
138138

139139

140140
"""
@@ -250,7 +250,7 @@ def quat_conjugate(q: torch.Tensor) -> torch.Tensor:
250250
"""
251251
shape = q.shape
252252
q = q.reshape(-1, 4)
253-
return torch.cat((q[:, 0:1], -q[:, 1:]), dim=-1).view(shape)
253+
return torch.cat((q[..., 0:1], -q[..., 1:]), dim=-1).view(shape)
254254

255255

256256
@torch.jit.script
@@ -401,7 +401,7 @@ def _axis_angle_rotation(axis: Literal["X", "Y", "Z"], angle: torch.Tensor) -> t
401401

402402
def matrix_from_euler(euler_angles: torch.Tensor, convention: str) -> torch.Tensor:
403403
"""
404-
Convert rotations given as Euler angles in radians to rotation matrices.
404+
Convert rotations given as Euler angles (intrinsic) in radians to rotation matrices.
405405
406406
Args:
407407
euler_angles: Euler angles in radians. Shape is (..., 3).
@@ -436,7 +436,7 @@ def euler_xyz_from_quat(
436436
"""Convert rotations given as quaternions to Euler angles in radians.
437437
438438
Note:
439-
The euler angles are assumed in XYZ convention.
439+
The euler angles are assumed in XYZ extrinsic convention.
440440
441441
Args:
442442
quat: The quaternion orientation in (w, x, y, z). Shape is (N, 4).

0 commit comments

Comments
 (0)