Skip to main content

A Modern Simulation Wrapper for Google DeepMind's MuJoCo

Project description


Build Python License PyPI Docs

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

pip install mujoco-toolbox

GitHub Package

GitHub release

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:

  • sin
  • cos
  • step
  • random
  • real_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()
UR5/Vention

URDF

import mujoco_toolbox as mjtb

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

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 a FatalError.

Humanoid in Box

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mujoco_toolbox-0.6.3.tar.gz (23.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mujoco_toolbox-0.6.3-py3-none-any.whl (23.8 kB view details)

Uploaded Python 3

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

Hashes for mujoco_toolbox-0.6.3.tar.gz
Algorithm Hash digest
SHA256 997cd0a0bab83f5ce1023bcf7784012657344b4131bb7a3324bfe2259a805f6e
MD5 6d7ca0f3d084a894adb6af4215bb3f80
BLAKE2b-256 a5a89885669c47868adaa78589975b78551b238903a801ab39b40bd2975fef36

See more details on using hashes here.

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

Hashes for mujoco_toolbox-0.6.3-py3-none-any.whl
Algorithm Hash digest
SHA256 cec0e0c085e92c4d1b63c9b4c5fd625b49d35bb964a6501b85644eae5383384c
MD5 78f103883960329bcd76080991004321
BLAKE2b-256 192678a7138a2167e9ac0d4ae1274870a0a98190b5e2d36e0d0367a88a180bac

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page