Urdf-importer api does not import color correctly but gui does

I believe I have the same setup in the api as that in gui version of urdf importer. However the material and texture is not correctly assigned in the api version as compared to gui version, what additional setting do I need to do?

My code for import asset using api

def setup_scene(self):

        world = self.get_world()
        urdf_interface = _urdf.acquire_urdf_interface()
        import_config = _urdf.ImportConfig()
        import_config.merge_fixed_joints = False
        import_config.convex_decomp = False
        import_config.fix_base = True
        import_config.make_default_prim = True
        import_config.self_collision = False
        import_config.create_physics_scene = True
        import_config.import_inertia_tensor = False
        import_config.default_drive_strength = 1047.19751
        import_config.default_position_drive_damping = 52.35988

        import_config.default_drive_type = _urdf.UrdfJointTargetType.JOINT_DRIVE_POSITION
        import_config.distance_scale = 1
        import_config.density = 0.0
        # Get the urdf file path
        object_path = "/home/octipus/Projects/assetExtract/41083"
        file_name = "mobility.urdf"
        # Finally import the robot
        result, prim_path = omni.kit.commands.execute( "URDFParseAndImportFile", urdf_path="{}/{}".format(object_path, file_name),
        self.prim_path = prim_path

download example asset

Ohh I need to add the destPath as described here:
and then reference it.


1 Like

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