Wrong scale when importing USD assets through Python Standalone

Wrong scale when importing USD assets through Python Standalone

Hi, I’m trying to generate a scene entirely through Python. I’ve faced an issue: when adding assets from the omniverse library with Scale=1, they appear to be 100x normal size.

  • This happens even if I run the attached script and then manually drag an asset (e.g., another rack) into the scene through UI.
  • This isn’t the case for the H1 model (/Isaac/Robots/Unitree/H1/h1.usd) for IDK what reason, when added through the script it has a normal size.
  • This doesn’t happen if I open any example/public projects (probably created without scripting) — I can move assets from the library and they would appear normal-sized.

Steps to Reproduce

  1. Copy the script:
Code
from isaacsim import SimulationApp

# Simple example showing how to start and stop the helper
sim_config = {
    "headless": False,
    'hide_ui': False,
}
simulation_app = SimulationApp(sim_config)

### Perform any omniverse imports here after the helper loads ###
import omni
from omni.isaac.core.utils.stage import add_reference_to_stage
from omni.isaac.core.world import World
from omni.isaac.nucleus import get_assets_root_path
from pxr import Gf, Usd, UsdGeom

assets_root_path = get_assets_root_path()
industrial_folder = assets_root_path + '/NVIDIA/Assets/ArchVis/Industrial/'

rack_1_pth = industrial_folder + 'Racks/RackLarge_A7.usd'
rack_2_pth = industrial_folder + 'Racks/RackSmall_A3.usd'

simulation_app.update()

simulation_context = World(
    stage_units_in_meters=1.0,
    physics_dt = 1.0 / 200.0,
    rendering_dt = 8.0 / 200.0
)

world = simulation_context
simulation_app.update()

stage = omni.usd.get_context().get_stage()

world.scene.add_default_ground_plane(
    # default values are 0.5, 0.5, 0.8, and these values
    # are copied from the original reasoning demo USD (and H1 humanoid_example)
    z_position=0,
    name="default_ground_plane",
    prim_path="/World/defaultGroundPlane",
    static_friction=0.2,
    dynamic_friction=0.2,
    restitution=0.01,
)

simulation_app.update()

def add_reference(stage: Usd.Stage, prim_path, usd_file_path):
    prim = add_reference_to_stage(usd_file_path, prim_path)
    return prim

def set_transform(xform: UsdGeom.Xform, position=(0,0,0), rotation=(0,0,0)):
    xform.AddTranslateOp().Set(position)
    xform.AddRotateXYZOp().Set(rotation)
    xform.AddScaleOp().Set((1, 1, 1))

rack_1 = add_reference(stage, "/World/RackLarge_A7", rack_1_pth)
rack_2 = add_reference(stage, "/World/RackSmall_A3", rack_2_pth)

set_transform(UsdGeom.Xform(rack_1), position=(5.01, -4.2, 0))
set_transform(UsdGeom.Xform(rack_2), position=(-4.7, -3.27, 0))

simulation_app.update()

while simulation_app.is_running():
    simulation_app.update()

simulation_context.stop()
simulation_app.close()

  1. save into test_minimal.py
  2. run ./python.sh test_minimal.py from root isaacsim dir: ~/.local/share/ov/pkg/isaac-sim-4.2.0
  3. Wait and check the viewport. Try focusing (press F) on the ground plane and on rack object.
  4. You can try to set scale to 0.01, and rack then becomes normal

If I work on another example scene and drag an object from the library (the same rack), it somehow gets the property scale:unitsResolve (0.01) that scales these items back.

So my question is how to set scale:unitsResolve through Python, or how to otherwise fix the issue. I understand that I can simply set scale to 0.01, but 1) that is obviously not the right path, as there exists scale:unitsResolve 2) I heard this could break the physics

Isaac Sim Version

4.2.0

Operating System

Ubuntu 22.04.05

GPU Information

  • Model: T4
  • Driver Version: 550.90.07

Ok it seems in the working scene the Metrics Assembler extension is responsible for this behavior. Though, enabling it through Python doesn’t fix the issue for me — neither code-created items nor drag-and-dropped from the UI asset library works.

I used the following code to test it:

enable_extension("omni.usd.metrics.assembler")
enable_extension("omni.usd.metrics.assembler.physics")
enable_extension("omni.usd.metrics.assembler.ui")

The extension is ON in extension menu.

Please test whether setting the “xformOp:scale:unitsResolve” xformable attribute works.