I am using replicator to produce synthetic data. I am looping through a range and creating a new stage for each loop. This is so that I can get the exact same physics result for each seed. This works well some of the time. Some times I get the following warning which results in the objects not receiving the rigid bodies attributes. I know that the documentation says “Physics functionalities of Replicator API are currently only available on linux.” I am using windows. If there is a problem with windows, can you tell me if this is one of the things that does not work? The data generation works for most seeds and I do process the data on Linux as well, (docker in the cloud) I am still getting the same intermittent bad results on Linux. The seeds that are affected are random, (not the same one every time it’s run).
2023-02-27 23:13:45 [29,978ms] [Warning] [omni.graph.core.plugin] /Replicator/SDGPipeline/OgnSampleUniform_05: OmniGraph Warning: Required extended attribute outputs:samples is not resolved, compute skipped
(from compute() at line 208 in c:\users\mark\workspaceov\syntheticdata-ov\exts\theory.syntheticdata.replicator\app\extscache\omni.replicator.core-1.6.3+104.1.wx64.r.cp37\omni\replicator\core\ogn\OgnSampleUniformDatabase.py)
2023-02-27 23:13:45 [29,980ms] [Warning] [omni.graph.core.plugin] /Replicator/SDGPipeline/OgnWritePhysics: OmniGraph Warning: Required extended attribute inputs:values is not resolved, compute skipped
(from compute() at line 184 in c:\users\mark\workspaceov\syntheticdata-ov\exts\theory.syntheticdata.replicator\app\extscache\omni.replicator.core-1.6.3+104.1.wx64.r.cp37\omni\replicator\core\ogn\OgnWritePhysicsDatabase.py)
I have created a much smaller python file for you to replicate. It does not include seeding and other stuff that may not be relevant. The warning comes up at different loop indexes each time I run it.
from the command line in the folder that my extension resides I run the command:
app\omni.code.bat --no-window --exec "test_multi.py"
python file test_multi.py
:
import asyncio
import omni.replicator.core as rep
import carb
import omni.kit
async def new_stage():
carb.log_info("new stage")
await omni.usd.get_context().new_stage_async()
await omni.kit.app.get_app().next_update_async()
stage = omni.usd.get_context().get_stage()
stage.SetStartTimeCode(0)
stage.SetEndTimeCode(100)
def create_replicator_nodes():
with rep.new_layer():
rep.create.cube(position=(0, 0, 0), semantics=[("class", "cube")])
rep.create.cube(position=(0, 0, 0), semantics=[("class", "cube")])
cubes = rep.get.prims(semantics=[("class", "cube")], path_pattern="/Replicator/*")
camera = rep.create.camera(position=(0, 10, 0), rotation=(0, 0, 0))
with rep.trigger.on_frame(num_frames=1):
with cubes:
##################
# rep.physics.rigid_body() produces error:
# OmniGraph Error: WritePhysics Error: cannot reshape array of size 3 into shape (2,newaxis)
# therefore have to create a ReplicatorItem class for velocity and angular_velocity
##################
velocity = rep.distribution.uniform((0, 0, 0), (0, 0, 0))
angular_velocity = rep.distribution.uniform((0, 0, 0), (0, 0, 0))
rep.physics.rigid_body(velocity=velocity, angular_velocity=angular_velocity)
render_product = rep.create.render_product(camera, (256, 192))
render_products = [render_product]
writer = rep.WriterRegistry.get("BasicWriter")
writer.initialize(
output_dir="out_multi",
rgb=True,
)
writer.attach(render_products)
async def test_multi():
# 100 frame delay to allow app to set itself up (FIX for OV Code startup behaviour)
for i in range(100):
await omni.kit.app.get_app().next_update_async()
carb.settings.get_settings().set("/app/file/ignoreUnsavedOnExit", True)
num_scenes = 10
for a in range(num_scenes):
carb.log_info(f"starting scene {a}")
await new_stage()
create_replicator_nodes()
carb.log_info("starting run_until_complete_async")
await rep.orchestrator.run_until_complete_async()
carb.log_info(f"done scene {a}")
carb.log_info("post quit")
omni.kit.app.get_app().post_quit(0)
asyncio.ensure_future(test_multi())
Windows 11
RTX 3090
Code 2022.3
kit_20230227_161315.log (1.0 MB)
Log file attached
Thank you,
Mark Olson