Skip to main content

myoassist.terrains

Modular procedural terrain generator for MuJoCo, designed to be used by MyoAssist and other musculoskeletal-simulation projects within MyoSuite.

myoassist_terrains turns a small JSON description of a grid layout into a ready-to-include MuJoCo MJCF fragment containing tiles, connectors, materials and (optionally) heightfield assets. It supports explicit per-cell placement, weighted-random sampling per cell, parametric variation of every tile type, and a single shared texture for uniform-palette terrains.

┌──────────────────────────────────────────────────────────────────┐
│  JSON config  ──►  build_terrain()  ──►  MjSpec  ──►  XML include│
│                       (Python API)          (compose)    (CLI)   │
└──────────────────────────────────────────────────────────────────┘

Getting started

Installation

The package is published as a normal Python package and is utilized via pip install -e . (editable) or pip install . for a frozen build.

git clone https://github.com/neumovelab/myoassist.terrains.git
cd myoassist.terrains
pip install -e .

# Optional extras
pip install -e ".[render]"   # adds mediapy for ensemble renders
pip install -e ".[dev]"      # adds pytest for unit tests

Requires Python >=3.10 and mujoco>=3.3.3.

Quick start

Author a config:

{
  "terrain_name": "first_terrain",
  "grid":   { "rows": 2, "cols": 2, "tile_size": [10.0, 10.0] },
  "border": { "width": 0.5, "match_mode": "min" },
  "palette_preset": "diverse",
  "tiles": [
    { "row": 0, "col": 0, "type": "flat",   "params": { "height": 0.0 } },
    { "row": 0, "col": 1, "type": "stairs", "params": { "n_steps": 6, "step_height": 0.18 } },
    { "row": 1, "col": 0, "type": "slope",  "params": { "angle_deg": 18.0 } },
    { "row": 1, "col": 1, "type": "rough",  "params": { "seed": 42, "vertical_relief": 0.8 } }
  ]
}

Build it from a project that contains a terrain_config.xml pointer:

cd my_user_project        # contains terrain_config.xml + terrain_style.xml
myoassist-terrains build path/to/first_terrain.json --activate

The CLI writes terrain/first_terrain.xml into the project directory and (with --activate) updates the <include file="terrain/first_terrain.xml"/> line in terrain_config.xml. Any user model that includes terrain_config.xml now sees the new terrain.

Preview it without a user model:

myoassist-terrains preview first_terrain
python -m mujoco.viewer --mjcf=terrain/first_terrain_preview.xml

Contents

Detailed documentation lives under docs/:


License

Apache 2.0. See LICENSE.

Metadata

Release files for myoassist-terrains 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for myoassist-terrains 0.1.0
File Size Uploaded
myoassist_terrains-0.1.0.tar.gz 60.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for myoassist-terrains 0.1.0
File Interpreter ABI Platform
myoassist_terrains-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 125.5 kB

Release files / myoassist_terrains-0.1.0.tar.gz

Download URL myoassist_terrains-0.1.0.tar.gz
Size 60.5 kB
Tags Source
SHA-256 checksum
How to use checksums
ac8bed3dbbb2180361f78733cfb40529889863b3ec9c70af6a8cc88856925cd9
BLAKE2b-256 checksum
How to use checksums
7de71fb3f7f7098f59b308bd3bdafa68ca6ccffaaa152021d8a3228484ab5e27
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 11, 2026.

Transparency log

Release files / myoassist_terrains-0.1.0-py3-none-any.whl

Download URL myoassist_terrains-0.1.0-py3-none-any.whl
Size 65.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e03c9b1b1067442d74b033d7e5ace5531f4825defddfe38ea1c795f5190de749
BLAKE2b-256 checksum
How to use checksums
64fa4fa53bea8f5acb61f943eb5a95cc13a00fde1b430d10116711c0633f7dfa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 11, 2026.

Transparency log

Release history Release notifications | RSS feed

1.0.0

2 release files

0.2.0

2 release files

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page