Hi
I am using the following code
import omni.replicator.core as rep
from pathlib import Path
rep.settings.set_stage_up_axis("z")
DATA_DIR = Path("/projects/gitlab/aiml/synthetic-data/data/")
SCENES = DATA_DIR / "input" / "scenes"
SCENE_001 = SCENES / "scene_0001.usd"
CAMERA_NAME = "Camera_0"
scene = omni.replicator.core.create.from_usd( SCENE_001.as_posix())
camera = rep.create.camera(
position=rep.distribution.uniform((0,0,0), (100, 100, 100)),
rotation=(45, 45, 0),
focus_distance=rep.distribution.normal(400.0, 100),
f_stop=1.8,
)
#camera = rep.get.camera(path_pattern="/Replicator/Ref_Xform_01/Ref/UAV/Payload/Camera_0")
render_product = rep.create.render_product(camera, (1920, 1080))
writer = rep.WriterRegistry.get("BasicWriter")
writer.initialize(
output_dir="~/replicator_examples/dli_hello_replicator/",
rgb=True,
bounding_box_2d_tight=True,
)
writer.attach([render_product])
rep.orchestrator.run(num_frames=40, start_timeline=True)
But ideally the code line that has been commented out would find the camera at the path <defaultPrim>/UAV/Payload/Camera_0
In the original scene <defaultPrim>
is just /World
But in the scene in Code 104.2 it doesn’t appear in time for the rep.get.camera
command to find the prim.
The Camera is good to go for 40 frames and is animated upstream with USD code generation.
How do I hit snooze until the prim is ready to be found?
Error is as follows
future: <Task finished coro=<Writer.__attach_async() done, defined at /home/sam/.local/share/ov/pkg/deps/28c70d9b2f0e7eb6e8d60682fea71057/extscache/omni.replicator.core-1.7.7+104.2.lx64.r.cp37/omni/replicator/core/scripts/writers.py:312> exception=ValueError('Unable to get camera path from omni.replicator.core.get.camera')>
Traceback (most recent call last):
File "/home/sam/.local/share/ov/pkg/deps/28c70d9b2f0e7eb6e8d60682fea71057/extscache/omni.replicator.core-1.7.7+104.2.lx64.r.cp37/omni/replicator/core/scripts/writers.py", line 316, in __attach_async
render_products_results = [rp.result() if asyncio.isfuture(rp) else rp for rp in render_products]
File "/home/sam/.local/share/ov/pkg/deps/28c70d9b2f0e7eb6e8d60682fea71057/extscache/omni.replicator.core-1.7.7+104.2.lx64.r.cp37/omni/replicator/core/scripts/writers.py", line 316, in <listcomp>
render_products_results = [rp.result() if asyncio.isfuture(rp) else rp for rp in render_products]
File "/home/sam/.local/share/ov/pkg/deps/28c70d9b2f0e7eb6e8d60682fea71057/extscache/omni.replicator.core-1.7.7+104.2.lx64.r.cp37/omni/replicator/core/scripts/create.py", line 1109, in _attach_render_product
raise ValueError(f"Unable to get camera path from {camera}")
ValueError: Unable to get camera path from omni.replicator.core.get.camera
Hay Samuel, could you give a bit more information on what you are trying to accomplish? What does your ideal script look like?
Hello @samuel.hodge, thank you for bringing this to our attention. I believe this issue stemmed from rep.get
requiring one frame to populate itself with retrieved prims. This was addressed in the latest Replicator release (omni.replicator.core > 1.10), available in the current release of Omniverse Isaac or in the next (2024) release of Omniverse Code.