Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Implementation:ARISE Initiative Robosuite USDObjects

From Leeroopedia
Knowledge Sources
Domains Robotics, 3D Rendering, USD Export
Last Updated 2026-02-15 07:00 GMT

Overview

The USDObjects module defines the object hierarchy for representing MuJoCo scene geometry as USD primitives, including abstract base objects, meshes, primitive shapes, and tendons.

Description

This module contains four classes that form the core object model for the USD exporter. The abstract base class USDObject defines the shared interface for all USD scene objects, including transform operations, visibility management, material attachment (both image-textured and solid-color), and per-frame animation updates. It creates a USD Xform node for each object and manages transform and scale operations.

Three concrete subclasses implement specific geometry types. USDMesh handles predefined mesh geometries loaded from the MuJoCo model, extracting vertex positions, face indices, and UV texture coordinates directly from the model's mesh data arrays. USDPrimitiveMesh handles primitive shapes (boxes, spheres, cylinders, etc.) by generating triangle meshes from configuration dictionaries using the shapes module. USDTendon handles tendon visualization as composite objects made of multiple sub-meshes (typically a cylinder with hemisphere caps), with independent scaling and translation for each component part.

All three subclasses support both image-based textures (with full UV mapping, BSDF shaders, and texture repeat settings) and solid-color materials with configurable metallic/roughness properties derived from the MuJoCo geom's shininess value.

Usage

Use these classes when building USD scenes from MuJoCo simulation data. They are instantiated internally by the USDExporter class and are not typically used directly. They are useful for understanding how MuJoCo geometry is mapped to USD representations.

Code Reference

Source Location

Signature

class USDObject(abc.ABC):
    def __init__(
        self,
        stage: Usd.Stage,
        model: mujoco.MjModel,
        geom: mujoco.MjvGeom,
        obj_name: str,
        rgba: np.ndarray = np.array([1, 1, 1, 1]),
        texture_file: Optional[str] = None,
    )

class USDMesh(USDObject):
    def __init__(
        self,
        stage: Usd.Stage,
        model: mujoco.MjModel,
        geom: mujoco.MjvGeom,
        obj_name: str,
        dataid: int,
        rgba: np.ndarray = np.array([1, 1, 1, 1]),
        texture_file: Optional[str] = None,
    )

class USDPrimitiveMesh(USDObject):
    def __init__(
        self,
        mesh_config: Dict[Any, Any],
        stage: Usd.Stage,
        model: mujoco.MjModel,
        geom: mujoco.MjvGeom,
        obj_name: str,
        rgba: np.ndarray = np.array([1, 1, 1, 1]),
        texture_file: Optional[str] = None,
    )

class USDTendon(USDObject):
    def __init__(
        self,
        mesh_config: Dict[Any, Any],
        stage: Usd.Stage,
        model: mujoco.MjModel,
        geom: mujoco.MjvGeom,
        obj_name: str,
        rgba: np.ndarray = np.array([1, 1, 1, 1]),
        texture_file: Optional[str] = None,
    )

Import

import robosuite.utils.usd.objects as object_module
# or
from robosuite.utils.usd.objects import USDObject, USDMesh, USDPrimitiveMesh, USDTendon

I/O Contract

Inputs

Name Type Required Description
stage Usd.Stage Yes The USD stage to add objects to
model mujoco.MjModel Yes MuJoCo model instance
geom mujoco.MjvGeom Yes MuJoCo visualization geom to represent
obj_name str Yes Unique name for the USD object
dataid int Yes (USDMesh only) Mesh data ID in the MuJoCo model
mesh_config Dict[Any, Any] Yes (USDPrimitiveMesh, USDTendon) Configuration dictionary for generating primitive meshes
rgba np.ndarray No RGBA color array (default: [1,1,1,1])
texture_file Optional[str] No Path to texture file for image-based materials

Outputs

Name Type Description
usd_mesh UsdGeom.Mesh The USD mesh geometry representation
usd_xform UsdGeom.Xform The USD transform node for positioning
last_visible_frame int Track the last frame where the object was visible (for visibility animation)

Usage Examples

# USDMesh is typically created internally by USDExporter._load_geom()
# Example of how a mesh geom is loaded:
usd_geom = USDMesh(
    stage=stage,
    model=model,
    geom=geom,
    obj_name="robot_arm_id5_geom",
    dataid=model.geom_dataid[geom.objid],
    rgba=geom.rgba,
    texture_file=texture_files[geom.texid],
)

# Update the object position/orientation for a given frame
usd_geom.update(
    pos=geom.pos,
    mat=geom.mat,
    visible=True,
    frame=10,
)

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment