A Modern Simulation Wrapper for Google DeepMind's MuJoCo
Project description
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
pip install mujoco-toolbox
GitHub Package
pip install git+https://github.com/MGross21/mujoco-toolbox.git@main
Adding to Project Dependencies
Click to Expand
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
Extra Packages
FFMPEG
Required for mediapy dependency
Windows
winget install ffmpeg
ffmpeg -version
Linux
Debian/Ubuntu
sudo apt update && sudo apt install ffmpeg
ffmpeg -version
Arch Linux
sudo pacman -Syu ffmpeg
ffmpeg -version
MacOS
Using Homebrew
brew install ffmpeg
ffmpeg -version
Using MacPorts
sudo port install ffmpeg
ffmpeg -version
Example Script
Bare minimum to run MuJoCo simulation and display result
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:
sincossteprandomreal_time(recommended controller for digital twins)
You can import them as follows:
import mujoco_toolbox.controllers as ctrl
Custom
def foo(model: MjModel, data: MjData,**kwargs):
# Perform logic based on model/data objects
# ie. PID Controller
Instantiating a Digital Twin
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
File Support
XML / MJCF (Native)
import mujoco_toolbox as mjtb
mjtb.Simulation("path/to/xml").show()
URDF
import mujoco_toolbox as mjtb
mjtb.Simulation("path/to/urdf", meshdir="path/to/mesh/files").show() # supports *.stl or *.obj
Merging Capabilities
Supports full <mujoco>...</mujoco> and <robot>...</robot> structure as well as complete sub-tree structures.
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 aFatalError.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mujoco_toolbox-0.6.3.tar.gz.
File metadata
- Download URL: mujoco_toolbox-0.6.3.tar.gz
- Upload date:
- Size: 23.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.1.4 CPython/3.13.5 Linux/6.16.0-arch2-1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
997cd0a0bab83f5ce1023bcf7784012657344b4131bb7a3324bfe2259a805f6e
|
|
| MD5 |
6d7ca0f3d084a894adb6af4215bb3f80
|
|
| BLAKE2b-256 |
a5a89885669c47868adaa78589975b78551b238903a801ab39b40bd2975fef36
|
File details
Details for the file mujoco_toolbox-0.6.3-py3-none-any.whl.
File metadata
- Download URL: mujoco_toolbox-0.6.3-py3-none-any.whl
- Upload date:
- Size: 23.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.1.4 CPython/3.13.5 Linux/6.16.0-arch2-1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cec0e0c085e92c4d1b63c9b4c5fd625b49d35bb964a6501b85644eae5383384c
|
|
| MD5 |
78f103883960329bcd76080991004321
|
|
| BLAKE2b-256 |
192678a7138a2167e9ac0d4ae1274870a0a98190b5e2d36e0d0367a88a180bac
|