Skip to content

Moves meshes in the RayCaster to classvar to be shared between sensors #2183

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

Open
wants to merge 13 commits into
base: main
Choose a base branch
from

Conversation

pascal-roth
Copy link
Collaborator

@pascal-roth pascal-roth commented Mar 28, 2025

Description

Moves meshes in the RayCaster to classvar to be shared between sensors. This should save memory.

Type of change

  • Bug fix (non-breaking change which fixes an issue)

Checklist

  • 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

@pascal-roth pascal-roth requested a review from Mayankm96 March 28, 2025 15:34
@pascal-roth pascal-roth self-assigned this Mar 28, 2025
pascal-roth and others added 5 commits March 31, 2025 17:10
Co-authored-by: Mayank Mittal <12863862+Mayankm96@users.noreply.github.com>
Signed-off-by: Pascal Roth <57946385+pascal-roth@users.noreply.github.com>
…oth/IsaacLab into fearture/mesh-storing-raycaster
@pascal-roth pascal-roth requested a review from Mayankm96 March 31, 2025 16:37
@Mayankm96 Mayankm96 requested a review from Copilot April 2, 2025 10:07
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR moves the mesh storage for raycasting from instance attributes to class-level variables to allow sharing between sensors and reduce memory usage.

  • Moves warp mesh and mesh view dictionaries to class-level with type annotations.
  • Introduces an instance counter and a del method to clear the shared dictionaries when no instances remain.
  • Updates the typing import to include ClassVar.
Comments suppressed due to low confidence (1)

source/isaaclab/isaaclab/sensors/ray_caster/ray_caster.py:314

  • [nitpick] Relying on del for cleanup of shared class variables can be unpredictable due to Python's garbage collection behavior. Consider using an explicit cleanup method or context management to ensure reliable resource release.
def __del__(self):

@Mayankm96
Copy link
Contributor

@pascal-roth Pre-commit is failing. Can you check?

@pascal-roth
Copy link
Collaborator Author

lets wait with a merge, just making some tests for the ray_caster to make sure that the new classvar is cleared correclty

@pascal-roth
Copy link
Collaborator Author

@Mayankm96 ready for a review, now the raycaster also has a first set of basic tests.

IMPORTANT: the test already run with pytest, commented out part at the top is for the time when everything is upgraded to pytest

@kellyguo11
Copy link
Contributor

Looks like some tests are failing, is that expected?

@pascal-roth
Copy link
Collaborator Author

so regarding the tests:

  • test_ray_caster.py: fail is expected as written in pytest (not sure why our unittest framework even catches that one)
  • test_tiled_camera.py and test_contact_sensor.py fail but are not even in the log, don't think that is from this PR
  • test_environment.py times out again

Lets really push for the pytest conversion, this will make the whole setup much easier

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.

3 participants