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 MJWarp Viewer

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

Overview

MJWarp Viewer is a command-line application that loads MJCF models and runs interactive simulation using MuJoCo Warp with the MuJoCo passive viewer.

Description

This module implements the mjwarp-viewer command-line tool for loading and interactively simulating MJCF/MJB models using MuJoCo Warp. It supports CUDA graph capture for optimized step replay, hot-recompilation when simulation options change in the viewer UI, keyframe initialization, model overrides via command-line flags, trajectory replay from keyframe sequences, and both Warp GPU and MuJoCo C engine backends. The viewer synchronizes GPU-computed state back to MuJoCo's native viewer for visualization, with space bar pause/resume and period for single-step.

Usage

Run from the command line as mjwarp-viewer <path_to_mjcf.xml> with optional flags for engine selection, contact limits, device override, model overrides, and keyframe selection.

Code Reference

Source Location

Key Functions

# Engine selection enum
class EngineOptions(enum.IntEnum):
    WARP = 0
    C = 1

# Main application entry point
def main()
def _main(argv: Sequence[str]) -> None

# Model loading
def _load_model(path: epath.Path) -> mujoco.MjModel

# CUDA graph compilation
def _compile_step(m, d) -> graph

# Keyboard callback for pause/step
def key_callback(key: int) -> None

# Command-line flags
_CLEAR_WARP_CACHE, _ENGINE, _NCONMAX, _NJMAX, _NCCDMAX
_OVERRIDE, _KEYFRAME, _DEVICE, _REPLAY

Import

from mujoco.mjx.third_party.mujoco_warp.viewer import main

I/O Contract

Inputs

Name Type Required Description
argv[1] str Yes Path to MJCF XML or MJB binary model file
--engine EngineOptions No Simulation engine: WARP (default) or C
--nconmax int No Maximum number of contacts
--njmax int No Maximum number of constraints per world
--override / -o str No Model overrides (e.g., "opt.solver=cg")
--keyframe int No Keyframe index to initialize from (default 0)
--device str No Warp device override
--replay str No Keyframe name prefix for trajectory replay

Outputs

Name Type Description
(interactive) viewer window Real-time visualization of MuJoCo Warp simulation in MuJoCo viewer

Related Pages

Page Connections

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