Skip to content

[UsdExporter] Length scales are tiny in exported USD #2572

Open
@siddancha

Description

@siddancha

Intro

Hi!

I am a researcher at MIT, I use MuJoCo for my research on robotics.

My setup

Ubuntu 22.04, MuJoCo v3.3.0, Python API

What's happening? What did you expect?

When I export my model to USD and visualize it in Blender and Omniverse, the model is tiny! I need to scroll in a lot to be able to see my scene. Here's what I see in Omniverse:

mujoco-usd-exported.mp4

Steps for reproduction

Here's my code snippet to reproduce this:

import mujoco
import mujoco.viewer
from mujoco.usd import exporter

# Load the model -- Franka Emika Panda from Menagerie
model = mujoco.MjModel.from_xml_path("scene.xml")
data = mujoco.MjData(model)

# Create USD exporter
usd_exp = exporter.USDExporter(model=model)

duration = 5
framerate = 60

# Initialize the viewer
with mujoco.viewer.launch_passive(model, data) as viewer:
    # Simulation loop
    while viewer.is_running() and data.time < duration:
        # Step the simulation
        mujoco.mj_step(model, data)
        
        if usd_exp.frame_count < data.time * framerate:
            # Update the USD scene with current state
            usd_exp.update_scene(data=data)
        
        # Update the viewer
        viewer.sync()

# Save the animation to USD file
usd_exp.save_scene(filetype="usd")

Minimal model for reproduction

My scene.xml copied from Menagerie (Franka Emika Panda's scene.xml)

<mujoco model="panda scene">
  <include file="panda.xml"/>

  <statistic center="0.3 0 0.4" extent="1"/>

  <visual>
    <headlight diffuse="0.6 0.6 0.6" ambient="0.3 0.3 0.3" specular="0 0 0"/>
    <rgba haze="0.15 0.25 0.35 1"/>
    <global azimuth="120" elevation="-20"/>
  </visual>

  <asset>
    <texture type="skybox" builtin="gradient" rgb1="0.3 0.5 0.7" rgb2="0 0 0" width="512" height="3072"/>
    <texture type="2d" name="groundplane" builtin="checker" mark="edge" rgb1="0.2 0.3 0.4" rgb2="0.1 0.2 0.3"
      markrgb="0.8 0.8 0.8" width="300" height="300"/>
    <material name="groundplane" texture="groundplane" texuniform="true" texrepeat="5 5" reflectance="0.2"/>
  </asset>

  <worldbody>
    <light pos="0 0 1.5" dir="0 0 -1" directional="true"/>
    <geom name="floor" size="0 0 0.05" type="plane" material="groundplane"/>
    <camera name="main_camera" pos="1.5 1.5 1.5" quat="0.5 -0.5 0.5 0.5"/>
  </worldbody>
</mujoco>

Code required for reproduction

import mujoco
import mujoco.viewer
from mujoco.usd import exporter

# Load the model -- Franka Emika Panda from Menagerie
model = mujoco.MjModel.from_xml_path("scene.xml")
data = mujoco.MjData(model)

# Create USD exporter
usd_exp = exporter.USDExporter(model=model)

duration = 5
framerate = 60

# Initialize the viewer
with mujoco.viewer.launch_passive(model, data) as viewer:
    # Simulation loop
    while viewer.is_running() and data.time < duration:
        # Step the simulation
        mujoco.mj_step(model, data)
        
        if usd_exp.frame_count < data.time * framerate:
            # Update the USD scene with current state
            usd_exp.update_scene(data=data)
        
        # Update the viewer
        viewer.sync()

# Save the animation to USD file
usd_exp.save_scene(filetype="usd")

Confirmations

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions