Skip to content
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

[Bug Report] omni.isaac.orbit.sensors.Camera.__del__() method does not destroy render product #156

Closed
2 tasks done
jnzhnd opened this issue Dec 5, 2023 · 1 comment
Closed
2 tasks done
Labels
bug Something isn't working

Comments

@jnzhnd
Copy link

jnzhnd commented Dec 5, 2023

Describe the bug

I currently have a simulation running where I would like to take an image using a camera after 10 frames or so, and then remove the camera again for performance reasons. When I run the simulation without creating a camera, I'm getting on average around 45 FPS. If I spawn a camera, I get around 30 FPS (which is about as expected). If I then do camera.__del__(), the framerate does not recover. I also see that the camera and replicator prims are still present in the stage, however if i also delete those (using omni.isaac.core.utils.prims.delete_prim()), nothing changes.

From my view, this looks like a bug with orbit where it is not destroying the render product of the camera (see this thread).

In omni.isaac.orbit.sensors.Camera._initialize_impl(), the render product is created like this (on line 366):

render_prod_path = rep.create.render_product(cam_prim_path, resolution=(self.cfg.width, self.cfg.height))
if not isinstance(render_prod_path, str):
    render_prod_path = render_prod_path.path
self._render_product_paths.append(render_prod_path)

This does not preserve access to the render product object itself, only to its path.
Otherwise, we could access the render product itself in the __del__() method and do render_product.destroy() or something similar there, no?

Steps to reproduce

A reduced version of my simulation script is as follows:

...
camera_cfg = CameraCfg(
        prim_path=None,
        update_period=0,
        height=2048,
        width=2048,
        data_types=["rgb"],
        spawn=sim_utils.PinholeCameraCfg(
            focal_length=24.0, focus_distance=400.0, horizontal_aperture=20.955, clipping_range=(0.1, 1.0e5)
            ),
        )
...
while simulation_app.is_running():
    ...
    if count == 50:
        # Create a camera
        sim.pause()
        camera = Camera(cfg=camera_cfg.replace(prim_path="/Cameras/Cam_0"))
        sim.play()
            
        # Do some simulation steps to init camera
        for _ in range(2):
            sim.step()
                
        # Save camera data (for now, just print cam output)
        print(camera.data.output[0])

        # Remove the camera from existence again
        camera.__del__()
        prim_utils.delete_prim(prim_path="/Cameras")
        prim_utils.delete_prim(prim_path="/Replicator")
    ...
    count += 1

System Info

  • Using the devel branch of Orbit
  • Commit: aaab27b
  • Isaac Sim Version: 2023.1.0-hotfix.1
  • OS: Ubuntu 22.04
  • GPU: RTX 3090
  • CUDA: 12.0
  • GPU Driver: 525.147.05

Checklist

  • I have checked that there is no similar issue in the repo (required)
  • I have checked that the issue is not in running Isaac Sim itself and is related to the repo
@jnzhnd jnzhnd changed the title [Bug Report] camera .__del__ function does not delete camera [Bug Report] omni.isaac.orbit.sensors.Camera .__del__() method does not destroy render product Dec 5, 2023
@jnzhnd jnzhnd changed the title [Bug Report] omni.isaac.orbit.sensors.Camera .__del__() method does not destroy render product [Bug Report] omni.isaac.orbit.sensors.Camera.__del__() method does not destroy render product Dec 5, 2023
@Mayankm96
Copy link
Contributor

Interesting that it didn't show up as an issue in our unit tests where we are destroying and creating the camera for every fixture. Might be because we create a new stage for every test.

Would you be able to send a MR for it? Otherwise, we can also handle that on our side. It seems like a relatively easy fix.

@Mayankm96 Mayankm96 added the bug Something isn't working label Dec 6, 2023
Mayankm96 pushed a commit that referenced this issue Dec 10, 2023
# Description

This MR updates the tutorials to the latest version of Orbit. It
introduced a new structure for them. They cover basic sim elements,
assets, sensors, scenes, and envs.

Fixes #190 , #149 , #148 , #147 , #151, #152, #155, #156, #157

## Type of change

- New feature (non-breaking change which adds functionality)
- This change requires a documentation update

## Checklist

- [x] I have run the [`pre-commit` checks](https://pre-commit.com/) with
`./orbit.sh --format`
- [ ] I have made corresponding changes to the documentation
- [x] 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
- [x] I have added my name to the `CONTRIBUTORS.md` or my name already
exists there

---------

Signed-off-by: Pascal Roth <57946385+pascal-roth@users.noreply.github.com>
Co-authored-by: James Smith <jsmith@theaiinstitute.com>
Mayankm96 pushed a commit that referenced this issue Dec 22, 2023
# Description

This MR updates the tutorials to the latest version of Orbit. It
introduced a new structure for them. They cover basic sim elements,
assets, sensors, scenes, and envs.

Fixes #190 , #149 , #148 , #147 , #151, #152, #155, #156, #157

## Type of change

- New feature (non-breaking change which adds functionality)
- This change requires a documentation update

## Checklist

- [x] I have run the [`pre-commit` checks](https://pre-commit.com/) with
`./orbit.sh --format`
- [ ] I have made corresponding changes to the documentation
- [x] 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
- [x] I have added my name to the `CONTRIBUTORS.md` or my name already
exists there

---------

Signed-off-by: Pascal Roth <57946385+pascal-roth@users.noreply.github.com>
Co-authored-by: James Smith <jsmith@theaiinstitute.com>
fatimaanes pushed a commit to fatimaanes/omniperf that referenced this issue Aug 8, 2024
# Description

This MR updates the tutorials to the latest version of Orbit. It
introduced a new structure for them. They cover basic sim elements,
assets, sensors, scenes, and envs.

Fixes isaac-sim#190 , isaac-sim#149 , isaac-sim#148 , isaac-sim#147 , isaac-sim#151, isaac-sim#152, isaac-sim#155, isaac-sim#156, isaac-sim#157

## Type of change

- New feature (non-breaking change which adds functionality)
- This change requires a documentation update

## Checklist

- [x] I have run the [`pre-commit` checks](https://pre-commit.com/) with
`./orbit.sh --format`
- [ ] I have made corresponding changes to the documentation
- [x] 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
- [x] I have added my name to the `CONTRIBUTORS.md` or my name already
exists there

---------

Signed-off-by: Pascal Roth <57946385+pascal-roth@users.noreply.github.com>
Co-authored-by: James Smith <jsmith@theaiinstitute.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants