myosuite.core.muscle_conditions

Muscle condition helpers: cumulative fatigue, sarcopenia, reafferentation.

These are pure transform functions that modify MuJoCo MjSpec or MjModel to represent physiological muscle conditions. They are used by ModelBuilder as transform callbacks and by term functions via EnvAccessor.

The 3CC-r fatigue model lives in myo_sim.physics.fatigue; its names are re-exported here so existing imports keep working.

Functions

apply_sarcopenia_to_spec(spec[, force_scale])

Scale muscle peak forces to simulate sarcopenia (age-related muscle loss).

apply_sarcopenia_to_model(model[, force_scale])

Scale muscle peak forces on a compiled MjModel in-place.

Module Contents

myosuite.core.muscle_conditions.apply_sarcopenia_to_spec(spec, force_scale=0.5)

Scale muscle peak forces to simulate sarcopenia (age-related muscle loss).

Spec-level equivalent of apply_sarcopenia_to_model(): scales the compiled peak force gainprm[2] of every actuator. Muscles declared with force="-1" keep gainprm[2] = -1 after compilation and get their peak force scale / acc0 from the compiled model, so the spec is compiled once to resolve the peak forces, which are then written back explicitly (scaled).

Parameters:
  • spec (mujoco.MjSpec) – MuJoCo model spec to modify in-place.

  • force_scale (float) – Fraction of original peak force to retain (0–1).

Returns:

The modified spec (same object, modified in-place).

Return type:

mujoco.MjSpec

Example

>>> import mujoco
>>> spec = mujoco.MjSpec.from_file("elbow.xml")
>>> apply_sarcopenia_to_spec(spec, force_scale=0.5)
myosuite.core.muscle_conditions.apply_sarcopenia_to_model(model, force_scale=0.5)

Scale muscle peak forces on a compiled MjModel in-place.

Multiplies actuator_gainprm[:, 2] (the maximum isometric force Fmax) by force_scale for every actuator, as the original BaseV0.initializeConditions does. Muscles declared with force="-1" are first resolved to their peak force scale / acc0.

Parameters:
  • model (mujoco.MjModel) – Compiled MuJoCo model to modify.

  • force_scale (float) – Fraction of original peak force to retain (0–1).

Return type:

None