Skip to content

[Core] Refactor and cleanup core subpackage for 3.0 [3/N] - #7979

Merged
StafaH merged 4 commits into
isaac-sim:developfrom
StafaH:core-cleanup/03-utils-fixes
Sep 24, 2026
Merged

StafaH merged 4 commits into
isaac-sim:developfrom
StafaH:core-cleanup/03-utils-fixes

Conversation

@StafaH

@StafaH StafaH commented Sep 23, 2026 •

Copy link
Copy Markdown
Collaborator

Description

Third PR in a series that splits the core cleanup in #7949 into small, reviewable pieces. This one fixes five small bugs in isaaclab.utils and the camera utilities. Each fix has a regression test that fails without it.

Fixes

  • utils.math.unproject_depth: homogeneous pixel coordinates were built as (1, u, v) instead of (u, v, 1) (pad(..., (0, 0, 1, 0)) instead of (0, 0, 0, 1)), so every unprojected point was wrong and the first image row became inf/nan. This regressed in Changes Quaternion convention from WXYZ to XYZW #4437 (quaternion convention change), where the padding was flipped together with the quaternion code. It also affects create_pointcloud_from_depth / create_pointcloud_from_rgbd and the run_usd_camera.py / run_ray_caster_camera.py tutorials. This fix is in its own commit.
  • sensors.camera.utils.create_pointcloud_from_rgbd: a color tuple or rgb=None called torch.Tensor(data, device=..., dtype=...), which always raises TypeError. The uniform color is now built with torch.tensor(...).repeat(...) on the point cloud's device. The comment and docstring claiming the default color is white are corrected (it is black).
  • utils.math.quat_slerp: q2 *= -1.0 negated the caller's tensor in place when taking the shorter arc; it is now q2 = -q2.
  • utils.sensors.convert_camera_intrinsics_to_usd: abs() was applied to the boolean (c_x - w/2) > 1e-4 or ..., so a principal point left of or above the image center never triggered the aperture-offset warning.
  • utils.datasets.HDF5DatasetFileHandler.create: a bare file name gave os.path.dirname(...) == "" and os.makedirs("") raised. The directory is now only created when there is one.

Tests (focused checks, no new test files; together they run in about 2.5 s). The aperture-offset warning fix is a one-line abs() correction and is not covered by a dedicated test.

  • test/utils/test_math.py: new test_unproject_depth (compares against the pinhole model); the existing test_quat_slerp now also asserts that q2 is left unchanged.
  • test/utils/test_hdf5_dataset_file_handler.py: test_create_dataset_file also covers a bare file name.
  • test/sensors/test_opencv_distortion.py (kit-less): test_pointcloud_from_rgbd_uniform_color (color tuple and None).

All of these fail against develop sources and pass with the fixes; the three touched test files pass in full.

Release backport

  • Backport this pull request to the active release branch after it merges into develop

Type of change

  • Bug fix (non-breaking change which fixes an issue)

Checklist

  • I have read and understood the contribution guidelines
  • I have run the pre-commit checks 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 added a changelog fragment under source/<pkg>/changelog.d/ for every touched package (do not edit CHANGELOG.rst or bump extension.toml — CI handles that)
  • I have added my name to the CONTRIBUTORS.md or my name already exists there

@StafaH
StafaH requested a review from a team September 23, 2026 19:17
@github-actions github-actions Bot added bug Something isn't working isaac-lab Related to Isaac Lab team labels Sep 23, 2026
@greptile-apps

greptile-apps Bot commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 4/5

The PR appears safe to merge, with only a non-blocking public-docstring inconsistency to correct.

Findings

  1. P2 Default color docs conflict ▶

Summary

This PR fixes five independent utility defects involving point-cloud colors, depth unprojection, quaternion interpolation, camera-offset warnings, and bare HDF5 filenames.

  • Corrects homogeneous pixel-coordinate ordering during depth unprojection.
  • Avoids mutating quaternion interpolation inputs.
  • Handles uniform point-cloud colors and HDF5 paths safely.
  • Detects camera principal-point offsets in every direction.
  • Adds focused regression coverage for each corrected behavior.

Reviews (1) · Last reviewed commit: "Fix homogeneous pixel coordinates in unp..."

@isaaclab-review-bot isaaclab-review-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isaac Lab Review Bot

Reviewed five localized fixes across depth unprojection, RGB-D point-cloud coloring, quaternion interpolation, camera-intrinsics warnings, and HDF5 file creation. The changes are narrowly scoped, covered by regression tests, and documented in the package changelog.

  • Design and architecture: The fixes remain within the modules that own each behavior and introduce no new abstractions, dependencies, exports, or cross-package coupling. In particular, uniform color tensors are created on the generated point cloud's device, preserving compatibility with subsequent mask indexing.
  • API: Public signatures and expected return shapes remain unchanged. The patch restores homogeneous coordinates to (u, v, 1), prevents quat_slerp from mutating its input, makes tuple and default RGB paths operational, detects principal-point offsets in either direction, and supports HDF5 paths without a directory component.
  • Implementation: The changed producer and consumer paths are consistent: depth flattening matches the meshgrid ordering, point colors have the required (num_points, 3) shape and device, aperture-offset checks apply absolute values to numeric differences, and directory creation is skipped only for bare filenames. Regression coverage exercises each corrected behavior. The separate camera-utility test adds a broader import surface than the optional-module-guarded neighboring sensor test, but the supplied patch does not establish a concrete collection failure.

No blocking issues. No inline issue met the actionable-evidence threshold; the assessment above records the review feedback.

Automated review; human maintainers own approval decisions.

assert any("(1280, 720)" in message for message in mismatch_warnings)


def test_intrinsics_to_usd_warns_on_negative_aperture_offset(caplog):

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we need this test

@StafaH

StafaH commented Sep 23, 2026

Copy link
Copy Markdown
Collaborator Author

run-ci

@isaaclab-bot isaaclab-bot Bot added ci:run-docker Trigger the on-demand Docker and GPU CI workflow and removed ci:run-docker Trigger the on-demand Docker and GPU CI workflow labels Sep 23, 2026
@StafaH
StafaH merged commit ddc6ec4 into isaac-sim:develop Sep 24, 2026
53 checks passed
@isaaclab-bot

isaaclab-bot Bot commented Sep 24, 2026

Copy link
Copy Markdown
Contributor

Backported to release/3.0.0 as 58d6da2.

isaaclab-bot Bot pushed a commit that referenced this pull request Sep 24, 2026
# Description

Third PR in a series that splits the core cleanup in #7949 into small,
reviewable pieces. This one fixes five small bugs in `isaaclab.utils`
and the camera utilities. Each fix has a regression test that fails
without it.

**Fixes**
- `utils.math.unproject_depth`: homogeneous pixel coordinates were built
as `(1, u, v)` instead of `(u, v, 1)` (`pad(..., (0, 0, 1, 0))` instead
of `(0, 0, 0, 1)`), so every unprojected point was wrong and the first
image row became `inf`/`nan`. This regressed in #4437 (quaternion
convention change), where the padding was flipped together with the
quaternion code. It also affects `create_pointcloud_from_depth` /
`create_pointcloud_from_rgbd` and the `run_usd_camera.py` /
`run_ray_caster_camera.py` tutorials. This fix is in its own commit.
- `sensors.camera.utils.create_pointcloud_from_rgbd`: a color tuple or
`rgb=None` called `torch.Tensor(data, device=..., dtype=...)`, which
always raises `TypeError`. The uniform color is now built with
`torch.tensor(...).repeat(...)` on the point cloud's device. The comment
and docstring claiming the default color is white are corrected (it is
black).
- `utils.math.quat_slerp`: `q2 *= -1.0` negated the caller's tensor in
place when taking the shorter arc; it is now `q2 = -q2`.
- `utils.sensors.convert_camera_intrinsics_to_usd`: `abs()` was applied
to the boolean `(c_x - w/2) > 1e-4 or ...`, so a principal point left of
or above the image center never triggered the aperture-offset warning.
- `utils.datasets.HDF5DatasetFileHandler.create`: a bare file name gave
`os.path.dirname(...) == ""` and `os.makedirs("")` raised. The directory
is now only created when there is one.

**Tests** (focused checks, no new test files; together they run in about
2.5 s). The aperture-offset warning fix is a one-line `abs()` correction
and is not covered by a dedicated test.
- `test/utils/test_math.py`: new `test_unproject_depth` (compares
against the pinhole model); the existing `test_quat_slerp` now also
asserts that `q2` is left unchanged.
- `test/utils/test_hdf5_dataset_file_handler.py`:
`test_create_dataset_file` also covers a bare file name.
- `test/sensors/test_opencv_distortion.py` (kit-less):
`test_pointcloud_from_rgbd_uniform_color` (color tuple and `None`).

All of these fail against `develop` sources and pass with the fixes; the
three touched test files pass in full.

## Release backport

- [x] <!-- backport-active-release --> Backport this pull request to the
active release branch after it merges into `develop`

## Type of change

- Bug fix (non-breaking change which fixes an issue)

## Checklist

- [x] I have read and understood the [contribution
guidelines](https://isaac-sim.github.io/IsaacLab/main/source/refs/contributing.html)
- [x] I have run the [`pre-commit` checks](https://pre-commit.com/) with
`./isaaclab.sh --format`
- [ ] I have made corresponding changes to the documentation
- [x] My changes generate no new warnings
- [x] I have added tests that prove my fix is effective or that my
feature works
- [x] I have added a changelog fragment under
`source/<pkg>/changelog.d/` for every touched package (do **not** edit
`CHANGELOG.rst` or bump `extension.toml` — CI handles that)
- [x] I have added my name to the `CONTRIBUTORS.md` or my name already
exists there

(cherry picked from commit ddc6ec4)
@StafaH
StafaH deleted the core-cleanup/03-utils-fixes branch October 10, 2026 19:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working isaac-lab Related to Isaac Lab team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants