# Deleting and generating prims for OIGE environment reset

**URL:** <https://forums.developer.nvidia.com/t/deleting-and-generating-prims-for-oige-environment-reset/271929>\
**Category:** Isaac Gym\
**Tags:** gym, isaacsim\
**Created:** [November 6, 2023, 9:09am UTC](https://forums.developer.nvidia.com/t/deleting-and-generating-prims-for-oige-environment-reset/271929 "2023-11-06T09:09:31Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![paula.gascla](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@paula.gascla](https://forums.developer.nvidia.com/u/paula.gascla)\
**Post date:** [November 6, 2023, 9:09am UTC](https://forums.developer.nvidia.com/t/deleting-and-generating-prims-for-oige-environment-reset/271929/1 "2023-11-06T09:09:31Z")

</div>

Hello, I have a question about environment reset using OIGE. So for the task I am setting up I have to spawn a new cube every x timesteps in an episode. Each cube is a DynamicCuboid generated in env\_0, then cloned to all other environments and finally, all the clones are wrapped around a RigidPrimView (e.g. for all cube\_0, the view is named cube\_view\_0).

The issue comes when resetting a specific environment. If at the end of the episode I’ve generated 10 cubes, the reset should consist of removing them all and spawning a new cube\_0. However, with this approach 2 issues arise:

1. I am able to delete cube prims using the delete\_prim() function of omni.isaac.core.utils.prims. However, when I delete cube\_0 (as an example), the associated cube\_view\_0 is not removed. Therefore, when I want to generate a new cube\_0 and its corresponding new cube\_view\_0 the following exception is printed in the terminal: “Cannot add the object cube\_view\_0 to the scene since its name is not unique”. Do you know of any way to also eliminate RigidPrimViews or a workaround for this issue?
2. More importantly, doing as described above, every time I delete a prim, the prim is simultaneously deleted in all environments, meaning I cannot perform independent environment resets. Is there any way of deleted and generating prims in specific environments while still taking advantage of the efficient memory usage of OIGE parallelization?

---

<div class="post-metadata">

**Author:** ![kellyg](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/kellyg/32/55627_2.png) [@kellyg](https://forums.developer.nvidia.com/u/kellyg)\
**Post date:** [November 6, 2023, 4:58pm UTC](https://forums.developer.nvidia.com/t/deleting-and-generating-prims-for-oige-environment-reset/271929/3 "2023-11-06T16:58:07Z")

</div>

Hi there, views can be removed from the scene using `scene.remove_object()` from omni.isaac.core’s scene.py. If you would like the environments to stay independent of each other, you can use the `copy_from_source` parameter when cloning the environments, with `copy_from_source=True` in the `Cloner.clone()` call.

---

<div class="post-metadata">

**Author:** ![paula.gascla](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@paula.gascla](https://forums.developer.nvidia.com/u/paula.gascla)\
**Post date:** [November 10, 2023, 3:12pm UTC](https://forums.developer.nvidia.com/t/deleting-and-generating-prims-for-oige-environment-reset/271929/4 "2023-11-10T15:12:36Z")

</div>

Hi, thanks for the response!

If I undertand correctly, the `Cloner.clone()` call you are referring to is in the `set_up_scene()` method within the omniisaacgymenvs\>tasks\>base\>rl\_task.py file, right? If so, that call does not have a `copy_from_souce`argument to be passed.

Do you have further guidelines on how I could set that flag or how to get my environments independent?

---

<div class="post-metadata">

**Author:** ![kellyg](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/kellyg/32/55627_2.png) [@kellyg](https://forums.developer.nvidia.com/u/kellyg)\
**Post date:** [November 10, 2023, 3:27pm UTC](https://forums.developer.nvidia.com/t/deleting-and-generating-prims-for-oige-environment-reset/271929/5 "2023-11-10T15:27:41Z")

</div>

The `copy_from_source` argument can be found here: [https://github.com/NVIDIA-Omniverse/OmniIsaacGymEnvs/blob/main/omniisaacgymenvs/tasks/base/rl\_task.py#L144](https://github.com/NVIDIA-Omniverse/OmniIsaacGymEnvs/blob/main/omniisaacgymenvs/tasks/base/rl_task.py#L144) and passed when calling `RLTask.set_up_scene()`. The flag was introduced in the Isaac Sim 2023.1.0 release.

---

<div class="post-metadata">

**Author:** ![paula.gascla](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@paula.gascla](https://forums.developer.nvidia.com/u/paula.gascla)\
**Post date:** [November 15, 2023, 10:39am UTC](https://forums.developer.nvidia.com/t/deleting-and-generating-prims-for-oige-environment-reset/271929/6 "2023-11-15T10:39:29Z")

</div>

Thanks, I was indeed using Isaac Sim 2022.2.1., that is why the flag was not available.

---

<div class="post-metadata">

**Author:** ![system](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/system/32/68080_2.png) [@system](https://forums.developer.nvidia.com/u/system)\
**Post date:** [November 29, 2023, 10:39am UTC](https://forums.developer.nvidia.com/t/deleting-and-generating-prims-for-oige-environment-reset/271929/7 "2023-11-29T10:39:52Z")

</div>

Closed on November 29, 2023, 10:39am UTC

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
