CortenForge

Open source · Apache-2.0

A software development kit for the mechatronics and simulation space.

Composable Rust components for geometry, parametric design, meshing and fabrication, rigid- and soft-body physics, control, and reinforcement learning.

What it is

CortenForge provides the building blocks spanning the path physical → digital → physical: get a real object into a simulation, design something against it, optimize that design through the physics, and gate the result for manufacture.

The kit is the product.

Most tools cover one leg of that path and hand off through file exchange. CortenForge’s components share one geometric kernel instead: an Sdf trait implemented across design, meshing, and the soft-body engine, with the rigid engine consuming the same kernel’s sampled grids. A design therefore reaches a simulation in memory, with no export step in between — the design-to-sim example is that path, start to finish, in a single source file.

The soft-body FEM and the soft↔rigid contact coupling are differentiable, running a single reverse-mode tape across both engines. The rigid engine supplies analytic and finite-difference derivatives. MISSION.md sets out where that leads.

What it’s for

Robotics, control & RL

Import an existing MJCF or URDF model, take analytic or finite-difference derivatives through the dynamics, or train a policy against batched environments.

Soft robotics

Simulate compliant bodies with hyperelastic FEM under rigid contact, and generate multi-material molds from the same implicit geometry.

Biomechanics

Convert a gait2392 leg chain from OpenSim, simulate soft tissue with contact, and fit rigid-body parameters to measured trajectories — separate components today, not one pipeline.

Scan → design → fabrication

Repair a scan into a watertight body, convert it to an SDF, build implicit geometry against it, and check that the result is printable. Cendrillon walks this path, from a raw scan to printable molds.

Embodied-AI research

Reach batched environments, differentiable physics, and the learning stack through one dependency, alongside a corpus of worked examples.

Get started

Applications depend on a single crate — the cortenforge facade — and reach the headless core of the SDK through it, so the internal crate structure can evolve behind one import surface.

[dependencies]
cortenforge = { git = "https://github.com/via-balaena/CortenForge" }

Depend on the repository, not crates.io — the published listings lag this workspace by months, so cargo add will silently give you a stale version.

// Two umbrellas plus the design and fabrication crates, all through one dependency:
use cortenforge::sim;          // rigid + soft physics, soft↔rigid coupling, RL/opt
use cortenforge::mesh;         // load / repair / measure / print meshes
use cortenforge::cf_design;    // implicit-surface design kernel
use cortenforge::cf_cast;      // multi-material mold generation

Simulation lives under sim, mesh work under mesh, and the design and fabrication crates are re-exported individually. The facade is headless by construction, so anything built against it runs without a window or a graphics driver — on a build server, or inside a training loop. Left out: the Bevy, GUI, and GPU crates, and most of the research and application code under tools/, of which it re-exports only the headless scan-prep and mold-CLI crates. Everything excluded is still in the repository; you can depend on it directly.

To work on the SDK itself rather than depend on it:

git clone https://github.com/via-balaena/CortenForge.git
cd CortenForge
cargo build -p cortenforge          # the facade; --workspace builds all 300 members
cargo xtask grade <crate-name>      # run the quality gate on a single crate

The stack

Rigid-body physics

sim-core · sim-mjcf · sim-urdf

MuJoCo-aligned dynamics, 79/79 on our MuJoCo 3.4.0 conformance suite. MJCF and URDF import, analytic and finite-difference derivatives.

Soft-body physics

sim-soft

Hyperelastic FEM (Neo-Hookean / Yeoh), SDF→tet meshing, contact, differentiable.

ML, RL & optimization

sim-ml-chassis · sim-rl · sim-opt

VecEnv, autograd, CEM, REINFORCE, PPO, TD3, SAC, simulated annealing, parallel tempering.

Thermodynamic environments

sim-therm-env · sim-thermostat

Langevin thermostats, double wells, pairwise coupling, pluggable rewards.

Design

cf-design · cf-geometry · cf-spatial

SDF primitives, smooth booleans, mechanism assembly, MJCF and STL export.

Mesh

mesh-io · mesh-repair · mesh-sdf · +8 more

STL / OBJ / PLY / 3MF I/O, repair, offset, shell, lattice, print validation.

Scan → fabrication

cf-scan-prep-core · cf-cast · mesh-printability

Scan cleanup, multi-material mold generation, printability gating, and generated fabrication procedures.

70 crates outside examples/. Pure Rust with no framework dependencies in the physics and mesh cores; the mold-CSG stage builds a vendored C++ kernel through CMake. The facade pulls it in by default, so a first build needs CMake and a C++ compiler; default-features = false, features = ["sim", "mesh"] skips it. Layer-0 core crates are checked against the wasm32-unknown-unknown target as part of the quality gate.

Depending on it

The API still moves. These are the terms.

Revisions

Install from git and pin a rev for reproducible builds. Breaking changes land when they improve the architecture.

Rust toolchain

Pinned to 1.96.0 for reproducible builds and lints, in CI and locally alike. Toolchain bumps are deliberate, paired with a workspace-wide lint sweep.

Tags

Git tags version Cendrillon, not the SDK — v0.3.2 is a Cendrillon release. Track main for the SDK.

Platforms

Sharded tests run on Linux, with a cross-OS job covering four platform-sensitive crates on macOS and Windows.

Where to start

Read a worked example to see the components composed, or open an issue on GitHub — questions and bug reports are both welcome there.

Elsewhere