Hi!
I’m trying to run replicator with rep.orchestrator.step_async()
and it seems to only be taking the first step before exiting.
Code:
# https://docs.omniverse.nvidia.com/prod_extensions/prod_extensions/ext_replicator/headless_example.html
import omni.replicator.core as rep
import asyncio;
import time;
from datetime import datetime
async def run_task():
print("run_task");
camera = rep.create.camera(position=(0, 0, 1000))
sphere_light = rep.create.light(
light_type="Sphere",
temperature=rep.distribution.normal(6500, 500),
intensity=rep.distribution.normal(35000, 5000),
position=rep.distribution.uniform((-300, -300, -300), (300, 300, 300)),
scale=rep.distribution.uniform(50, 100),
count=2
)
render_product = rep.create.render_product(camera, (1024, 1024))
torus = rep.create.torus(semantics=[('class', 'torus')] , position=(0, -200 , 100))
sphere = rep.create.sphere(semantics=[('class', 'sphere')], position=(0, 100, 100))
cube = rep.create.cube(semantics=[('class', 'cube')], position=(100, -200 , 100) )
print("Pre rep.trigger.on_frame()");
with rep.trigger.on_frame():
with rep.create.group([torus, sphere, cube]):
rep.modify.pose(
position=rep.distribution.uniform((-100, -100, -100), (200, 200, 200)),
scale=rep.distribution.uniform(0.1, 2))
# Initialize and attach writer
print("Creating the writer");
writer = rep.WriterRegistry.get("BasicWriter")
writer.initialize( output_dir="~/_output", rgb=True, bounding_box_2d_tight=True)
writer.attach([render_product])
for i in range(10):
print("pre step {0}".format(i));
await rep.orchestrator.step_async();
print("step {0} taken".format(i));
# rep.orchestrator.run()
print("Finished all iterations")
rep.orchestrator.stop();
print("Post rep.orchestrator.stop()");
asyncio.ensure_future(run_task());
print("---------------------\nPost ensure_future\n---------------------");
The output I get is
---------------------
Post ensure_future
---------------------
run_task
2023-01-29 15:17:21 [36,188ms] [Warning] [carb.flatcache.plugin] UsdRelationship /Replicator/SDGPipeline/OgnGroup_02.inputs:prims has multiple targets, which is not supported
Pre rep.trigger.on_frame()
Creating the writer
pre step 0
[38.170s] RTX ready
step 0 taken
pre step 1
[device name]: [path] $
and only one set of files appears within ~/_output
.
It might be worth mentioning also that this is related to a problem I’ve been having in a larger system where await rep.orchestrator.step_async()
simply hangs and doesn’t produce any images at all. I came across this problem while trying to fix that one, and have yet to replicate that problem in a manageable example for a forum.