187 lines (142 with data), 5.9 kB
Main.ModelSetup.LabSpecificData = {
#path BODY_MODEL_CONFIG_FILE "BodyModelConfig.any"
#path MOCAP_MARKER_PROTOCOL_FILE "MarkerProtocol.any"
#path MOCAP_EXTRA_DRIVERS_FILE "ExtraDrivers.any"
// The switch MOCAP_C3D_DATA_PATH can be used to specify the directory
// where the C3D file is stored. Defaults to the main file directory.
#path MOCAP_FORCE_PLATE_FILE "ForcePlates.any"
#path MOCAP_C3DSETTINGS "C3DSettings.any"
// #path MOCAP_FORCE_PLATE_FILE "ForcePlates.any"
// Controls where the Human-Ground residuals (hand of god) are applied
// to the models. Choises are "Trunk" or "Pelvis".
#define MOCAP_HUMAN_GROUND_RESIDUALS "Pelvis"
#include "Outputs.any"
#ifpathexists "Outputs_extended.any"
#include "Outputs_extended.any"
#endif
// Better start-guess/posture for gait trials
Main.HumanModel.Mannequin.Posture = {
Right.ElbowFlexion = 30;
Left.ElbowFlexion = 30;
};
Main.Studies.ParameterIdentification.KinematicStudyForParameterIdentification= {
Kinematics.KinematicTol = 1e-6;
};
Main.ModelSetup.TrialSpecificData.ParameterOptimizationConvergenceTol = 1e-2;
// Disable the upper bound for muscle recruitment. This improves the stability of the model by
// preventing the solver from changing if the some muscles becomes over loaded.
Main.Studies.InverseDynamicStudy.InverseDynamics.Criterion.UpperBoundOnOff = Off;
Gravity = -9.81*{0,0,1};
#ifdef REFERENCE_TRIAL
// Set narrow kinematic limits when running parameter optimization
// improves robustness
Main.ModelSetup.MocapExtraDrivers.DefaultJointLimits =
{
LimitElbowFlexionRight.ROM = {3, 120};
LimitElbowFlexionLeft.ROM = {3, 120};
WristFlexionRight.ROM = {-70,20};
WristFlexionLeft.ROM = {-70,20};
WristAbductionRight.ROM = {-30, 30};
WristAbductionLeft.ROM = {-30, 30};
};
#endif
// This adds different segment length as design variables to
// to the parameter identification study (Main.Studies.ParameterIdentification)
// This allows the segment length to be optimized based on the markers/motion
#ifdef REFERENCE_TRIAL
OptimizeAnthropometricsOnOff OptimizeAntropometricsOnOff (
PELVIS_WIDTH = ON ,
HEAD_HEIGHT = OFF,
TRUNK_HEIGHT= ON,
TRUNK_WIDTH = ON,
TRUNK_DEPTH = OFF,
RIGHT_THIGH_LENGTH= ON,
LEFT_THIGH_LENGTH = ON,
RIGHT_SHANK_LENGTH= ON,
LEFT_SHANK_LENGTH = ON,
RIGHT_FOOT_LENGTH= ON,
LEFT_FOOT_LENGTH = ON,
RIGHT_UPPERARM_LENGTH= ON,
LEFT_UPPERARM_LENGTH = ON,
RIGHT_LOWERARM_LENGTH= ON,
LEFT_LOWERARM_LENGTH = ON,
RIGHT_HAND_LENGTH= OFF,
LEFT_HAND_LENGTH = OFF,
RIGHT_HAND_BREADTH= OFF,
LEFT_HAND_BREADTH = OFF,
RIGHT_TIBIAL_TORSION = ON,
LEFT_TIBIAL_TORSION = ON,
LEFT_RIGHT_SYMMETRY = ON
) ={};
Main.HumanModel.Anthropometrics.SegmentScaleFactors = {
// Some antropometrics are not optimized from markers but set
// to match the total BodyScale height parameter
Thorax.DepthScale = BodyScale;
Neck.LengthScale = Thorax.LengthScale;
Head.LengthScale = Thorax.LengthScale;
Head.DepthScale = Head.LengthScale;
Head.WidthScale = Head.LengthScale;
Right.Hand.LengthScale = BodyScale;
Left.Hand.LengthScale = BodyScale;
Right.Hand.WidthScale = BodyScale;
Left.Hand.WidthScale = BodyScale;
};
#else
OptimizeAnthropometricsOnOff OptimizeAntropometricsOnOff ={};
#endif
// Initial guess of arm segment length based on markers.
Main.HumanModel.Anthropometrics.SegmentDimensions = {
#ifdef _c3dmarker
#undef _c3dmarker
#endif
#define _c3dmarker(NAME) Main.ModelSetup.C3DFileData.Points.Markers.NAME.Pos[Main.ModelSetup.TrialSpecificData.AutoPos.start_idx]
Right.LowerArmLength = 0.91*vnorm(_c3dmarker(R_HLE)- _c3dmarker(R_RSP));
#ifndef EXCLUDE_R_SAA
Right.UpperArmLength = 0.83*vnorm(_c3dmarker(R_HLE)- _c3dmarker(R_SAA));
#else
Right.UpperArmLength = 0.83*vnorm(_c3dmarker(R_HLE)- _c3dmarker(R_SAE));
#endif
Left.LowerArmLength = 0.91*vnorm(_c3dmarker(L_HLE)- _c3dmarker(L_RSP));
#ifndef EXCLUDE_L_SAA
Left.UpperArmLength = 0.83*vnorm(_c3dmarker(L_HLE)- _c3dmarker(L_SAA));
#else
Left.UpperArmLength = 0.83*vnorm(_c3dmarker(L_HLE)- _c3dmarker(L_SAE));
#endif
};
#ifndef REFERENCE_TRIAL
#define MOCAP_CREATE_PARAMETER_ID_SHORTCUT OFF
#endif
#path C3D_FILE_PATH "<MOCAP_C3D_DATA_PATH>" + SUBJECT_ID + "/" + MOCAP_NAME_MAINFILEDIR + ".c3d"
#ifnpathexists C3D_FILE_PATH
AnyMessage Download_data =
{
Type = MSG_ErrorFatal;
TriggerPreProcess = On;
Message = strformat("\n\n"+
"------------------------------------------------------------------------------------------------------\n"+
" Download the Rehazenter-adult-walking-dataset... \n"+
"------------------------------------------------------------------------------------------------------\n"+
"The 'Rehazenter-adult-walking-dataset' must be downloaded manually. It is available under \n"+
"a Creative Commons license from fig-share: \n"+
"https://figshare.com/articles/dataset/A_multimodal_dataset_of_human_gait_at_different_walking_speeds/7734767/8 \n"+
" \n"+
"Download the data and extract the files into the 'c3dfiles/' subfolder. So the layout becomes\n"+
" C3DFiles\\ \n"+
" +---2014001\\ \n"+
" +---2014002\\ \n"+
" : \n"+
" +---2015043\\ \n" +
" \\---License \n" +
" \n "+
"Please cite Schreiber and Moissenet (2019) when using this data: \n"+
" \n"+
" Schreiber, C., Moissenet, F. A multimodal dataset of human gait at different walking speeds\n"+
" established on injury-free adult participants. Sci Data 6, 111 (2019).\n"+
" https://doi.org/10.1038/s41597-019-0124-4 \n"+
" \n");
};
#endif
Main.ModelSetup.Macros = {
#include "CreateVideo.any"
};
};