Skip to content

Conversation

@Mayankm96
Copy link
Contributor

@Mayankm96 Mayankm96 commented Jan 7, 2026

Description

Previously the stage in memory test did not check if material binding worked correctly. During my debugging, I saw that the bind_visual_material command was failing. This MR adds a fix for it and makes the test check for mateiral binding as well.

Requires merging: #4337

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 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 bug Something isn't working isaac-lab Related to Isaac Lab team labels Jan 7, 2026
@greptile-apps
Copy link
Contributor

greptile-apps bot commented Jan 7, 2026

Greptile Summary

  • Fixes USD stage caching issue in SimulationContext to enable proper material binding when stages are created in memory rather than loaded from files
  • Enhances test coverage by adding visual and physics material configurations to the stage-in-memory test, changing from basic shapes to mesh-based geometries that support material binding
  • Imports UsdUtils and adds logic to cache stages in the USD StageCache, preventing material binding failures that occurred when stages weren't properly registered with USD systems

Important Files Changed

Filename Overview
source/isaaclab/isaaclab/sim/simulation_context.py Added USD stage caching logic to fix material binding failures when stages are created in memory
source/isaaclab/test/sim/test_simulation_stage_in_memory.py Enhanced test with material binding configurations and changed CuboidCfg to MeshCuboidCfg to verify material binding functionality

Confidence score: 4/5

  • This PR addresses a legitimate bug with USD stage caching and includes appropriate test coverage to verify the fix
  • Score reflects the technical correctness of the USD caching solution and comprehensive test updates, with minor deduction for potential edge cases in USD system interactions
  • Pay close attention to the stage caching logic in simulation_context.py to ensure it handles all USD stage lifecycle scenarios correctly

Sequence Diagram

sequenceDiagram
    participant TestRunner
    participant SimulationContext
    participant StageUtils as "sim_utils"
    participant MaterialBinder as "bind_physics_material"
    participant Stage as "USD Stage"
    participant PhysX

    TestRunner->>SimulationContext: "SimulationContext(create_stage_in_memory=True)"
    SimulationContext->>StageUtils: "create_new_stage_in_memory()"
    StageUtils-->>SimulationContext: "stage_in_memory"
    SimulationContext->>SimulationContext: "_set_additional_physx_params()"
    SimulationContext->>MaterialBinder: "bind_physics_material(physics_prim_path, material_path)"
    MaterialBinder-->>SimulationContext: "material bound"
    
    TestRunner->>SimulationContext: "get_initial_stage()"
    SimulationContext-->>TestRunner: "stage_in_memory"
    
    TestRunner->>StageUtils: "use_stage(stage_in_memory)"
    TestRunner->>StageUtils: "create_prim('/World/env_*')"
    TestRunner->>StageUtils: "MultiAssetSpawnerCfg.func()"
    StageUtils->>Stage: "spawn assets with materials"
    Stage-->>StageUtils: "assets created"
    
    TestRunner->>StageUtils: "is_current_stage_in_memory()"
    StageUtils-->>TestRunner: "True"
    
    TestRunner->>StageUtils: "find_matching_prim_paths()"
    StageUtils->>Stage: "query prims"
    Stage-->>StageUtils: "prim paths"
    StageUtils-->>TestRunner: "prims found in memory stage"
    
    TestRunner->>StageUtils: "attach_stage_to_usd_context()"
    StageUtils->>Stage: "attach to USD context"
    StageUtils->>PhysX: "update physics with stage"
    PhysX-->>StageUtils: "physics updated"
    
    TestRunner->>StageUtils: "find_matching_prim_paths()"
    StageUtils-->>TestRunner: "prims verified in context stage"
Loading

@Mayankm96 Mayankm96 changed the title Makes stage in memory test check material binding Tests material binding inside stage in memory test Jan 7, 2026
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.

1 participant