Metadata-Version: 2.5
Name: mujoco-mojo
Version: 2.8.6
Summary: A complete MJCF lifecycle and trial orchestration suite for MuJoCo, powered by Pydantic v2.
Project-URL: Homepage, https://github.com/Hydrowelder/mujoco-mojo
Project-URL: Documentation, https://hydrowelder.github.io/mujoco-mojo/
Project-URL: Repository, https://github.com/Hydrowelder/mujoco-mojo
Project-URL: Issues, https://github.com/Hydrowelder/mujoco-mojo/issues
Project-URL: Discussions, https://github.com/Hydrowelder/mujoco-mojo/discussions
Author-email: David Gable <dave.a.gable@gmail.com>
Maintainer-email: David Gable <dave.a.gable@gmail.com>
License-Expression: Apache-2.0
License-File: LICENSE
License-File: src/mujoco_mojo/utils/layers/dojo/templates/static/dist/THIRD_PARTY_LICENSES.md
Keywords: mjcf,monte-carlo,mujoco,orchestration,physics,pydantic,robotics,simulation
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Topic :: Scientific/Engineering :: Physics
Classifier: Topic :: Scientific/Engineering :: Visualization
Requires-Python: >=3.12
Requires-Dist: cairosvg>=2.9.1
Requires-Dist: fastapi>=0.134.0
Requires-Dist: filelock>=3.29.0
Requires-Dist: jinja2>=3.1.6
Requires-Dist: matplotlib>=3.10.8
Requires-Dist: mediapy>=1.2.7
Requires-Dist: mujoco>=4.0.0
Requires-Dist: numpy>=2.4.1
Requires-Dist: numpydantic>=1.7.0
Requires-Dist: pillow>=12.3.0
Requires-Dist: pint>=0.25.3
Requires-Dist: pip>=26.1.2
Requires-Dist: platformdirs>=4.5.1
Requires-Dist: polars>=1.39.0
Requires-Dist: pyarrow>=23.0.1
Requires-Dist: pydantic-settings>=2.14.2
Requires-Dist: pydantic>=2.12.5
Requires-Dist: python-dotenv>=1.2.3
Requires-Dist: python-fcl>=0.7.0.11
Requires-Dist: pytransform3d>=3.15.0
Requires-Dist: rich>=14.3.3
Requires-Dist: rtree>=1.4.1
Requires-Dist: scipy>=1.17.0
Requires-Dist: sse-starlette>=3.3.4
Requires-Dist: stochas>=2.2.9
Requires-Dist: tabulate>=0.9.0
Requires-Dist: textual>=8.2.8
Requires-Dist: tomlkit>=0.15.0
Requires-Dist: trimesh>=4.11.2
Requires-Dist: typer>=0.24.1
Requires-Dist: uvicorn>=0.41.0
Requires-Dist: watchfiles>=1.1.1
Provides-Extra: all
Requires-Dist: coacd>=1.0.7; extra == 'all'
Requires-Dist: joblib>=1.5.3; extra == 'all'
Requires-Dist: mink>=1.4.0; extra == 'all'
Requires-Dist: mkdocstrings[python]>=1.0.6; extra == 'all'
Requires-Dist: optuna-dashboard>=0.20.0; extra == 'all'
Requires-Dist: optuna>=4.8.0; extra == 'all'
Requires-Dist: pydantic-ai-harness>=0.75.0; extra == 'all'
Requires-Dist: pydantic-ai>=2.75.0; extra == 'all'
Requires-Dist: requests>=2.32.5; extra == 'all'
Requires-Dist: zensical>=0.1.0; extra == 'all'
Provides-Extra: docs
Requires-Dist: mkdocstrings[python]>=1.0.6; extra == 'docs'
Requires-Dist: zensical>=0.1.0; extra == 'docs'
Provides-Extra: examples
Requires-Dist: mink>=1.4.0; extra == 'examples'
Provides-Extra: mesh-decomp
Requires-Dist: coacd>=1.0.7; extra == 'mesh-decomp'
Provides-Extra: optimize
Requires-Dist: joblib>=1.5.3; extra == 'optimize'
Requires-Dist: optuna-dashboard>=0.20.0; extra == 'optimize'
Requires-Dist: optuna>=4.8.0; extra == 'optimize'
Provides-Extra: sensai
Requires-Dist: pydantic-ai-harness>=0.75.0; extra == 'sensai'
Requires-Dist: pydantic-ai>=2.75.0; extra == 'sensai'
Requires-Dist: requests>=2.32.5; extra == 'sensai'
Description-Content-Type: text/markdown

<p align="center">
    <img alt="MuJoCo Mojo" src="https://raw.githubusercontent.com/hydrowelder/mujoco-mojo/master/docs/assets/dark-hero-logo.svg" style="width: 100%">
</p>

<p align="center">
  <a href="https://pypi.org/project/mujoco-mojo"><img src="https://img.shields.io/pypi/v/mujoco-mojo.svg?cacheSeconds=300" alt="PyPI version"></a>
  <a href="https://pypi.org/project/mujoco-mojo"><img src="https://img.shields.io/pypi/pyversions/mujoco-mojo.svg?cacheSeconds=86400" alt="Python versions"></a>
  <a href="https://github.com/Hydrowelder/mujoco-mojo/actions/workflows/release.yml"><img src="https://github.com/Hydrowelder/mujoco-mojo/actions/workflows/release.yml/badge.svg?branch=master" alt="Tests & Release Status"></a>
  <a href="https://github.com/astral-sh/uv"><img src="https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/uv/main/assets/badge/v0.json" alt="uv"></a>
  <a href="https://github.com/astral-sh/ruff"><img src="https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json" alt="Ruff"></a>
  <a href="https://github.com/astral-sh/ty"><img src="https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ty/main/assets/badge/v0.json" alt="ty"></a>
  <a href="https://docs.pydantic.dev/latest"><img src="https://img.shields.io/badge/Pydantic-v2-FF43A1?logo=pydantic&logoColor=white" alt="Pydantic v2"></a>
  <a href="https://opensource.org/licenses/Apache-2.0"><img src="https://img.shields.io/badge/License-Apache_2.0-blue.svg" alt="License"></a>
  <a href="https://hydrowelder.github.io/mujoco-mojo"><img src="https://img.shields.io/badge/docs-GitHub_Pages-blue.svg" alt="Documentation"></a>
  <a href="https://github.com/Hydrowelder/mujoco-mojo/discussions"><img src="https://img.shields.io/badge/discussions-GitHub-blue?logo=github&logoColor=white" alt="GitHub Discussions"></a>
  <a href="https://pepy.tech/projects/mujoco-mojo"><img src="https://static.pepy.tech/personalized-badge/mujoco-mojo?period=monthly&units=INTERNATIONAL_SYSTEM&left_color=GREY&right_color=BLUE&left_text=downloads%2Fmonth" alt="PyPI Downloads"></a>
</p>

---

A **complete MJCF lifecycle and trial orchestration suite** for [MuJoCo](https://github.com/google-deepmind/mujoco), powered by **Pydantic v2**.

**MuJoCo Mojo** bridges the gap between static XML modeling and large-scale simulation research. It provides a strongly-typed bridge for building models and a robust execution engine for running them at scale.

- **Model:** Build MJCFs via **validated Python objects** allowing for programatic generation.
- **Scale:** Execute **multi-threaded Monte Carlo trials** with built-in resume logic.
- **Monitor:** Track progress via a **zero-dependency web dashboard** and persistent logs.
- **Assess:** Quickly view **interactive results** of a trial in context of others.
- **Reproduce:** Automatic **environment snapshotting** (`requirements.txt`) for every job.

## Installation

Install using `uv` (recommended):

```bash
uv add mujoco-mojo[all]
```

or with `pip`:

```bash
pip install mujoco-mojo[all]
```

> [!NOTE]
>
> To get the most out of MuJoCo Mojo, select additional extras from this list (or use `[all]` to install all of them):
>
> - `[docs]`: build the documentation on your own machine (`mujoco-mojo docs build`).
> - `[mesh-decomp]`: concave mesh decomposition via CoACD.
> - `[optimize]`: Bayesian optimization studies powered by Optuna.
> - `[sensai]`: the SensAI assistant in the Dojo and Reloaded.

---

## Features

### MJCF Tools

- **Strongly-Typed Elements:** MJCF components backed by Pydantic v2 for immediate validation.
- **Semantic Validation:** Early detection of structural errors and attribute mismatches before the engine starts.
- **MuJoCo Alignment:** Designed to mirror MuJoCo’s XML schema closely (no magic abstractions)
- **Object Enumerations:** Embedded MuJoCo object mappings to simplify retrieving `mjOBJ` IDs.
- **Asset Sharing:** Specialized handling of dependency by remapping assets to become shared allows for space efficient execution of complex models

### Runtime Toolkit

- **Forcing Functions:** A library of typed `Load` definitions (spring-dampers, point-to-point forces, friction, and more) that apply themselves including reaction forces.
- **Proximity Sensing:** Built-in distance and closest-point tracking between sites and bodies, exposed as both telemetry signals and live overlays with no extra instrumentation. Works on concave geometry meshes.
- **Structured Telemetry:** A single `post`/`track` call records any value into a hierarchical namespace during simulations. This include prebuilt `request` calls for commonly desired values.
- **Video Recording:** Multi-camera MP4/WebM/GIF capture synced to simulation time, with playback-speed control, force/proximity overlays, on-frame labels, and single-frame snapshots.

### Job Utilities

#### Campaign Orchestration

- **Multi-Threaded Execution:** Single or multi-threaded trial execution
- **Environment Snapshotting:** Automatically record installed Python packages to `requirements.txt` for job recreation (works with `uv` or `pip`)
- **Resume Logic:** Resume a previously started job without rerunning previous cases
- **Robust Logging:** Built in Rich logging for terminal and a rotating file handler for persistent logs and status files for insight on trial progress
- **Global Overrides:** Force specific values onto distributions via CLI or JSON overrides to test "golden" cases.

#### Monte Carlo

- **Reproducible Sampling:** Random draw tools for Monte Carlo or rerun with global variable override
- End of run summary with metric to help perform a state of health check
- Support for running jobs with SLURM for distributed compute

> [!TIP]
>
> ```bash
> mujoco-mojo run monte-carlo \
>     --generator monte_carlo_test.Experiment.generate \
>     --runtime monte_carlo_test.runtime \
>     --workdir ./mc_test/ \
>     --no-resume \
>     --arg 123 \
>     --kwarg 'test=1234' \
>     --n-trial 10 \
>     --n-proc 1
> ```

#### Optimization

- **Bayesian Search:** Intelligent design space navigation powered by Optuna integration.
- **Design Variables:** Continuous (`DesignFloat`) and discrete (`DesignCategorical`) parameters evolved by the solver.
- **Adaptive Refinement:** "Zoom" into promising neighborhoods by aggressively shrinking search bounds on resume.
- **Stochastic Robustness:** Multi-evaluation trials that average scores over different seeds to filter out noisy physics outliers.

> [!TIP]
>
> ```bash
> mujoco-mojo run optimization \
>     -g sim.generate \
>     -r sim.runtime \
>     --objective sim.objective \
>     --n-trial 400 \
>     --n-proc 10 \
>     --seed 42 \
>     --storage \
>     --direction minimize
> ```

### Dojo Dashboard

A zero-dependency, offline-first web suite for monitoring and analyzing your simulation jobs in real-time.

#### Monitor: Real-Time Oversight

- **Live Progress Tracking:** Dynamic progress bars and color-coded status cards provide a high-level view of your Monte Carlo runs.
- **Success, Failure and Error Analytics:** Every trial lands in one of three outcomes, so a run that missed a requirement is never confused with one that crashed, and a timeline shows how the job progressed.
- **Sensory Feedback:** Optional audio cues and visual celebrations let you know exactly when a multi-hour job hits 100%.
- **Deep-Linked Navigation:** Jump straight from the monitor to any individual trial in the viewer with one click.

#### Mosaic: Advanced Telemetry Analysis

- **High-Fidelity Plotting:** Hardware-accelerated visualization using Plotly.js for seamless zooming and panning through millions of data points.
- **Dynamic Versus Mode:** Overlay current telemetry against previous trials using an intuitive range-selection slider for instant regression testing.
- **Regex-Powered Filtering:** Navigate high-dimensional datasets using a "folder-style" signal selector with suffix and regex support.
- **State Persistence & Sharing:** Every view is captured in a shareable, compressed URL by pasting a link to share your exact configuration.
- **Pro-Grade Tooling:** Built-in JSON configuration editor, drag-and-drop config restoration, and multi-format exports (SVG, PNG, CSV).
- **Keyboard-First Design:** Full hotkey support for warping between trials and managing views without leaving the home row.
- **Trial Details:** Under every plot, the trial's animation, where its random draws fell in their distributions, its requirements and its logs.
- **Signal Lab:** Build new signals after the run by wiring recorded signals through filters, arithmetic and frame changes on a canvas.

#### Morph and SensAI

- **Morph:** For optimization jobs, an embedded Optuna Dashboard shows how the search converged and which parameters mattered.
- **SensAI:** An optional assistant (bring your own model) that answers questions about your job, edits your plot, and explains how to use Mojo from the docs that ship with it. Each of these can be switched off on its own.

### Reloaded

A rapid prototyping loop that allows you to modify physics logic and model architecture on the fly without ever closing the visualizer.

- **Module Hot-Reloading:** Recursively reloads local Python modules and MJCF logic, allowing code changes to propagate instantly to the active simulation.
- **Unified Visualizer Bridge:** Synchronized visualization of custom force and torque vectors across the viewer (the classic OpenGL window, MuJoCo Studio, or Studio in a browser) and video recordings.
- **Terminal UI:** Drive the reload/sync pipeline from a terminal UI with clickable settings, command completion, and a log of every run.
- **Interactive Prototyping:** A developer-centric command loop to toggle playback speeds, repeat last commands, watch for file changes and auto-reload, switch telemetry recording on or off mid-session, or trigger "generation-only" mode for rapid MJCF debugging.
- **Live Session Controls:** Adjust the seed and trial number on the fly with `seed <N>` and `trial <N>`, without restarting the loop.
- **Ask SensAI:** With SensAI on, `sensai <question>` answers how to use Mojo from the docs, right in the log, while a run goes on.
- **Asset Persistence:** Automatically dumps current MJCF snapshots and model configurations to a workspace directory for post-hoc analysis or version tracking.

> [!TIP]
>
> ```bash
> mujoco-mojo reloaded \
>     --generator monte_carlo_test.Experiment.generate \
>     --runtime monte_carlo_test.runtime \
> ```

---

> [!NOTE]
>
> **MuJoCo Mojo** is an independently developed open-source toolbox. It is **not** affiliated with, sponsored by, or endorsed by **Google DeepMind** or the official **MuJoCo** development team.
> MuJoCo® is a registered trademark of Google LLC. All MJCF schemas and MuJoCo-related terminology used within this project are for compatibility and documentation purposes only.
