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:Google deepmind Mujoco USD Layer Sink

From Leeroopedia
Revision as of 12:47, 16 February 2026 by Admin (talk | contribs) (Auto-imported from implementations/Google_deepmind_Mujoco_USD_Layer_Sink.md)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Knowledge Sources
Domains USD, Animation Export
Last Updated 2026-02-15 04:00 GMT

Overview

Writes MuJoCo simulation body transforms as time-sampled USD transform operations on a USD stage layer for animation export.

Description

layer_sink.cc implements the LayerSink class which authors animated body transforms into a USD stage's edit target layer. For each simulation frame, Update iterates over body paths, reads pose data from mjData, converts positions and quaternions to GfMatrix4d transforms, and writes them as time-coded xformOp:transform:mujoco attribute samples using Pixar's SdfChangeBlock for batched edits. The class uses GetOrCreateAttribute to lazily create SdfAttributeSpec entries for transform attributes. Time codes are computed from simulation time multiplied by the layer's time codes per second.

Usage

Used when recording MuJoCo simulation trajectories to USD format. Each call to Update adds a new time sample for all body transforms, building up an animated USD stage that can be played back in USD-compatible viewers or further processed in VFX pipelines.

Code Reference

Source Location

Key Functions

LayerSink::LayerSink(pxr::UsdStageRefPtr stage);
void LayerSink::Update(const mjData* const data, std::vector<pxr::SdfPath> body_paths);
static pxr::SdfAttributeSpecHandle GetOrCreateAttribute(pxr::SdfLayerHandle layer, pxr::SdfPrimSpecHandle prim_spec, const pxr::SdfPath& path, const pxr::TfToken& token, const pxr::SdfValueTypeName& type, pxr::SdfVariability variability);
// Private token: xformOp:transform:mujoco

Import

#include <mujoco/experimental/usd/layer_sink.h>

I/O Contract

Inputs

Name Type Required Description
stage pxr::UsdStageRefPtr Yes USD stage to write transform samples to
data const mjData* Yes MuJoCo simulation data with body poses
body_paths std::vector<pxr::SdfPath> Yes USD paths for each body to update

Outputs

Name Type Description
Time samples USD layer Transform time samples authored on the stage's edit target layer

Related Pages

Page Connections

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