mujoco-toolbox


Namemujoco-toolbox JSON
Version 0.6.3 PyPI version JSON
download
home_pagehttps://github.com/MGross21/mujoco-toolbox
SummaryA Modern Simulation Wrapper for Google DeepMind's MuJoCo
upload_time2025-08-17 09:02:23
maintainerNone
docs_urlNone
authorMGross21
requires_python<4.0,>=3.9
licenseMIT 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
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            <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">

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/MGross21/mujoco-toolbox",
    "name": "mujoco-toolbox",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4.0,>=3.9",
    "maintainer_email": null,
    "keywords": "MuJoCo, mujoco, robotics, simulation, toolbox, wrapper",
    "author": "MGross21",
    "author_email": "MGross21@example.com",
    "download_url": "https://files.pythonhosted.org/packages/a5/a8/9885669c47868adaa78589975b78551b238903a801ab39b40bd2975fef36/mujoco_toolbox-0.6.3.tar.gz",
    "platform": null,
    "description": "<h1 align=\"center\">\n<img src=\"https://raw.githubusercontent.com/MGross21/mujoco-toolbox/main/assets/images/mjtb_logo_transparent.png\" width=\"400\">\n</h1><br>\n\n![Build](https://github.com/MGross21/mujoco-toolbox/actions/workflows/ci.yml/badge.svg)\n![Python](https://img.shields.io/badge/python-3.9%20|%203.10%20|%203.11%20|%203.12%20|%203.13-blue)\n![License](https://img.shields.io/github/license/MGross21/mujoco-toolbox)\n[![PyPI](https://github.com/MGross21/mujoco-toolbox/actions/workflows/publish.yml/badge.svg)](https://github.com/MGross21/mujoco-toolbox/actions/workflows/publish.yml)\n[![Docs](https://github.com/MGross21/mujoco-toolbox/actions/workflows/docs.yml/badge.svg)](https://github.com/MGross21/mujoco-toolbox/actions/workflows/docs.yml)\n\nA Modern Simulation Wrapper for Google DeepMind\u2019s MuJoCo\n\n> **\u26a0\ufe0f WARNING**  \n> 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.\n\n## Installation\n\n*Add `-U` flag to upgrade pre-existing library*\n\n### PyPI Package\n\n[![PyPI version](https://img.shields.io/pypi/v/mujoco-toolbox?labelColor=333333&color=%23800080)](https://pypi.org/project/mujoco-toolbox/)\n\n```bash\npip install mujoco-toolbox\n```\n\n### GitHub Package\n\n[![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)\n\n```bash\npip install git+https://github.com/MGross21/mujoco-toolbox.git@main\n```\n\n\n### Adding to Project Dependencies\n<details>\n\n<summary><b>Click to Expand</b></summary><br>\n\n\nPlace the following in your `requirements.txt` or `pyproject.toml` file.\n\n### PyPI\n\nExpect less frequent, stable releases.\n\n```\nmujoco-toolbox\n```\n\n### Github\n\nExpect frequent rolling releases.\n\n```\ngit+https://github.com/MGross21/mujoco-toolbox.git@main#egg=mujoco-toolbox\n```\n\n</details>\n\n## Extra Packages\n\n<details>\n<summary><b>FFMPEG</b></summary>\n\n</br>\n\n*Required for [mediapy](https://google.github.io/mediapy/mediapy.html) dependency*\n\n**Windows**\n\n```bash\nwinget install ffmpeg\nffmpeg -version\n```\n\n**Linux**\n\n*Debian/Ubuntu*\n\n```bash\nsudo apt update && sudo apt install ffmpeg\nffmpeg -version\n```\n\n*Arch Linux*\n\n```bash\nsudo pacman -Syu ffmpeg\nffmpeg -version\n```\n\n**MacOS**\n\n*Using Homebrew*\n\n```bash\nbrew install ffmpeg\nffmpeg -version\n```\n\n*Using MacPorts*\n\n```bash\nsudo port install ffmpeg\nffmpeg -version\n```\n\n</details>\n\n## Example Script\n\n*Bare minimum to run MuJoCo simulation and display result*\n\n```python\nimport mujoco_toolbox as mjtb\n\nmjtb.Simulation(\"path/to/your/xml\").run(render=True).save()\n```\n\n## Controllers\n\n### Pre-Made Controllers\n\nThe following controllers are available out-of-the-box:\n\n- `sin`\n- `cos`\n- `step`\n- `random`\n- `real_time` <sub>(recommended controller for digital twins)</sub>\n\nYou can import them as follows:\n\n```python\nimport mujoco_toolbox.controllers as ctrl\n```\n\n### Custom\n\n```python\n\ndef foo(model: MjModel, data: MjData,**kwargs):\n    # Perform logic based on model/data objects\n    # ie. PID Controller\n```\n\n## Instantiating a Digital Twin\n\n```python\nimport mujoco_toolbox as mjtb\nfrom mujoco_toolbox.controllers import real_time\n\nwith mjtb.Simulation(\"path/to/xml\", controller=real_time) as digitaltwin:\n    digitaltwin.launch(show_menu=False) # Open the simulation window\n    while True:\n        digitaltwin.controller(digitaltwin.model, digitaltwin.data, {\"mjdata_kwargs\": value})\n```\n\nSee `MjData` objects [here](https://mujoco.readthedocs.io/en/stable/APIreference/APItypes.html#mjdata)\n\n## File Support\n\n### XML / MJCF (Native)\n\n```python\nimport mujoco_toolbox as mjtb\n\nmjtb.Simulation(\"path/to/xml\").show()\n```\n\n<img src=\"https://raw.githubusercontent.com/MGross21/mujoco-toolbox/main/assets/images/ur5_vention.png\" alt=\"UR5/Vention\" width=\"300\">\n\n### URDF\n\n```python\nimport mujoco_toolbox as mjtb\n\nmjtb.Simulation(\"path/to/urdf\", meshdir=\"path/to/mesh/files\").show()  # supports *.stl or *.obj\n```\n\n<img src=\"https://raw.githubusercontent.com/MGross21/mujoco-toolbox/main/assets/images/ur5_render_no_gui.png\" alt=\"UR5\" width=\"300\">\n\n## Merging Capabilities\n\nSupports full `<mujoco>...</mujoco>` and `<robot>...</robot>` structure as well as complete sub-tree structures.\n\n```python\nimport mujoco_toolbox as mjtb\n\n# Merges: XML & URDF Files, XML & URDF Strings, Sub Tree Structures\nmjtb.Simulation(\"path/to/xml_1\", string_xml_var, ..., \"path/to/xml_n\").show()\n\n```\n\n> **\u26a0\ufe0f WARNING**  \n> Duplicate sub-tree items with the same name will cause MuJoCo to throw a `FatalError`.\n\n<img src=\"https://raw.githubusercontent.com/MGross21/mujoco-toolbox/main/assets/images/human_in_box.png\" alt=\"Humanoid in Box\" width=\"300\">\n",
    "bugtrack_url": null,
    "license": "MIT License\n\nCopyright (c) 2025 Michael Gross\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.",
    "summary": "A Modern Simulation Wrapper for Google DeepMind's MuJoCo",
    "version": "0.6.3",
    "project_urls": {
        "Bug Tracker": "https://github.com/MGross21/mujoco-toolbox/issues",
        "Documentation": "https://mgross21.github.io/mujoco-toolbox/",
        "Homepage": "https://github.com/MGross21/mujoco-toolbox",
        "Repository": "https://github.com/MGross21/mujoco-toolbox",
        "changelog": "https://github.com/MGross21/mujoco-toolbox/blob/main/CHANGELOG.md"
    },
    "split_keywords": [
        "mujoco",
        " mujoco",
        " robotics",
        " simulation",
        " toolbox",
        " wrapper"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "192678a7138a2167e9ac0d4ae1274870a0a98190b5e2d36e0d0367a88a180bac",
                "md5": "78f103883960329bcd76080991004321",
                "sha256": "cec0e0c085e92c4d1b63c9b4c5fd625b49d35bb964a6501b85644eae5383384c"
            },
            "downloads": -1,
            "filename": "mujoco_toolbox-0.6.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "78f103883960329bcd76080991004321",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.9",
            "size": 23822,
            "upload_time": "2025-08-17T09:02:21",
            "upload_time_iso_8601": "2025-08-17T09:02:21.681274Z",
            "url": "https://files.pythonhosted.org/packages/19/26/78a7138a2167e9ac0d4ae1274870a0a98190b5e2d36e0d0367a88a180bac/mujoco_toolbox-0.6.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "a5a89885669c47868adaa78589975b78551b238903a801ab39b40bd2975fef36",
                "md5": "6d7ca0f3d084a894adb6af4215bb3f80",
                "sha256": "997cd0a0bab83f5ce1023bcf7784012657344b4131bb7a3324bfe2259a805f6e"
            },
            "downloads": -1,
            "filename": "mujoco_toolbox-0.6.3.tar.gz",
            "has_sig": false,
            "md5_digest": "6d7ca0f3d084a894adb6af4215bb3f80",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.9",
            "size": 23265,
            "upload_time": "2025-08-17T09:02:23",
            "upload_time_iso_8601": "2025-08-17T09:02:23.004125Z",
            "url": "https://files.pythonhosted.org/packages/a5/a8/9885669c47868adaa78589975b78551b238903a801ab39b40bd2975fef36/mujoco_toolbox-0.6.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-08-17 09:02:23",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "MGross21",
    "github_project": "mujoco-toolbox",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "mujoco-toolbox"
}
        
Elapsed time: 0.75085s