You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 7cb3248
Browse filesBrowse the repository at this point in the historyBrowse files
Allow separate stretching and bending yield strains for flex plasticity.
The flex `<elasticity yield="...">` attribute (and the same on
`<flexcomp><elasticity>`) now takes one or two values, `yield="eps_stretch
eps_bend"`. For non-interpolated 2D flexes a single value applies to both. For
3D and interpolated flexes a single value is only the stretching yield strain.
Either way, existing models compile and simulate as before.
API:
- `mjsFlex::stressyield` is now `double[2]` (stretch, bend), and
`mjModel::flex_yield` is `nflex x 2`. Both are unreleased.
- New `mjModel::flex_plasticmode` (`nflex x 1`) records which modes have
plastic state: bit 1 is bending, bit 2 is stretching (same encoding as
`elastic2d`).
- Whether a mode is plastic is decided at compile time, as for joints and
tendons. A mode gets plastic state, and its bit set, only if its yield
strain is positive. Stretching state comes first, then bending state.
For example, `yield="0.01 0"` keeps bending purely elastic, and its yield
strain is never read at runtime.
- Setting the yield strain of a plastic mode to 0 at runtime still means
full plastic flow, as before.
- A positive bending yield strain on a 3D or interpolated flex is a compile
error ("bending yield requires a non-interpolated 2d flex"). 1D flexes
still reject any positive value.
Why a new field: whether bending state exists could already be inferred (the
2D shell thickness is stored in `stiffness[6]` only when bending yields).
Nothing in the model indicated whether stretching state exists. A per-flex
bitmask was the smallest addition that makes both blocks and their offsets
explicit. It also replaces the per-mode layout formulas that were duplicated
in `mj_resetPlastic`, model validation, and `mj_printModel`
(which would otherwise read past a flex's state).
XML:
- `yield` is `double[1..2]` with `reading=custom` in mjcf.schema.
- For `<flex>` the reader resolves a single value from `dim` and `node`. For
`<flexcomp>` it is resolved in `Make()`, once dim and dof are final (dim
can come from a mesh or gmsh file).
- The writer saves a single value when it reproduces the bending yield
strain, and two values otherwise.
Engine, C and MJWarp: the return mapping and the passive forces locate
stretching and bending state by `flex_plasticmode`, not by the yield value.
In MJWarp, `flex_yield` is `wp.vec2` and `flex_plasticmode` is threaded into
the plastic and flex passive kernels. MJX warp shims were regenerated.
Compiler: `mjCFlex::PlasticStretchNum()` gives the size of the stretching block
of a compiled or uncompiled flex. `PlasticNum()` and keyframe scaling in a
scaled frame (`ScaleKeyframe`) both use it, so a bend-only shell scales all of
its entries as bending entries.
Generated files regenerated: XML tables/xsd/dmcontrol schema, references.h,
introspect structs.py, wasm and Unity bindings, mjx/warp, and golden
flex_model.data (only `flex_yield` gains a column and `flex_plasticmode` is
added). dm_control's MjModel indexer gains the new field.
Tests:
- XML reader: 1 vs 2 values on 2D and 3D, on flexcomp and deformable flex;
single values on 3D and interpolated flexes resolve to stretching only.
Errors for 3 values, a negative bending yield strain, a bending yield
strain on 3D, interpolated, and 1D flexes.
- XML writer: round trip with 1 and 2 values, 2D and 3D.
- Engine:
- stretch-only and bend-only yielding are independent;
- a mode with a zero yield strain has no state and stays elastic even
if its yield strain is changed at runtime;
- a runtime yield strain of 0 on a plastic mode gives full plastic flow;
- absent modes allocate no state.
- Keyframe scaling: a bend-only shell in a scaled frame, followed by another
plastic flex or last.
- Model validation of `flex_plasticmode`.
- MJWarp: C-vs-MJWarp parity for separate yields, per-mode allocation, and
runtime-zero full flow.
PiperOrigin-RevId: 1013971100
Change-Id: I26055b2b73b4e673119f0f28cfe4e757a128a38c
0 commit comments