Repository navigation
[Core] Refactor and cleanup core subpackage for 3.0 [3/N] - #7979
Conversation
…e names, and point cloud colors
|
There was a problem hiding this comment.
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), preventsquat_slerpfrom 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): |
There was a problem hiding this comment.
I don't think we need this test
|
run-ci |
|
Backported to |
# 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)
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.utilsand 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 becameinf/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 affectscreate_pointcloud_from_depth/create_pointcloud_from_rgbdand therun_usd_camera.py/run_ray_caster_camera.pytutorials. This fix is in its own commit.sensors.camera.utils.create_pointcloud_from_rgbd: a color tuple orrgb=Nonecalledtorch.Tensor(data, device=..., dtype=...), which always raisesTypeError. The uniform color is now built withtorch.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.0negated the caller's tensor in place when taking the shorter arc; it is nowq2 = -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 gaveos.path.dirname(...) == ""andos.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: newtest_unproject_depth(compares against the pinhole model); the existingtest_quat_slerpnow also asserts thatq2is left unchanged.test/utils/test_hdf5_dataset_file_handler.py:test_create_dataset_filealso covers a bare file name.test/sensors/test_opencv_distortion.py(kit-less):test_pointcloud_from_rgbd_uniform_color(color tuple andNone).All of these fail against
developsources and pass with the fixes; the three touched test files pass in full.Release backport
developType of change
Checklist
pre-commitchecks with./isaaclab.sh --formatsource/<pkg>/changelog.d/for every touched package (do not editCHANGELOG.rstor bumpextension.toml— CI handles that)CONTRIBUTORS.mdor my name already exists there