Hello Henry,
The same error occurs even with a reboot of my computer and a fresh boot of ISAAC.
Since some of the parts I use are confidential, I edited the script a little bit so it uses ISAAC Props. It does not look exactly like my script, since I can’t use the original props of mine. With this script you will also get an error message
2023-03-01 08:07:22 [2,521,991ms] [Warning] [omni.physicsschema.plugin] RigidBodyAPI on an instance proxy not supported. /Replicator/SampledAssets/Population_0919d018/Ref_Xform_10/Ref/Cube
but just ignore this, this only happens because I couldn’t find a prop without Rigid Body assigned in the Nvidia folder. You will also get the error message I described in my previous posts.
import omni.replicator.core as rep
import omni.kit.viewport.utility as vp_utils
from omni.isaac.core.utils.stage import add_reference_to_stage, get_current_stage
from omni.isaac.core.utils.prims import create_prim, delete_prim, get_prim_at_path
from pxr import Usd #UsdGeom, UsdShade, Gf, Sdf,
import numpy as np
from omni.isaac.core.utils.bounds import create_bbox_cache, compute_aabb
import os
# Define paths for the character, the props, the environment and the surface where the assets will be scattered in.
BIN = "omniverse://localhost/NVIDIA/Assets/Isaac/2022.2.0/Isaac/Props/KLT_Bin/small_KLT.usd"
PROPS = "omniverse://localhost/NVIDIA/Assets/Isaac/2022.2.0/Isaac/Props/Blocks/basic_block.usd"
#Bin platzieren
def bin_place():
bin = rep.create.from_usd(BIN, semantics=[('class', 'bin')])
with bin:
rep.modify.pose(
position=rep.distribution.uniform((-.02, -.02, 0.4), (.02, .02, 0.4)),
rotation=rep.distribution.uniform((0,0,-10), (0, 0, 10)),
scale= 1
)
rep.randomizer.color(colors=rep.distribution.uniform((0, 0, 0), (0.002, 0.002, 0.002)))
#rep.randomizer.texture(textures=["omniverse://localhost/NVIDIA/Materials/vMaterials_2/Plastic/textures/pcb_solder_mask_rough.jpg"])
rep.physics.collider(approximation_shape = "meshSimplification")
return bin.node
rep.randomizer.register(bin_place)
def bbox_bin():
cache = create_bbox_cache()
bin_prim_path = "/Replicator/Ref_Xform"
bbox = compute_aabb(cache,bin_prim_path,include_children=True)
print(bbox)
# Drop Parts
def env_props(size=50):
instances = rep.randomizer.instantiate(rep.utils.get_usd_files(PROPS, recursive=True), size=size, mode='scene_instance')
with instances:
rep.modify.semantics([('class', 'ring')])
rep.modify.pose(
position=rep.distribution.uniform((-0.3, -0.2, 0.3), (0.3, 0.2, 0.4)),
rotation=rep.distribution.uniform((0,-180, 0), (0, 180, 0)),
scale = 1
)
rep.physics.rigid_body(
velocity= (0,0,-1)
)
rep.physics.collider(approximation_shape = "convexDecomposition")
return instances.node
# Register randomization
rep.randomizer.register(env_props)
# Setup the static elements
surface = rep.create.plane(
position = (0,0,0),
scale = (200,200,1),
rotation = (0,0,0)
)
with surface:
rep.physics.collider()
# Setup camera and attach it to render product
camera = rep.create.camera(
look_at=surface,
position=(2,2,1)
)
render_product = rep.create.render_product(camera, resolution=(1024, 1024))
#TODO
# Kamera mittig über Kiste spawnen und Position leicht variieren (dafür BBOX notwendig)
#Set Viewport
cam = "/Replicator/Camera_Xform/Camera"
viewport_window = vp_utils.get_active_viewport_window()
viewport_window.viewport_api.set_active_camera(cam)
# sphere lights for extra randomization
def sphere_lights(num):
lights = 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=num
)
return lights.node
rep.randomizer.register(sphere_lights)
# Trigger on time
with rep.trigger.on_time(interval= 8, num=2):
rep.randomizer.bin_place()
rep.randomizer.env_props(10)
rep.randomizer.sphere_lights(10)
bbox_bin()
# Initialize and attach writer
writer = rep.WriterRegistry.get("BasicWriter")
writer.initialize( output_dir="_output_physics10", rgb=True, bounding_box_2d_tight=True)
writer.attach([render_product])