How to skip frames during physics?

For the generation of synthetic images for bin picking, I want to drop an object into the bin, then capture several photos with different camera poses, and then drop another object into the bin. With the current code, 30 photos are taken while the object is falling into the bin.

  1. How can I suppress this image generation while the object is falling and only capture photos with different camera poses after the object is in the bin?
  2. Once the first object is in the bin → How can I spawn a second object of the same class above the bin and let it fall into the bin as well? (for-loop for approximately 20 objects)
  3. As you can see from the code, I manually specify the size of the bin in the first few lines. Is there a function that outputs the size of the 3D bounding box of a .usd file?

Love greetings Alexander

import omni.replicator.core as rep


with rep.new_layer():
    BIN_USD = 'omniverse://localhost/Projects/synthetic_data_cad_files/Kiste/Kiste_final.usd'
    bin_rotations = (90,0,90)
    bin_size = (bin_lengh, bin_width, bin_height)
    bin_transform = (-bin_size[0]/2, -bin_size[1]/2, 0)
    PART1_USD = "omniverse://localhost/Projects/synthetic_data_cad_files/Part/morobot-s_Achse-1A/morobot-s_Achse-1A.usd"

    camera =
    with camera:
            position=rep.distribution.uniform((-bin_size[0]/2, -bin_size[1]/2, 1.500), (bin_size[0]/2, bin_size[1]/2, 1.500)),
            look_at=(0, 0, 0)                
    def rand_camera():
        with camera:
                position=rep.distribution.uniform((-bin_size[0]/2, -bin_size[1]/2, 1.500), (bin_size[0]/2, bin_size[1]/2, 1.500)),
                look_at=(0, 0, 0)                
    sphere_light = rep.create.light(
        temperature=rep.distribution.normal(6500, 500),
        intensity=rep.distribution.normal(1000, 50),
        position=rep.distribution.uniform((-0.300, -0.300, bin_size[2]+0.100), (0.300, 0.300, 1.000)),
        scale=rep.distribution.uniform(0.050, 1),
        count=2 #2 light sources

    plane = rep.create.plane(semantics=[("class", "plane")], position=(0, 0, 0), scale=(2, 2, 1))
    with plane:

    #import bin
    bin = rep.create.from_usd(BIN_USD)
    with bin:
        rep.modify.semantics([('class', 'bin')])
            rotation=(bin_rotations[0], bin_rotations[1], bin_rotations[2]),
            scale=(0.001, 0.001, 0.001)

    #import Object      
    part1 = rep.create.from_usd(PART1_USD)
    with part1: 
        rep.modify.semantics([('class', 'part1')])
            position=rep.distribution.uniform((-bin_size[0]/2, -bin_size[1]/2, bin_size[2]+0.150), (bin_size[0]/2, bin_size[1]/2, bin_size[2]+0.150)),
            rotation=rep.distribution.uniform((-180,-180, -180), (180, 180, 180)),
            scale=(0.001, 0.001, 0.001)

    with rep.trigger.on_frame(num_frames=30): 

    writer = rep.WriterRegistry.get("BasicWriter")
    writer.initialize(output_dir="_output", rgb=True)
    render_product = rep.create.render_product(camera, (1920, 1080))

Hello @alexanderbischof255! As you’ve discovered, writers write on every frame. Writer triggers is a feature we are currently developing but which is not quite ready yet. I suggest as a workaround for the time being creating a custom writer which looks at the object’s transform (which you can get from the bounding_box_3d annotator) and skipping writing until the object’s Z coordinate falls to an acceptable threshold.

Thank you for the feedback!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.