utils.UtilsMujoco
Module Contents
Functions
|
|
|
Calculate the positions of endpoints when iterating all joint angle meshes. |
|
|
|
find the self-locked joints and corresponding joint angles. |
|
find out the wrapping objects, siteside, and corresponding joints |
|
|
|
Calculate moment arm matries from given muscles and joints |
|
Applies values contained in vec_optimized to optimizing side of mujoco model |
|
Simplification Version |
|
Update mujoco muscle property parameters with optimization results. |
- utils.UtilsMujoco.calculateEndPoints_mjc(mjc_model_path, end_points, n_eval)[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_pathstring
Path and name of the Osim model that will be evaluated.
- endPointslist of string
The names of the the body whose positions will be evaluated.
Returns
- evaData: dict
The evaluation data, including the joint angle meshes and the corresponding endpoint locations
- utils.UtilsMujoco.lockedJointAng(mjc_model)[source]
find the self-locked joints and corresponding joint angles.
- utils.UtilsMujoco.sortMuscleWrapSiteJoint(mjc_model, muscle_para_osim)[source]
find out the wrapping objects, siteside, and corresponding joints that should be optimized for a given muscle
Parameters
- mjc_model: mujoco Model
A mujoco model.
- muscle_para_osim: dict
The muscle, wrapping_coordinates, coordinate_range information extracted from osim model.
Returns
- muscle_para_osim: dict data
add wrapping object, site side, information
- utils.UtilsMujoco.computeMomentArmMuscleJoints(mjc_model, muscle, joints, ang_ranges, evalN)[source]
Calculate moment arm matries from given muscles and joints
- utils.UtilsMujoco.updateWrapSites(mjc_model, wrap_type, wrap_id, pos_wrap, size_wrap, rot_wrap, side_ids, vec_optimized)[source]
Applies values contained in vec_optimized to optimizing side of mujoco model
- Parameters:
mjc_model (mujoco_py.cymj.PyMjModel): MuJoCo model wrap_type (numpy.list): 1D list of string, clarify the wrapping types side_ids (numpy.list): 1D list with the id of sides pos (numpy.list): a list of 3D arrays with the position of the wrapping objects size (numpy.list): a list of 3D arrays with the size of wrapping objects rotation (numpy.list): a list of 4D arrays with the rotation info of wrapping objects torus_flag (numpy.list): a list of strings, clarify whether is the origional wrapping torus vec_optimized (numpy.ndarray): 1D vector with the concatenated array of optimized par
- utils.UtilsMujoco.getMuscleForceLengthCurvesSim(mjc_model, muscle, joints, jnt_arr, act_arr)[source]
Simplification Version
Given as INPUT an OpenSim muscle OSModel, a muscle variable and a nr of evaluation points this function returns as musOutput a vector of the muscle variable of interest in the converted MuJoCo model obtained by sampling the ROM of the joint spanned by the muscle in N_EvalPoints evaluation points. For multidof joint the combinations of ROMs are considered. For multiarticular muscles the combination of ROM are considered. The script is totally general because based on generating strings of code correspondent to the encountered code. The strings are evaluated at the end.