Adds mock interfaces to enable unit-testing and isolated benchmaking.#4491
Merged
kellyguo11 merged 44 commits intoisaac-sim:developfrom Feb 3, 2026
Merged
Conversation
Signed-off-by: Kelly Guo <kellyg@nvidia.com>
…us in full kitless mode.
… way we actually do it!
Collaborator
Author
|
@greptile give it a looksy |
Contributor
Greptile OverviewGreptile SummaryThis PR adds comprehensive mock interfaces for unit testing IsaacLab components without requiring Isaac Sim or GPU simulation. The implementation includes two layers: high-level mocks for sensors and assets ( Key additions:
Architectural improvements:
Issue found:
Confidence Score: 4/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant Test as Test Code
participant MockAsset as MockArticulation
participant MockData as MockArticulationData
participant MockView as MockArticulationView
participant Tensor as PyTorch Tensors
Note over Test,Tensor: Initialization Phase
Test->>MockAsset: MockArticulation(num_instances=4, num_joints=12)
MockAsset->>MockData: Create MockArticulationData
MockData->>Tensor: Allocate zero tensors (lazy)
MockAsset->>MockView: Create MockArticulationView (optional)
MockView->>Tensor: Initialize state tensors
MockAsset-->>Test: Return mock asset instance
Note over Test,Tensor: Data Setting Phase
Test->>MockData: set_mock_data(joint_pos=tensor)
MockData->>Tensor: Store joint positions
Test->>MockData: set_mock_data(root_link_pose_w=tensor)
MockData->>Tensor: Store root pose
Note over Test,Tensor: Data Access Phase
Test->>MockAsset: robot.data.joint_pos
MockAsset->>MockData: Access joint_pos property
alt Data exists
MockData->>Tensor: Return stored tensor
else Data not set
MockData->>Tensor: Return zero tensor with correct shape
end
MockData-->>Test: Return tensor (N, J)
Note over Test,Tensor: Patching for Testing
Test->>Test: with patch_articulation(target, ...)
Test->>MockAsset: Create mock instance
Test->>Test: Run code under test
Test->>MockAsset: Verify mock interactions
Test->>Test: Exit context (cleanup)
Note over Test,Tensor: PhysX View Integration
Test->>MockView: get_dof_positions()
MockView->>Tensor: Return or initialize dof_positions
MockView-->>Test: Return tensor clone (N, J)
Test->>MockView: set_dof_positions(tensor, indices)
MockView->>Tensor: Update internal state
|
source/isaaclab/isaaclab/test/mock_interfaces/assets/__init__.py
Outdated
Show resolved
Hide resolved
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Add mock interfaces for PhysX's TensorAPI views as well as for the base asset/sensor abstractions. These are targeted for towards unit testing and benchmarking without starting kit.
New Features:
Type of change
Checklist
pre-commitchecks with./isaaclab.sh --formatconfig/extension.tomlfileCONTRIBUTORS.mdor my name already exists there