Save camera image with replicator annotator in Isaac sim

Hi, Im making some extension code for multi robot simulation. I have some critical problems. Id really appreciate it if you could help me.

The problems are as follows:

  1. I am saving images from a camera using a replicator and annotation.
    However, even though I gave the exit condition, the image is still saved.
    As you can see in the attached code, I set a condition to only save a total of 100 images, but there are still over 1000 images saved.

2.When I run the extension code in simulation and quit isaac sim and run it again, the extension does not run.Below is the error log of the terminal.

2024-09-03 14:16:56  [Error] [omni.ui.python] AttributeError: 'Extension' object has no attribute '_timeline'
2024-09-03 14:16:56  [Error] [omni.ui.python] 
2024-09-03 14:16:56  [Error] [omni.ui.python] At:
2024-09-03 14:16:56  [Error] [omni.ui.python]   /home/kdb/workspace/_isaacsim/Myworkspace/workspace/Workspace_python/extension.py(100): _on_window
2024-09-03 14:16:56  [Error] [omni.ui.python]   /home/kdb/workspace/_isaacsim/Myworkspace/workspace/Workspace_python/extension.py(135): _menu_callback
2024-09-03 14:16:56  [Error] [omni.ui.python]   /home/kdb/.local/share/ov/pkg/isaac_sim-2023.1.1/kit/exts/omni.kit.actions.core/omni/kit/actions/core/actions.py(40): execute_action
2024-09-03 14:16:56  [Error] [omni.ui.python]   /home/kdb/.local/share/ov/pkg/isaac_sim-2023.1.1/kit/exts/omni.kit.menu.utils/omni/kit/menu/utils/scripts/app_menu.py(624): execute_action
2024-09-03 14:16:56  [Error] [omni.ui.python]   /home/kdb/.local/share/ov/pkg/isaac_sim-2023.1.1/kit/python/lib/python3.10/asyncio/events.py(80): _run
2024-09-03 14:16:56  [Error] [omni.ui.python]   /home/kdb/.local/share/ov/pkg/isaac_sim-2023.1.1/kit/python/lib/python3.10/asyncio/base_events.py(1909): _run_once
2024-09-03 14:16:56  [Error] [omni.ui.python]   /home/kdb/.local/share/ov/pkg/isaac_sim-2023.1.1/kit/python/lib/python3.10/asyncio/base_events.py(603): run_forever
2024-09-03 14:16:56  [Error] [omni.ui.python]   /home/kdb/.local/share/ov/pkg/isaac_sim-2023.1.1/kit/extscore/omni.kit.async_engine/omni/kit/async_engine/async_engine.py(177): _on_update
2024-09-03 14:16:56  [Error] [omni.ui.python] 
2024-09-03 14:16:56  [Error] [omni.kit.actions.core.python] Error executing PythonAction 'CreateUIExtension:Workspace': AttributeError: 'Extension' object has no attribute 'ui_builder'
2024-09-03 14:16:56  [Error] [omni.kit.actions.core.python] 
2024-09-03 14:16:56  [Error] [omni.kit.actions.core.python] At:
2024-09-03 14:16:56  [Error] [omni.kit.actions.core.python]   /home/kdb/workspace/_isaacsim/Myworkspace/workspace/Workspace_python/extension.py(136): _menu_callback
2024-09-03 14:16:56  [Error] [omni.kit.actions.core.python]   /home/kdb/.local/share/ov/pkg/isaac_sim-2023.1.1/kit/exts/omni.kit.actions.core/omni/kit/actions/core/actions.py(40): execute_action
2024-09-03 14:16:56  [Error] [omni.kit.actions.core.python]   /home/kdb/.local/share/ov/pkg/isaac_sim-2023.1.1/kit/exts/omni.kit.menu.utils/omni/kit/menu/utils/scripts/app_menu.py(624): execute_action
2024-09-03 14:16:56  [Error] [omni.kit.actions.core.python]   /home/kdb/.local/share/ov/pkg/isaac_sim-2023.1.1/kit/python/lib/python3.10/asyncio/events.py(80): _run
2024-09-03 14:16:56  [Error] [omni.kit.actions.core.python]   /home/kdb/.local/share/ov/pkg/isaac_sim-2023.1.1/kit/python/lib/python3.10/asyncio/base_events.py(1909): _run_once
2024-09-03 14:16:56  [Error] [omni.kit.actions.core.python]   /home/kdb/.local/share/ov/pkg/isaac_sim-2023.1.1/kit/python/lib/python3.10/asyncio/base_events.py(603): run_forever
2024-09-03 14:16:56  [Error] [omni.kit.actions.core.python]   /home/kdb/.local/share/ov/pkg/isaac_sim-2023.1.1/kit/extscore/omni.kit.async_engine/omni/kit/async_engine/async_engine.py(177): _on_update
2024-09-03 14:16:56  [Error] [omni.kit.actions.core.python] 

ui_builder.zip (3.3 KB)

I would really appreciate some help with the problem.

To limit the number of frames output you will need to use

with rep.trigger.on_frame(num_frames=100):

see example here.

Regarding the extension, can you share more on how you are implementing it? are you following this?