utils.UtilsOpensim

Module Contents

Functions

getJointsControlledByMuscle(osimModel, OSMuscle)

remove the locked coordinates and dependency coordinates of the spanned joints

getCouplingJoints(osimModel, osim_muscle_model, joints)

Check if coordinates are coupling when calculating moment arms

getJointRanges_dict(osimModel, joints)

Extract motion range of given joint coordinates from Osim model

getJointRanges_array(osimModel, joints)

Extract motion range of given joint coordinates from Osim model

getAllJointsRanges(osimModel)

Extract motion range of all joint coordinates of the Osim model

getJointsSpannedByMuscle(osimModel, OSMuscleName)

Given as INPUT a muscle OSMuscleName from an OpenSim model, this function

getIndipCoordAndJoint(osimModel, constraint_coord_name)

Function that given a dependent coordinate finds the independent

getModelJointDefinitions(osimModel)

functon to retun a strcuture for a specifc model, returning a list of the

getChildBodyJoint(jointStructure, bodyName)

getParentBodyJoint(jointStructure, bodyName)

getMuscleCoordinates(model, state, muscleName)

getWrappingSide(osimModel, OSMuscleName, currentState)

Calculate the position of the wrapping side

getAllIndependentCoordinates(osimModel)

Get all indpendent coordinates in an Osim model

extractMarkerSet(osimModel_path)

Extract marker list from Osim model for forward kinematic check

calculateEndPoints_osim(osimModel_path, endPoints, ...)

Calculate the positions of endpoints when iterating all joint angle meshes.

updOsimCoordEndPoints(osimModel, DOF_Index, jointEval, ...)

getMomentArmAtJoints(muscleModel, state, joint_set)

Compute moment arm of a muscle at a joint that it wraps.

computeMomentArm(osimModel, osim_muscle_model, joints, ...)

updOsimCoordMomentArm(osimModel, osim_muscle_model, ...)

getMuscleLengthList(osimModel, osim_muscle, joints, ...)

getMuscleForceMaps(osimModel, osim_muscle, joints, ...)

getMuscleProperties(osim_muscle)

utils.UtilsOpensim.getJointsControlledByMuscle(osimModel, OSMuscle)[source]

remove the locked coordinates and dependency coordinates of the spanned joints

utils.UtilsOpensim.getCouplingJoints(osimModel, osim_muscle_model, joints)[source]

Check if coordinates are coupling when calculating moment arms

utils.UtilsOpensim.getJointRanges_dict(osimModel, joints)[source]

Extract motion range of given joint coordinates from Osim model

utils.UtilsOpensim.getJointRanges_array(osimModel, joints)[source]

Extract motion range of given joint coordinates from Osim model

utils.UtilsOpensim.getAllJointsRanges(osimModel)[source]

Extract motion range of all joint coordinates of the Osim model

utils.UtilsOpensim.getJointsSpannedByMuscle(osimModel, OSMuscleName)[source]

Given as INPUT a muscle OSMuscleName from an OpenSim model, this function returns the OUTPUT structure jointNameSet containing the OpenSim jointNames crossed by the OSMuscle.

It works through the following steps: 1) extracts the GeometryPath 2) loops through the sinccgle points, determining the body they belong to 3) stores the bodies to which the muscle points are attached to 4) determines the nr of joints based on body indexes 5) stores the crossed OpenSim joints in the output structure named jointNameSet

NB this function return the crossed joints independently on the constraints applied to the coordinates. Eg patello-femoral is considered as a joint, although in Arnold’s model it does not have independent coordinates, but it is moved in dependency of the knee flexion angle.

utils.UtilsOpensim.getIndipCoordAndJoint(osimModel, constraint_coord_name)[source]

Function that given a dependent coordinate finds the independent coordinate and the associated joint. The function assumes that the constraint is a CoordinateCoupleConstraint as used by Arnold, Delp and LLLM. The function can be useful to manage the patellar joint for instance.

utils.UtilsOpensim.getModelJointDefinitions(osimModel)[source]

functon to retun a strcuture for a specifc model, returning a list of the joints present in the model and their associated frames

utils.UtilsOpensim.getChildBodyJoint(jointStructure, bodyName)[source]
utils.UtilsOpensim.getParentBodyJoint(jointStructure, bodyName)[source]
utils.UtilsOpensim.getMuscleCoordinates(model, state, muscleName)[source]
utils.UtilsOpensim.getWrappingSide(osimModel, OSMuscleName, currentState)[source]

Calculate the position of the wrapping side

Parameters:

osimModel: Opensim model OSMuscleName (str): muscle name currentState : State of the Opensim model

returns:

wrapMuscleDic: Dictionary with the wrapping center, dimension, type and position of the side

utils.UtilsOpensim.getAllIndependentCoordinates(osimModel)[source]

Get all indpendent coordinates in an Osim model

utils.UtilsOpensim.extractMarkerSet(osimModel_path)[source]

Extract marker list from Osim model for forward kinematic check

utils.UtilsOpensim.calculateEndPoints_osim(osimModel_path, endPoints, N_EvalPoints)[source]

Calculate the positions of endpoints when iterating all joint angle meshes. This is to check the Geometry and Joint Definition matches between the Opensim and the converted MuJoCo models. Parameters ———- osimModel_path : string

Path and name of the Osim model that will be evaluated.

endPointslist of string

The names of the endpoints whose positions will be evaluated.

Returns

evaData: dict

The evaluation data, including the joint angle meshes and the corresponding endpoint locations

utils.UtilsOpensim.updOsimCoordEndPoints(osimModel, DOF_Index, jointEval, endPoints)[source]
utils.UtilsOpensim.getMomentArmAtJoints(muscleModel, state, joint_set)[source]

Compute moment arm of a muscle at a joint that it wraps.

utils.UtilsOpensim.computeMomentArm(osimModel, osim_muscle_model, joints, ang_ranges, N_EvalPoints)[source]
utils.UtilsOpensim.updOsimCoordMomentArm(osimModel, osim_muscle_model, joints_idx, DOF_index, jointEval)[source]
utils.UtilsOpensim.getMuscleLengthList(osimModel, osim_muscle, joints, ang_ranges, speedy)[source]
utils.UtilsOpensim.getMuscleForceMaps(osimModel, osim_muscle, joints, jit_list_set, act_list)[source]
utils.UtilsOpensim.getMuscleProperties(osim_muscle)[source]