myoconverter.xml.forces.utils

This module contains a collection of utility functions useful for parsing and converting the OpenSim ForceSet

Muscle conversion analysis by Florian Fischer and Miroslav Bachinski.

@author: Aleksi Ikkala

Module Contents

Functions

mujoco_LO_loss(length_range, range, ...)

Computes squared Euclidean distance between MuJoCo and OpenSim model,

estimate_fiber_length(length_range, range)

Code by Florian Fischer

estimate_tendon_slack_length(length_range, range)

Code by Florian Fischer

calculate_length_range(range, optimal_fiber_length, ...)

Length range computations by Florian Fischer

myoconverter.xml.forces.utils.mujoco_LO_loss(length_range, range, optimal_fiber_length, tendon_slack_length, pennation_angle)[source]

Computes squared Euclidean distance between MuJoCo and OpenSim model, regarding both optimal fiber length and constant tendon length/tendon slack length.

Original code for this function was provided by Florian Fischer (2022).

Parameters:
  • length_range – array of MuJoCo tendon length (=complete actuator length) ranges

  • range – Operating length of muscle

  • optimal_fiber_length – OpenSim optimal fiber length

  • tendon_slack_length – OpenSim tendon slack length (or any reasonable constant tendon lengths)

  • pennation_angle – OpenSim pennation angle at optimum (i.e., angle between tendon and fibers at optimal fiber length expressed in radians)

  • use_optPennationAngle – Boolean; if this set to True, MuJoCo optimal fiber lengths LO should match OpenSim optimal fiber lengths LO_osim * cos(OpenSim pennation angle at optimum); otherwise, LO should match LO_osim

Returns:

squared (unweighted) Euclidean distance of optimal fiber length and constant tendon lengths between MuJoCo and OpenSim

myoconverter.xml.forces.utils.estimate_fiber_length(length_range, range)[source]

Code by Florian Fischer

myoconverter.xml.forces.utils.estimate_tendon_slack_length(length_range, range)[source]

Code by Florian Fischer

myoconverter.xml.forces.utils.calculate_length_range(range, optimal_fiber_length, tendon_slack_length, pennation_angle)[source]

Length range computations by Florian Fischer