Xform in replicator is not controlled

I am learning the content of the replicator. I added an Xform according to the case, and I checked the type, which is the same as the type in the case. But when I run it for data collection, it is not under my control and cannot be random. I can’t find the reason and would love some help.`Preformatted text

import omni.replicator.core as rep
from omni.isaac.core.utils.stage import add_reference_to_stage
from omni.isaac.core import World, prims
import numpy as np
import omni

with rep.new_layer():
    camera = rep.create.camera(position=(67, 0, 0))

    render_product = rep.create.render_product(camera, (1024, 1024))

    torus = rep.create.torus(semantics=[('class', 'torus')], position=(0, 0, 0))

    sphere = rep.create.sphere(semantics=[('class', 'sphere')], position=(0, 0, 0))

    cube = rep.create.cube(semantics=[('class', 'cube')], position=(0, 0, 0))

    car5 = add_reference_to_stage("/D:/OM/car/car5/car5.usd", prim_path="/Replicator/car5")
    stage = omni.usd.get_context().get_stage()
    car5 = stage.GetPrimAtPath("/Replicator/car5")
    car5 = prims.XFormPrim(f"/Replicator/car5")
    car5.set_local_pose(np.array([1, 2, 3]))
    car5 = rep.get.prim_at_path("/Replicator/car5")

    with rep.trigger.on_frame(num_frames=10):
        with rep.create.group([torus, sphere, cube,car5]):
                position=rep.distribution.uniform((-10000, -10000, -10000), (20000, 20000, 20000)),
                scale=rep.distribution.uniform(0.1, 2))

    # Initialize and attach writer
    writer = rep.WriterRegistry.get("BasicWriter")

    writer.initialize( output_dir="D:\OM\out_put", rgb=True,   bounding_box_2d_tight=True)



Hi there,

I can confirm that there is an issue on grouping the prim_at_path node, a workaround would be to separate them in another:

with rep.create.group([torus, sphere, cube]):
with car5:

Here is a short working script using a traffic cone usd:

import omni
from omni.isaac.core.utils import prims
from omni.isaac.core.utils.nucleus import get_assets_root_path
import omni.replicator.core as rep

CONE_URL = "/Isaac/Environments/Simple_Warehouse/Props/S_TrafficCone.usd"
assets_root_path = get_assets_root_path()
cone_prim = prims.create_prim(prim_path="/World/Cone", usd_path=assets_root_path + CONE_URL)
cone_node = rep.get.prim_at_path(str(cone_prim.GetPath()))

torus = rep.create.torus(position=(0, 0, 1))
cube = rep.create.cube(position=(0, 0, -1))

with rep.trigger.on_frame():
    with rep.create.group([torus, cube]):
    with cone_node:

UPDATE: Workaround will not be required starting isaac sim version 2023.1.0

UPDATE: issue should be fixed in the following isaac sim 2023.1.0 release.

@ahaidu Thank you very much for your reply. It helped me overcome this confusion. According to your method, it is already working normally.

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