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

Clear Instance of SimulationContext when closing environment #119

Closed
wants to merge 8 commits into from

Conversation

rdednl
Copy link

@rdednl rdednl commented Sep 18, 2023

Description

In a context where an environment has to be closed and run again, this is not currently possible because the SimulationContext instance is not closed properly.

Fixes #118 (issue)

Minimum working example:

from omni.isaac.kit import SimulationApp
headless = True
simulation_app = SimulationApp({"headless": headless})

import gym
import omni.isaac.orbit_envs
from omni.isaac.orbit_envs.utils import parse_env_cfg


def main():
    task_name = "Isaac-Ant-v0"
    cfg_direct = parse_env_cfg(task_name, use_gpu=True, num_envs=8)

    idx = 1

    while True:
        print(f"STARTING ENV {idx}")
        env = gym.make(task_name, cfg=cfg_direct, headless=headless)

        env.close()
        print(f"CLOSING ENV {idx}")
        idx += 1

if __name__ == "__main__":
    main()

Type of change

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

Checklist

  • I have run the pre-commit checks with ./orbit.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

Signed-off-by: Mayank Mittal <12863862+Mayankm96@users.noreply.github.com>
@Mayankm96
Copy link
Contributor

Mayankm96 commented Sep 25, 2023

Thanks a lot for finding the fix.

Can you please update the changelog and version in the extension as well? (basically the checks in the PR list)

@Mayankm96 Mayankm96 added the bug Something isn't working label Sep 25, 2023
@Mayankm96 Mayankm96 self-requested a review September 25, 2023 16:32
rpapallas and others added 5 commits September 25, 2023 18:33
Co-authored-by: Mayank Mittal <12863862+Mayankm96@users.noreply.github.com>
Signed-off-by: Daniele Reda <redad.93@gmail.com>
Signed-off-by: Daniele Reda <redad.93@gmail.com>
Signed-off-by: Daniele Reda <redad.93@gmail.com>
@Mayankm96
Copy link
Contributor

Thanks a lot for sending this MR. We have accounted for this in our latest release.

We will work on aligning community contributions better with our current v0.2 release. Stay tuned for more updates :)

@Mayankm96 Mayankm96 closed this Dec 22, 2023
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 this pull request may close these issues.

[Question] Closing an environment doesn't close replicator. Replicator already registered for given stage.
3 participants