Skip to content

Fix tests and clean up components#248

Open
lookangela wants to merge 5 commits intoyueci/adapt-dexsim-v0.4.0from
cjh/fix-tests
Open

Fix tests and clean up components#248
lookangela wants to merge 5 commits intoyueci/adapt-dexsim-v0.4.0from
cjh/fix-tests

Conversation

@lookangela
Copy link
Copy Markdown
Collaborator

This pull request introduces significant improvements to the simulation resource management, test stability, and device compatibility in the EmbodiChain simulation framework. The core changes revolve around robust destruction and cleanup of simulation scenes and assets, especially in Python test environments where C++ resources may otherwise leak or persist due to reference cycles. Additionally, there are targeted fixes for device handling and configuration defaults.

Resource management and cleanup improvements:

  • Implemented a deferred destruction and cleanup queue in SimulationManager, along with wait_scene_destruction and flush_cleanup_queue methods, to ensure C++ simulation scenes are fully destroyed and Python references are cleared, preventing resource leaks and test flakiness. This is now integrated into the test teardown process globally and in individual test classes. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13]

Device and tensor handling fixes:

  • Ensured all tensors in contact_sensor.py are created or moved to the correct device, preventing device mismatch errors. [1] [2]
  • Updated the is_use_gpu_physics property to check only the device type, simplifying logic and avoiding dependency on global configuration state.

Test configuration and reliability:

  • Set the default renderer to "hybrid" for all tests, and added conditional skips for camera tests to ensure compatibility with the selected renderer. [1] [2]
  • Modified test setup/teardown logic in robot and camera tests to use class-level setup/teardown where appropriate, reducing redundant simulation creation and improving resource cleanup. [1] [2] [3] [4] [5]

Minor fixes and configuration adjustments:

  • Exposed SDFConfig in sim_utils.py for external use.
  • Increased cube size in contact sensor tests for better contact detection.
  • Fixed the order of sensor addition and pose setting in contact sensor tests to ensure correct initialization.
  • Disabled physics by default in certain rigid object tests for improved test determinism.

These changes collectively improve the robustness, reliability, and maintainability of both the simulation engine and its test suite.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant