Soft-Robot Deformation — DeformMLP Cantilever Surrogate
A tiny MLP surrogate that predicts cantilever beam deflection from
dimensionless features [x/L, Π, load_type] → w/L, where the training
targets are the closed-form Euler-Bernoulli solutions.
Synthetic-data honesty: this model was trained exclusively on targets computed from the analytical Euler-Bernoulli cantilever formulas (small-deflection beam theory). No experimental measurements and no FEM simulations were used. It validates a learning setup — dimensionless features, interpolation, and load extrapolation — as a stepping stone toward data-driven soft-robot deformation models, not a measurement pipeline.
Physics
Cantilever, $x$ measured from the fixed wall ($x=0$) to the free tip ($x=L$), downward deflection $w(x) > 0$, flexural rigidity $EI$:
- Tip point load $P$ at the free end: $w(x) = P,x^2,(3L - x) / (6EI)$
- Uniform load $q$ over the full span: $w(x) = q,x^2,(x^2 - 4Lx + 6L^2) / (24EI)$
Dimensionless: $\xi = x/L$, $\Pi = PL^2/EI$ (tip) or $qL^3/EI$ (uniform), target $w/L$.
Results
| Split | Model | R² | Mean curve rel. L² err | Mean tip-defl. rel. err |
|---|---|---|---|---|
| Interpolation (Π ≤ 0.40) | DeformMLP | 0.99999 | 6.56e-03 | 3.36e-03 |
| Interpolation | Linear regression | 0.68371 | 1.45e+00 | 9.72e-01 |
| Extrapolation (Π ∈ (0.40, 0.60]) | DeformMLP | 0.97085 | 6.07e-02 | 7.65e-02 |
| Extrapolation | Linear regression | 0.48352 | 4.80e-01 | 3.28e-01 |
The extrapolation test trains on loads Π ≤ 0.40 and tests on higher loads the model never saw (up to Π = 0.60): performance degrades honestly (R² 0.99999 → 0.97085), a genuine reminder not to trust neural surrogates blindly outside their training envelope. The linear baseline on the same three raw features cannot represent the Π·ξ²/Π·ξ³/Π·ξ⁴ structure at all.
Model: 3 → 128 → 128 → 1 ReLU MLP (17,153 params), Adam, 250 epochs, CPU.
Features/target standardised with training-set statistics (in config.json).
Usage
import numpy as np
from model import load_model, predict_deflection, analytical_deflection
model, stats = load_model("pytorch_model.bin") # CPU by default
xi = np.linspace(0, 1, 81)
# tip point load: P=120 N, L=1.0 m, EI=400 N m^2 -> Pi = P*L^2/EI = 0.3
w_pred = predict_deflection(model, xi, load_param=0.3, load_type="tip", stats=stats)
w_true = analytical_deflection(xi, 0.3, "tip")
print("tip rel. err:", abs(w_pred[-1]-w_true[-1])/w_true[-1])
Preprocessing contract (must match training): build features
[x/L, Π, load_type] with load_type 0 = tip / 1 = uniform, standardise
with the stats in config.json. The helper predict_deflection does this.
Training details
- Data: 73,800 synthetic samples from 1,800 beam configurations (L ∈ [0.5, 2.0] m, EI ∈ [20, 2000] N·m², P/q ∈ [5, 800] N or N/m), rejection-sampled to Π ∈ [0.01, 0.60]; 41 stations per curve.
- Splits by configuration (no leakage): train Π ≤ 0.40 / interp-test Π ≤ 0.40 / extrapolation-test Π ∈ (0.40, 0.60].
- Full reproducible pipeline (data generation, training, baselines, figures): see the project repository.
Limitations
- Synthetic ground truth (analytical solution itself) — validates the learning setup, not a measurement pipeline.
- Small-deflection Euler-Bernoulli theory only; soft robots routinely exceed it. Next step: large-deflection (elastica) or FEM targets.
- Reliable inside the training envelope Π ∈ [0.01, 0.40]; extrapolation to higher loads degrades (measured: R² 0.97085 at Π ≤ 0.60), and at Π < 0.01 the deflections are so tiny that the network's finite absolute precision becomes a large relative error. The Space demo flags both zones.
- Cantilever only; static loads; no dynamics, no contact, no material nonlinearity.
Built as a portfolio project for graduate applications in soft robotics / computational mechanics (mechanical engineering × AI).
- Downloads last month
- 26