Load worker model by Python API

Hi, I follower offline-dataset-generation and tried to load worker model (omniverse://localhost/NVIDIA/Assets/Characters/Reallusion/Worker/Props/Worker.StandingDiscussion_LookingDown_M.usd).
I tried to use

    def load_single_asset(self, ref, semantic_label, suffix=""):
        from pxr import UsdGeom, Usd
        from omni.isaac.core.utils.prims import create_prim
        from omni.isaac.core.utils.rotations import euler_angles_to_quat
        from omni.isaac.core.utils.prims import get_prim_path

        """Load a USD asset with random pose.
        args
            ref (str): Path to the USD that this prim will reference.
            semantic_label (str): Semantic label.
            suffix (str): String to add to the end of the prim's path.
        """
        x = random.uniform(*RANDOM_TRANSLATION_X)
        z = random.uniform(*RANDOM_TRANSLATION_Z)
        rot_y = random.uniform(*RANDOM_ROTATION_Y)

        asset = None
        try:
            _asset = create_prim(
                f"/World/Asset/mesh{suffix}",
                "Xform",
                scale=np.array([SCALE, SCALE, SCALE]),
                orientation=euler_angles_to_quat(np.array([0.0, rot_y, 0.0])),
                usd_path=ref,
                semantic_label=semantic_label,
            )
            asset = _asset
        except:
            carb.log_warn("load_single_asset failure")
            print(ref, semantic_label, suffix)
            print("CURRENT PATHS**********************************")
            curr_prim = self.stage.GetPrimAtPath("/")
            for prim in Usd.PrimRange(curr_prim):
                print(get_prim_path(prim))
            print("END ERROR PRINTS********************************")

        bound = UsdGeom.Mesh(asset).ComputeWorldBound(0.0, "default")
        box_min_y = bound.GetBox().GetMin()[1]
        UsdGeom.XformCommonAPI(asset).SetTranslate((x, -box_min_y, z))
        return asset

to load worker. It worked but worker didn’t act. It’s static like this
0

How can I make the worker to act?

Hi, I fix some bug:
change "Xform" to "SkelRoot" in _asset = create_prim(...
However, I need to set timeline and press play from UI like this post:

Can I do these two steps from python API?

Hi, I found the solution by myself:

        timeline = omni.timeline.get_timeline_interface()
        timeline.set_start_time(0)
        timeline.set_end_time(5)
        timeline.set_looping(True)
        timeline.play()
1 Like