model_states.MjcMuscleStates

Created on Sun Feb 20 21:43:21 2022

@author: hwang

Module Contents

Classes

MjcMuscleStates

A class to extract the muscle states (moment arms and force properites)

class model_states.MjcMuscleStates.MjcMuscleStates(mjc_model, wrapping_coordinate, muscle_list=None)[source]

A class to extract the muscle states (moment arms and force properites) of the given Mujoco model

reset()[source]
getWrapingCoords()[source]

This information will directly take the result from Osim model, from given input.

In mjc models, muscles are treated as one type of actuators (type 3), there are several other type of actuators. Here we only look at the muscle actuators.

For a given muscle list, outputs of this function is a dictionary:

Keywords || list of coordinates muscle 1: coordinate 1, coordinate 2

coordinate 3,

muscle 2: coordinate 1

coordinate 3, coordinate 4 coordinate 5, coordinate 6,

getCoordRanges()[source]

Extract the motion ranges of given coordinates in an mjc model.

Outputs of this function is a dictionary with the coordinate names as keywords

Keywords || list

coordinate 1: [lower bound, upper bound] coordinate 2: [lower bound, upper bound] coordinate 3: [lower bound, upper bound] …

getMomentArms(wrapping_coordinate=None, coordinate_range=None, evalN=7)[source]

calcualte moment arms of a muscle at different coordinates it wrapped.

Parameters

wrapping_coordinatedictionary

DESCRIPTION: the dictionary that contains the muscles list and their wrapping coordinates. If not provide, will calculate from the above getWrapingCoord function.

coordinate_range: dictionary

DESCRIPTION: the dictionary that contains the motion ranges of the joint lists that been wrapped by the muscles. if not provided, generate from the above getWrapingCoord function.

evalN: integer DESCRIPTION: Number of nodes to evalute in between the coordinate range, default value 7.

Returns

self.moment_arms: dictionary

DESCRIPTION: the dictionary that contains the moment arms that were calculated from the opensim model with the given inputs

getMuscleForceMaps(osim_force_maps, wrapping_coordinate=None, coordinate_range=None, evalN=11)[source]

get the muscle force maps from MuJoCo models. Strongly suggest to run this step after optimizing the moment arms. This force length maps are using the same joint angle vectors that been used in OpenSim model when force maps were extracted. If there are large moment arm differences, the muscle lengths will be very different, then comparison between the OpenSim and MuJoCo muscle force maps are not vaildate any more.

Parameters

osim_force_maps: dictionary

DESCRIPTION: the force maps exracted from OpenSim model.

wrapping_coordinatedictionary

DESCRIPTION: the dictionary that contains the muscles list and their wrapping coordinates. If not provide, will calculate from the above getWrapingCoord function.

coordinate_range: dictionary

DESCRIPTION: the dictionary that contains the motion ranges of the joint lists that been wrapped by the muscles. if not provided, generate from the above getWrapingCoord function.

evalN: integer DESCRIPTION: Number of nodes to evalute in between the coordinate range, default value 11.

Returns

self.force_maps: dictionary

DESCRIPTION: the dictionary that contains the muscle force maps that were calculated from the opensim model with the given inputs