Clearing all SDG relicts from current SimulationApp instance

Hi,
I have written a randomization function that instantiates randomizers, loads a scene from a dataset, and then randomizes the scene multiple times before continuing with the next scene.
I would like to reuse the same function, with different randomization options for training-set and test-set generation.
The simulation_app is started in the caller script.

Currently I use the following functions at the end of the randomization function in an attempt to reset the stage to a default state.

    rep.orchestrator.wait_until_complete()
    render_product.hydra_texture.set_updates_enabled(False)
    rep.orchestrator.stop()
    while rep.orchestrator.get_is_stopped() == False:
        time.sleep(0.5)
    world.reset()
    world.clear()
    world.clear_instance()

However when I enter the function a second time, the randomization graphs are not cleared and I get weird errors when accessing annotators.

Is there a way to completely reset a stage, delete all SDG graphs and layers, so it is as if the app has just been opened?

1 Like