Hi,
I am running following script in omniverse code script editor, but it’s crashing the Code. I am using Omniverse Code 2022.3.3. I could not find any specific error in logs.
import omni.replicator.core as rep
LOCAL_ASSETS_PATH = "/home/atai/Omniverse/Assets"
OUTPUT_PATH = "/home/atai/Code/tests/output/"
CRATES_DIR = f"{LOCAL_ASSETS_PATH}/Industrial_3D_Models_Pack/Containers/Wooden"
with rep.new_layer():
camera = rep.create.camera(position=(0, 365.76, 121.92),
rotation=(-60.0,0.0,0.0),
focal_length=10,
projection_type="fisheye_orthographic")
render_product = rep.create.render_product(camera, (960, 540))
# create a platform
platform = rep.create.plane(scale=10, visible=True)
# create a light
lights = rep.create.light(light_type="Dome")
def get_crates(max_size=1):
crate_usds = rep.utils.get_usd_files(CRATES_DIR, recursive=True)
crates = rep.randomizer.instantiate(crate_usds, size=max_size, with_replacements=True,
use_cache=False, mode='scene_instance')
with crates:
rep.modify.semantics([("class", "crates")])
return crates
rep.randomizer.register(get_crates)
with rep.trigger.on_frame(num_frames=5):
rep.randomizer.get_crates()
objs = rep.get.prims(semantics=[('class', 'crates')])
with objs:
rep.modify.pose(
rotation=rep.distribution.uniform((-90,-180, 0), (-90, 180, 0)),
scale=0.7,
)
rep.randomizer.scatter_2d(platform, check_for_collisions=True)
# Initialize and attach writer
writer = rep.WriterRegistry.get("BasicWriter")
writer.initialize(
output_dir=OUTPUT_PATH,
rgb=True,
bounding_box_2d_tight=True,
)
writer.attach([render_product])
rep.orchestrator.run()
You can find complete log file here:
kit_20230529_155209.log (1004.6 KB)