Skip to main content

mujoco-truss-gen

mujoco-truss-gen is a Python package for generating MuJoCo models and Gymnasium-style environments for triangle-based isoperimetric truss robots.

Browse the rendered preset catalog, ranked by initial worst-case rigidity index.

The package is intended for members of the isoperimetric robot research workflow who need a shared, installable source of MuJoCo robot models instead of copying model-generation code between reinforcement learning, planning, simulation, and optimization projects.

Status

This repository is an internal lab prototype. It has a working installable package, built-in structure presets, a small public API, and tests that verify basic model generation and environment stepping. The API may still change before the package is treated as stable research infrastructure.

Supported workflows include:

  • Generate MuJoCo MjSpec models for triangle-based truss structures.
  • Use built-in "octahedron", "icosahedron", "solar_array", "tetrahedron", Usevitch et al. triangle-decomposable graph presets, and Henneberg routed continuous-tendon graph presets.
  • Build abstract slide-joint models or realistic triangle-body models.
  • Save generated MuJoCo XML.
  • Wrap generated models in Gymnasium-compatible environments.
  • Generate configurable flat, sloped, stair, wave, and rough height-field terrain.
  • Convert STL meshes into experimental routed-tube shape dictionaries.

Installation

After a release has been published to PyPI:

python -m pip install mujoco-truss-gen

The optional MJX-Warp backend requires an NVIDIA CUDA GPU and is installed separately so ordinary MuJoCo/MJX-JAX users do not pull in Warp:

python -m pip install "mujoco-truss-gen[warp]"

For local development from a clone:

git clone https://github.com/isaa-sudweeks/mujoco-truss-gen.git
cd mujoco-truss-gen
python3 -m venv .venv
source .venv/bin/activate
python -m pip install -e ".[dev]"

The package requires Python 3.10 or newer and installs these runtime dependencies:

  • gymnasium
  • mujoco
  • networkx
  • numpy
  • scipy

Install the optional interactive terrain figures with:

python -m pip install "mujoco-truss-gen[terrain]"

Quick Start

Generate the built-in octahedron model:

from mujoco_truss_gen import get_mujoco_spec

spec = get_mujoco_spec("octahedron", realistic=False)
model = spec.compile()

Generate the same robot on deterministic rough terrain:

from mujoco_truss_gen import TerrainConfig, get_mujoco_spec

spec = get_mujoco_spec(
    "octahedron",
    realistic=False,
    terrain=TerrainConfig(
        kind="rough",
        amplitude=0.15,
        feature_size=0.8,
        seed=7,
    ),
)

Save generated XML:

from mujoco_truss_gen import get_mujoco_spec, save_xml

spec = get_mujoco_spec("octahedron", realistic=False)
xml_path = save_xml(spec, "octahedron.xml")

Run one Gymnasium step:

import numpy as np

from mujoco_truss_gen import MujocoRelativeObsEnv, TrussEnvConfig, get_mujoco_spec

spec = get_mujoco_spec("octahedron", realistic=False)
env = MujocoRelativeObsEnv(
    TrussEnvConfig(
        model_source=spec,
        max_steps=1_000,
        nsubsteps=4,
        speed=0.01,
    )
)

obs, info = env.reset(seed=0)
action = np.zeros(env.action_space.shape, dtype=np.float32)
obs, reward, terminated, truncated, info = env.step(action)
env.close()

Open the built-in octahedron model from the command line:

python -m mujoco_truss_gen.generate_mujoco_model

On macOS, MuJoCo's passive viewer may require running viewer scripts with mjpython instead of the standard python executable.

Render a searchable catalog of every distinct registered preset, ranked by its initial worst-case rigidity index:

.venv/bin/mjpython tools/render_preset_catalog.py

The command writes the files deployed to the public preset catalog: preset_catalog/index.html, full-resolution PNGs, and a JSON manifest. It checkpoints after every preset, so rerunning the command resumes an interrupted first-time build. Use --realistic for realistic connector geometry, --overwrite to rebuild existing entries, or --include-aliases to include the unsuffixed Henneberg names that alias variant _1.

The same site includes an interactive terrain explorer that previews every height-field family and produces a copyable TerrainConfig.

Routed continuous-tube presets such as tetrahedron are all-edge-actuated models whose route tendons softly constrain each tube to its initial total length. They also support realistic=True, which clones shared routed node occurrences and connects them through in-plane bisector rods. Use MujocoNodeVelocityCommandEnv for node-level scalar velocity commands that are mapped through the route incidence matrix to edge actuator commands. For manual testing, view_node_velocity_terminal(spec) opens the MuJoCo viewer and accepts terminal commands such as set node_2 0.01, show, zero, and quit. Henneberg routed graph presets such as henneberg_n8_2tube_1 are generated from H1/H2 minimally rigid graph candidates, decomposed into continuous routed tendons, and accepted only after a deterministic 3D embedding passes an infinitesimal-rigidity check. The unsuffixed names, such as henneberg_n8_2tube, are aliases for variant _1.

Documentation

  • Model generation: custom trusses, routed shape dictionaries, model modes, and generation helper contracts.
  • Environments: environment constructors, actions, observations, rewards, rendering, and TrussEnvConfig.
  • STL import: optional STL-to-routed-tube conversion and preview behavior.
  • GNN utilities: extracting graph features and edge indices for PyTorch Geometric workflows.
  • Height-field terrain: terrain families, physical parameters, safe spawning, native/MJX behavior, and interactive figures.
  • Development: local setup, tests, linting, formatting, and package builds.
  • MJX-Warp benchmark: compatibility gates, reproducible ORC benchmark commands, and the pending adoption decision.
  • Releasing: automated and manual PyPI release steps.
  • Roadmap: known limitations and planned work.

Example

Start from the included custom-truss example:

python examples/custom_truss.py

Citation

There is no formal citation for this package yet.

The Usevitch graph presets are based on:

Nathan Usevitch, Isaac Weaver, and James Usevitch. "Triangle-Decomposable Graphs for Isoperimetric Robots." arXiv:2505.01624, 2025. https://arxiv.org/abs/2505.01624

License

This project is distributed under the BSD-3-Clause license. See LICENSE for the full license text.

Metadata

Release files for mujoco-truss-gen 0.12.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 mujoco-truss-gen 0.12.0
File Size Uploaded
mujoco_truss_gen-0.12.0.tar.gz 128.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for mujoco-truss-gen 0.12.0
File Interpreter ABI Platform
mujoco_truss_gen-0.12.0-py3-none-any.whl Python 3 none any Details

Total release size: 232.3 kB

Release files / mujoco_truss_gen-0.12.0.tar.gz

Download URL mujoco_truss_gen-0.12.0.tar.gz
Size 128.9 kB
Tags Source
SHA-256 checksum
How to use checksums
830a734887c58836d103a8d3f20df284cccfc74aa5120cd7a92608b3be95330f
BLAKE2b-256 checksum
How to use checksums
33281d7d38eb64037df75baf2ad1b0cd8b4dfebc38b798c62547e8e17ebdd6c0
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 5, 2026.

Transparency log

Release files / mujoco_truss_gen-0.12.0-py3-none-any.whl

Download URL mujoco_truss_gen-0.12.0-py3-none-any.whl
Size 103.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8410f631cf7fecf74095323a8560d2cf0a4ab906dbcfb3131618ce809fec3356
BLAKE2b-256 checksum
How to use checksums
14e0d20b179b6f7a9298bdb8289697ab6ddcac39cf5fbfce100000b8318d91ba
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 5, 2026.

Transparency log
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