Metadata-Version: 2.3
Name: mujoco-toolbox
Version: 0.6.2
Summary: A Modern Simulation Wrapper for Google DeepMind's MuJoCo
License: MIT License
         
         Copyright (c) 2025 Michael Gross
         
         Permission is hereby granted, free of charge, to any person obtaining a copy
         of this software and associated documentation files (the "Software"), to deal
         in the Software without restriction, including without limitation the rights
         to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
         copies of the Software, and to permit persons to whom the Software is
         furnished to do so, subject to the following conditions:
         
         The above copyright notice and this permission notice shall be included in all
         copies or substantial portions of the Software.
         
         THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
         IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
         FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
         AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
         LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
         OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
         SOFTWARE.
Keywords: MuJoCo,mujoco,robotics,simulation,toolbox,wrapper
Author: MGross21
Author-email: MGross21@example.com
Requires-Python: >=3.9,<4.0
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: MIT License
Classifier: Programming Language :: Python 3.9
Classifier: Programming Language :: Python 3.10
Classifier: Programming Language :: Python 3.11
Classifier: Programming Language :: Python 3.12
Classifier: Programming Language :: Python 3.13
Classifier: Operating System :: OS Independent
Provides-Extra: gym
Requires-Dist: colorama
Requires-Dist: defusedxml (>=0.7.1,<0.8.0)
Requires-Dist: ffmpeg
Requires-Dist: gym ; extra == "gym"
Requires-Dist: ipywidgets
Requires-Dist: jinja2
Requires-Dist: matplotlib
Requires-Dist: mediapy
Requires-Dist: mujoco
Requires-Dist: numpy
Requires-Dist: opencv-python
Requires-Dist: pyyaml
Requires-Dist: rich
Requires-Dist: scipy
Requires-Dist: screeninfo
Requires-Dist: tqdm
Requires-Dist: trimesh
Project-URL: Bug Tracker, https://github.com/MGross21/mujoco-toolbox/issues
Project-URL: Documentation, https://mgross21.github.io/mujoco-toolbox/
Project-URL: Homepage, https://github.com/MGross21/mujoco-toolbox
Project-URL: Repository, https://github.com/MGross21/mujoco-toolbox
Project-URL: changelog, https://github.com/MGross21/mujoco-toolbox/blob/main/CHANGELOG.md
Description-Content-Type: text/markdown

<h1 align="center">
<img src="https://raw.githubusercontent.com/MGross21/mujoco-toolbox/main/assets/images/mjtb_logo_transparent.png" width="400">
</h1><br>

![Build](https://github.com/MGross21/mujoco-toolbox/actions/workflows/ci.yml/badge.svg)
![Python](https://img.shields.io/badge/python-3.9%20|%203.10%20|%203.11%20|%203.12%20|%203.13-blue)
![License](https://img.shields.io/github/license/MGross21/mujoco-toolbox)
[![PyPI](https://github.com/MGross21/mujoco-toolbox/actions/workflows/publish.yml/badge.svg)](https://github.com/MGross21/mujoco-toolbox/actions/workflows/publish.yml)
[![Docs](https://github.com/MGross21/mujoco-toolbox/actions/workflows/docs.yml/badge.svg)](https://github.com/MGross21/mujoco-toolbox/actions/workflows/docs.yml)

A Modern Simulation Wrapper for Google DeepMind’s MuJoCo

> **⚠️ WARNING**  
> This package is currently in its zero-release stage. Class methods and APIs may change without prior notice. Please review the documentation and changelog after each update to stay informed about any modifications.

## Installation

*Add `-U` flag to upgrade pre-existing library*

### PyPI Package

[![PyPI version](https://img.shields.io/pypi/v/mujoco-toolbox?labelColor=333333&color=%23800080)](https://pypi.org/project/mujoco-toolbox/)

```bash
pip install mujoco-toolbox
```

### GitHub Package

[![GitHub release](https://img.shields.io/github/v/release/MGross21/mujoco-toolbox?label=github&labelColor=333333&color=%23800080)](https://github.com/MGross21/mujoco-toolbox/releases)

```bash
pip install git+https://github.com/MGross21/mujoco-toolbox.git@main
```


### Adding to Project Dependencies
<details>

<summary><b>Click to Expand</b></summary><br>


Place the following in your `requirements.txt` or `pyproject.toml` file.

### PyPI

Expect less frequent, stable releases.

```
mujoco-toolbox
```

### Github

Expect frequent rolling releases.

```
git+https://github.com/MGross21/mujoco-toolbox.git@main#egg=mujoco-toolbox
```

</details>

## Extra Packages

<details>
<summary><b>FFMPEG</b></summary>

</br>

*Required for [mediapy](https://google.github.io/mediapy/mediapy.html) dependency*

**Windows**

```bash
winget install ffmpeg
ffmpeg -version
```

**Linux**

*Debian/Ubuntu*

```bash
sudo apt update && sudo apt install ffmpeg
ffmpeg -version
```

*Arch Linux*

```bash
sudo pacman -Syu ffmpeg
ffmpeg -version
```

**MacOS**

*Using Homebrew*

```bash
brew install ffmpeg
ffmpeg -version
```

*Using MacPorts*

```bash
sudo port install ffmpeg
ffmpeg -version
```

</details>

## Example Script

*Bare minimum to run MuJoCo simulation and display result*

```python
import mujoco_toolbox as mjtb

mjtb.Simulation("path/to/your/xml").run(render=True).save()
```

## Controllers

### Pre-Made Controllers

The following controllers are available out-of-the-box:

- `sin`
- `cos`
- `step`
- `random`
- `real_time` <sub>(recommended controller for digital twins)</sub>

You can import them as follows:

```python
import mujoco_toolbox.controllers as ctrl
```

### Custom

```python

def foo(model: MjModel, data: MjData,**kwargs):
    # Perform logic based on model/data objects
    # ie. PID Controller
```

## Instantiating a Digital Twin

```python
import mujoco_toolbox as mjtb
from mujoco_toolbox.controllers import real_time

with mjtb.Simulation("path/to/xml", controller=real_time) as digitaltwin:
    digitaltwin.launch(show_menu=False) # Open the simulation window
    while True:
        digitaltwin.controller(digitaltwin.model, digitaltwin.data, {"mjdata_kwargs": value})
```

See `MjData` objects [here](https://mujoco.readthedocs.io/en/stable/APIreference/APItypes.html#mjdata)

## File Support

### XML / MJCF (Native)

```python
import mujoco_toolbox as mjtb

mjtb.Simulation("path/to/xml").show()
```

<img src="https://raw.githubusercontent.com/MGross21/mujoco-toolbox/main/assets/images/ur5_vention.png" alt="UR5/Vention" width="300">

### URDF

```python
import mujoco_toolbox as mjtb

mjtb.Simulation("path/to/urdf", meshdir="path/to/mesh/files").show()  # supports *.stl or *.obj
```

<img src="https://raw.githubusercontent.com/MGross21/mujoco-toolbox/main/assets/images/ur5_render_no_gui.png" alt="UR5" width="300">

## Merging Capabilities

Supports full `<mujoco>...</mujoco>` and `<robot>...</robot>` structure as well as complete sub-tree structures.

```python
import mujoco_toolbox as mjtb

# Merges: XML & URDF Files, XML & URDF Strings, Sub Tree Structures
mjtb.Simulation("path/to/xml_1", string_xml_var, ..., "path/to/xml_n").show()

```

> **⚠️ WARNING**  
> Duplicate sub-tree items with the same name will cause MuJoCo to throw a `FatalError`.

<img src="https://raw.githubusercontent.com/MGross21/mujoco-toolbox/main/assets/images/human_in_box.png" alt="Humanoid in Box" width="300">

