MuJoCo Warp (MJWarp)

repository·main·Indexed 23 days ago

https://github.com/google-deepmind/mujoco_warp

A GPU-accelerated version of the MuJoCo physics simulator optimized for NVIDIA hardware. Designed for high-throughput, accurate simulation in robotics research, it supports rigid bodies, soft bodies, cloth, and Signed Distance Function (SDF) queries. The package includes a comprehensive benchmark suite for testing collision pipelines, deformable bodies, and GPU ray-traced rendering performance across various robotic configurations and environments.

Tokens
11.3K
Snippets
31
Records
70
Agent score
80%

What's inside mujoco-warp

  1. Overview of Unitree G1 Humanoid Benchmark

    main
    The Unitree G1 benchmark is a full-body humanoid locomotion benchmark using the Unitree G1 (29 DOF) robot with capsule-based collision geometry. It is designed for locomotion testing with simulation settings that match those used for training in mjlab. The benchmark includes variants for testing performance on flat terrain, randomized heightfield terrain, and GPU ray-traced rendering performance.
  2. Overview of the MyoSim MyoArm benchmark

    main

    The MyoArm is a musculoskeletal model of the human arm from the MyoSim project. It serves as a high-complexity benchmark for testing MuJoCo Warp's tendon and actuation pipelines due to its high actuator count and degrees of freedom.

    Model Specifications:

    • Bodies: 40
    • Degrees of Freedom (DoFs): 38
    • Actuators: 63 muscle-tendon actuators
    • Geoms: 161
    • Timestep: 0.002s
    • Solver: Newton
    • Friction: Pyramidal
    • Integrator: Euler
    • Matrix Format: Sparse
  3. Overview of Aloha robot benchmarks

    main
    The Aloha benchmarks are designed for testing different collision pipelines and object interactions using the ALOHA 2 robot on a workbench. These benchmarks exercise various MuJoCo Warp capabilities, including convex mesh collision, Signed Distance Function (SDF) queries, deformable bodies, and constraint islands/sleeping with many convex mesh pairs.
  4. Overview of Humanoid Benchmarks

    main
    The Humanoid benchmark suite serves as the 'hello world' for MuJoCo Warp (MJWarp), used to verify that core algorithms are performant, sound, and free of regressions. It includes two primary configurations: a single humanoid for basic verification and a three-humanoid setup to test performance transitions between dense and sparse matrix solvers.
  5. Understand the GPU ray-traced rendering benchmarks

    main
    The render benchmarks in MuJoCo Warp (MJWarp) measure GPU ray-traced rendering performance across two distinct scenarios: simple primitive layouts and complex textured meshes. These benchmarks evaluate how the system handles varying levels of geometric and textural complexity at a resolution of 64×64 across 8192 worlds.
  6. Use the MJWarp Batch Renderer

    main

    MJWarp includes a high-throughput GPU batch renderer designed for simultaneous rendering of cameras across many parallel simulation worlds using ray-tracing. It is optimized for NVIDIA GPUs.

    Key capabilities include:

    • Mesh rendering
    • Texture support
    • Heightfield rendering
    • Flex deformable rendering
    • Heterogeneous multi-camera support (different resolutions, FOV, and intrinsics per camera)
    • Lighting and shadow support
  7. Manage external assets with the ASSETS list

    main

    If a benchmark requires external assets (e.g., from MuJoCo Menagerie), define them in an ASSETS list. The run.py script will automatically fetch these before execution.

    Defining ASSETS: Each entry in ASSETS is a dictionary with a source (URL/Git repo) and a ref (commit hash).

    ASSETS = [
      {
        "source": "https://github.com/google-deepmind/mujoco_menagerie.git",
        "ref": "affef0836947b64cc06c4ab1cbf0152835693374",
      }
    ]

    Mapping assets to the workspace: In the BENCHMARKS dictionary, use the assets field to map fetched assets using tuples of (asset, src_subpath[, dst_subpath]).

    • (ASSETS[0], "aloha"): Copies the entire aloha/ directory.
    • (ASSETS[1], "model/plugin/sdf/asset", "assets"): Copies a specific subpath and renames the destination.
    • (ASSETS[2], "aloha_sim/assets/ycb/*/google_64k", "assets/ycb"): Uses a glob pattern (*) to expand directories into the destination.

    Example usage in BENCHMARKS:

    "assets": [
      (ASSETS[0], "aloha"),
      (ASSETS[1], "model/plugin/sdf/asset", "assets"),
      (ASSETS[2], "aloha_sim/assets/ycb/*/google_64k", "assets/ycb"),
    ]
    ASSETS = [
      {
        "source": "https://github.com/google-deepmind/mujoco_menagerie.git",
        "ref": "affef0836947b64cc06c4ab1cbf0152835693374",
      }
    ]
    
    # Inside a BENCHMARKS dict:
    "assets": [
      (ASSETS[0], "aloha"),
      (ASSETS[1], "model/plugin/sdf/asset", "assets"),
      (ASSETS[2], "aloha_sim/assets/ycb/*/google_64k", "assets/ycb"),
    ]
  8. Use the Kernel Analyzer CLI

    main

    The Kernel Analyzer CLI can be used to check Warp kernels against specific types.

    Standard usage: Pass the paths to the kernels you want to check and use the --types flag to specify the types file.

    GitHub CI usage: To use the CLI within a GitHub CI environment, add the --output=github flag to generate appropriate output.

    Command Examples:

    Standard:

    python contrib/kernel_analyzer/kernel_analyzer/cli.py mujoco_warp/_src/*.py --types mujoco_warp/_src/types.py 

    GitHub CI:

    python contrib/kernel_analyzer/kernel_analyzer/cli.py mujoco_warp/_src/*.py --types mujoco_warp/_src/types.py --output=github
    python contrib/kernel_analyzer/kernel_analyzer/cli.py mujoco_warp/_src/*.py --types mujoco_warp/_src/types.py --output=github
  9. Install MuJoCo Warp (MJWarp)

    main

    You can install MJWarp via PyPI for standard use, or clone the repository for local development and running benchmarks.

    Standard Installation:

    pip install mujoco-warp

    Development Setup: To set up the repository for development, including all optional dependencies and pre-commit hooks:

    git clone https://github.com/google-deepmind/mujoco_warp.git && cd mujoco_warp
    uv sync --all-extras
    uv run pre-commit install
    uv run pytest -n 8
    pip install mujoco-warp
  10. Manage and monitor nightly benchmark jobs

    main

    Use the following commands to manage the mjwarp-nightly service and timer, or to inspect the benchmark execution:

    • Check timer status: systemctl --user status mjwarp-nightly.timer
    • List all timers: systemctl --user list-timers (shows when jobs will run next)
    • Run benchmark manually: systemctl --user start mjwarp-nightly.service (triggers an immediate run without waiting for the timer)
    • View logs: Use journalctl to inspect output:
      • Follow logs in real-time: journalctl --user -u mjwarp-nightly.service -f
      • View logs from the last hour: journalctl --user -u mjwarp-nightly.service --since "1 hour ago"
    • Disable the timer: systemctl --user disable mjwarp-nightly.timer
    # Check timer status
    systemctl --user status mjwarp-nightly.timer
    
    # List all timers and when they'll run next
    systemctl --user list-timers
    
    # Run the benchmark manually (without waiting for timer)
    systemctl --user start mjwarp-nightly.service
    
    # View logs
    journalctl --user -u mjwarp-nightly.service -f
    
    # View recent logs
    journalctl --user -u mjwarp-nightly.service --since "1 hour ago"
    
    # Disable the timer
    systemctl --user disable mjwarp-nightly.timer