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 into a ready-to-include MuJoCo
MJCF fragment. Two kinds of terrain are supported:
- a uniform surface: one plane or one heightfield (
flat,slope,random,sinusoidal), suited to steady-state locomotion; - a grid: a tiled course built from nine tile types, with explicit per-cell placement, weighted-random sampling, parametric variation of every tile, and a shared texture for uniform-palette renders.
It also answers where the ground is. surface_height_at(config, x, y) reports the
walkable surface height from the config alone, so a consumer placing something on
the terrain does not have to collision-probe a compiled model for it.
┌──────────────────────────────────────────────────────────────────┐
│ JSON config ──► build_terrain() ──► MjSpec ──► XML include│
│ (Python API) (compose) (CLI) │
└──────────────────────────────────────────────────────────────────┘
Getting started
Installation
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 and ruff
Requires Python >=3.10 and mujoco>=3.3.3.
Quick start
The shortest config is a uniform terrain:
{ "terrain": "slope", "terrain_name": "gentle_climb", "deg": 8.0 }
A tiled course names its cells:
{
"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 and, with --activate,
updates the <include file="terrain/first_terrain.xml"/> line in
terrain_config.xml. Any model that includes terrain_config.xml then sees the new
terrain. Use --root <dir> to build into a project from elsewhere.
Preview it without a user model:
myoassist-terrains preview first_terrain
python -m mujoco.viewer --mjcf=terrain/first_terrain_preview.xml
Contents
Documentation here is the developer reference. The narrative version, with figures, is on the MyoAssist site.
- Concepts: grid, tiles, connectors, the boundary contract, palette, texture, randomization, surface queries.
- Tile catalog: all nine tile types with parameter tables, generated from the registry.
- Configuration schema: both config forms in full.
- CLI reference: the
myoassist-terrainscommands. - Python API: the stable public surface.
- Velocity maps: sampling and rendering 3D target-velocity fields over a terrain.
- Project layout for users: expected project structure and include chaining.
- Utilities and example configs: bundled configs, style templates, render tooling.
- Extending: adding a custom tile type.
- Development: running the suite, and what it covers.
Changes, including the ones that alter emitted geometry, are recorded in CHANGELOG.md.
License
Apache 2.0. See LICENSE.
Metadata
Release files for myoassist-terrains 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| myoassist_terrains-0.2.0.tar.gz | 90.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| myoassist_terrains-0.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 174.0 kB
Release files / myoassist_terrains-0.2.0.tar.gz
| Download URL | myoassist_terrains-0.2.0.tar.gz |
|---|---|
| Size | 90.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f23f86c210881b2b9b76c080062e0a5a2ffdf49d3e19f20100c8b14afab02dd0
|
|
BLAKE2b-256 checksum How to use checksums |
527fbb578e1d5505e88393d1796a284c54e0cf8f8d28c862fbd178b47aacd642
|
| 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 19, 2026.
Transparency logRelease files / myoassist_terrains-0.2.0-py3-none-any.whl
| Download URL | myoassist_terrains-0.2.0-py3-none-any.whl |
|---|---|
| Size | 83.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9be986577a473df95fc69e629aea550aad132b070915909ea2ce54262eb4d3b6
|
|
BLAKE2b-256 checksum How to use checksums |
8e7f88a1254a7f1969effc454b976aa86b36babd8bf3350ee70e665d4fbb2f6c
|
| 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 19, 2026.
Transparency log