Skip to content

Adds unit tests for Assets interface checks using mocks#4768

Open
AntoineRichard wants to merge 4 commits intoisaac-sim:developfrom
AntoineRichard:antoiner/layer_1_class_checks
Open

Adds unit tests for Assets interface checks using mocks#4768
AntoineRichard wants to merge 4 commits intoisaac-sim:developfrom
AntoineRichard:antoiner/layer_1_class_checks

Conversation

@AntoineRichard
Copy link
Collaborator

Description

Adds unit tests for assets interface checks using mocks.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)

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 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

@github-actions github-actions bot added the isaac-lab Related to Isaac Lab team label Feb 27, 2026
@AntoineRichard AntoineRichard changed the title Antoiner/layer 1 class checks Adds unit tests for Asset interface checks using mocks. Feb 27, 2026
@AntoineRichard AntoineRichard changed the title Adds unit tests for Asset interface checks using mocks. Adds unit tests for Assets interface checks using mocks Feb 27, 2026
@greptile-apps
Copy link
Contributor

greptile-apps bot commented Feb 27, 2026

Greptile Summary

This PR adds comprehensive unit tests for articulation interface validation using mocks, enabling testing without Isaac Sim. The test infrastructure validates that Mock and PhysX backends comply with the same interface contract, checking data types, shapes, and writer methods across 1800+ test cases.

Key Changes:

  • New test suite validates articulation properties, data accessors, and write methods
  • Mock articulation updated with shape validation and proper warp dtype handling
  • PhysX articulation refactored to use helper methods for mask resolution
  • Documentation fixes for COM pose setters

Critical Issue:

  • Line 4321 in articulation.py has an indexing bug: uses [0] instead of [:, 0] when resolving joint masks, causing incorrect behavior when multiple joints match the mask

Confidence Score: 3/5

  • Contains a critical logic bug that will cause runtime errors with joint masks
  • The indexing bug in _resolve_joint_mask() will break joint masking operations, but the extensive test suite should catch it during testing. Other changes are solid refactoring and test infrastructure improvements
  • Fix the indexing bug in articulation.py:4321 before merging - this will cause incorrect joint selection when using masks

Important Files Changed

Filename Overview
source/isaaclab/isaaclab/test/mock_interfaces/assets/mock_articulation.py Adds shape validation infrastructure and implements proper dtype handling for warp structured types with pointer arithmetic for velocity/acceleration views
source/isaaclab/test/assets/test_articulation_iface.py New comprehensive test suite (1816 lines) for articulation interface validation across Mock and PhysX backends - includes property, data, and writer tests
source/isaaclab_physx/isaaclab_physx/assets/articulation/articulation.py Refactors mask resolution with helper methods and adds _get_cpu_env_ids(). Contains critical indexing bug in _resolve_joint_mask() at line 4321

Last reviewed commit: 395d640

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

5 files reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

if joint_mask is not None:
if isinstance(joint_mask, wp.array):
joint_mask = wp.to_torch(joint_mask)
joint_ids = torch.nonzero(joint_mask)[0].to(torch.int32)
Copy link
Contributor

Choose a reason for hiding this comment

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

Indexing error: should use [:, 0] instead of [0]

torch.nonzero() returns a 2D tensor where each row contains indices. Using [0] only gets the first row (a single element), whereas [:, 0] correctly gets all elements from the first column. This is inconsistent with all other mask resolver methods in this file.

Suggested change
joint_ids = torch.nonzero(joint_mask)[0].to(torch.int32)
joint_ids = torch.nonzero(joint_mask)[:, 0].to(torch.int32)

@kellyguo11
Copy link
Contributor

looks like needs to run the formatter :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

isaac-lab Related to Isaac Lab team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants