-
Notifications
You must be signed in to change notification settings - Fork 3k
Adds mock interfaces to enable unit-testing and isolated benchmaking. #4491
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adds mock interfaces to enable unit-testing and isolated benchmaking. #4491
Conversation
|
@greptile give it a looksy |
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
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
8 files reviewed, 2 comments
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