Problem with using own gait data in MoCap_LowerBody.main

Hi,

I am new to AnyBody and have had a few issues when using my own c3d file in the MoCap_LowerBody.main file. The c3d file has 28 anatomical markers plus tracking markers at the thigh and shank. The lab has two force platforms with Z=vertical plane.

The model seems to load fine, however when running the motion and parameter optimization an error occurs:

#### Macro command : RunMotionAndParameterOptimizationSequence(3:5)> classoperation Main.Studies.ParameterIdentification "Save design" --file="../Input/LowerBody-AnybodyTest-OptimizedParameters.txt"
Main.Studies.ParameterIdentification :  Saving design...

#### Macro command : RunMotionAndParameterOptimizationSequence(4:5)> operation Main.Studies.MotionOptimization.Kinematics

#### Macro command : RunMotionAndParameterOptimizationSequence(5:5)> run
5.0) Kinematics (Operation: Main.Studies.MotionOptimization.Kinematics): 
5.0.0) PreOperation (Operation: Main.Studies.MotionOptimization.Kinematics.PreOperation): 
5.0.0.0) InitialConditions (Operation: Main.Studies.MotionOptimization.InitialConditions): 
5.0.0.0) ...Design variables have been updated.
5.0.0.1) ...Load-time positions have been re-established.
WARNING! NAN reached!
Unexpected error in computational kernel
ERROR(OBJ.MCH.KIN3) :   S:/M..p/R..]/P..6/A..y/R..y/A..o/A..n/M..n/M..l/Kinematics.any(74)  :   MotionOptimization.InitialConditions  :  Kinematic analysis failed in time step 0

I have attached the main model. I suspect that the error may relate to my adapted marker labels and possibly the ‘sRelOpt’?

Any advice would be greatly appreciated.

Thanks,
Robin

Hi Robin,

This error may indicate two things, either you have not enough markers on so a certain dof in the model is not driven either by a marrkers or something else. Secondly it may happen you you have to perefectly identical kinematic constraints in the model.

I took a quick look in the marker file and noticed that some markers intended for the left leg was actually being attached to the right leg.

See eg:


CreateMarkerDriver L1stMetProx (
MarkerName= L1stMetProx,  
MarkerPlacement=Right.Leg.Seg.Foot,

Please go though all markers and ensure there are no such errors, this error could lead to the problem you have encountered.

Best regards
Søren

Søren,

Thank you for the reply, I believe I have removed any errors from the marker protocol and the kinematics are now running fine. However, I am now having an issue with running the inverse dynamics. I have pasted the error below.

0) InverseDynamics (Operation: Main.Studies.MotionOptimization.InverseDynamics): 
0.0) PreOperation (Operation: Main.Studies.MotionOptimization.InverseDynamics.PreOperation): 
0.0.0) InitialConditions (Operation: Main.Studies.MotionOptimization.InitialConditions): 
0.0.0) ...Design variables have been updated.
0.0.1) ...Load-time positions have been re-established.
0.0.2) ...Kinematic analysis completed. The kinematic constraints have been resolved.
0.0.3) ...Initial conditions are fully updated.
0) Inverse dynamic analysis...
ERROR(OBJ.MCH.MUS4) :   S:/M..p/R..]/P..6/A..y/R..y/A..o/A..n/M..n/M..l/Kinematics.any(74)  :   MotionOptimization.InverseDynamics  :  Muscle recruitment solver :  solver aborted due to singular KKT matrix

Could you please suggest which part of the model I should look at to try to fix this. Thanks again for your input.

Robin

Hi Robin,

This error indicates that there might be a problem with the way the forces are applied to the model.

The error basically means that there was no way the solver was able to balance the system.

Please review the forceplates applied in the model? are there any?

Best regards
Søren

Søren,

Thank you for the suggestion, there are two force plates (Type 4 and type 2). I cannot see any errors in model/environment. I have attached the force plate code below in case there is something I may have missed.

   ForcePlateType4AutoDetection Plate1 (
    PlateName = Plate1,
    Folder =Main.ModelSetup.C3DFileData,
    Limb1=  .BodyModelRef.Right.Leg.Seg.Foot,
    Limb2=  .BodyModelRef.Left.Leg.Seg.Foot,
    No=0,
    VerticalDirection ="Z",
    HeightTolerance=0.07,
    VelThreshold=2.2,
    Fx=Main.ModelSetup.C3DFileData.Analog.DataFiltered.FX1,
    Fy=Main.ModelSetup.C3DFileData.Analog.DataFiltered.FY1,
    Fz=Main.ModelSetup.C3DFileData.Analog.DataFiltered.FZ1,
    Mx=Main.ModelSetup.C3DFileData.Analog.DataFiltered.MX1,
    My=Main.ModelSetup.C3DFileData.Analog.DataFiltered.MY1,
    Mz=Main.ModelSetup.C3DFileData.Analog.DataFiltered.MZ1,
    FootPresent=HumanModelPresent)
    ={
      Cal=Main.ModelSetup.C3DFileData.Groups.FORCE_PLATFORM.CAL_MATRIX.Data[0];
      Switch_DrawForceVectorFromCOP = On;
    };

    
    
    
    ForcePlateType2AutoDetection Plate2 (
    PlateName = Plate2,
    Folder =Main.ModelSetup.C3DFileData,
    Limb1=  .BodyModelRef.Right.Leg.Seg.Foot,
    Limb2=  .BodyModelRef.Left.Leg.Seg.Foot,
    No=1,
    VerticalDirection ="Z",
    HeightTolerance=0.07,
    VelThreshold=2.2,
    Fx=Main.ModelSetup.C3DFileData.Analog.DataFiltered.FX2,
    Fy=Main.ModelSetup.C3DFileData.Analog.DataFiltered.FY2,
    Fz=Main.ModelSetup.C3DFileData.Analog.DataFiltered.FZ2,
    Mx=Main.ModelSetup.C3DFileData.Analog.DataFiltered.MX2,
    My=Main.ModelSetup.C3DFileData.Analog.DataFiltered.MY2,
    Mz=Main.ModelSetup.C3DFileData.Analog.DataFiltered.MZ2,
    FootPresent=HumanModelPresent)
    ={
   //  Cal=Main.ModelSetup.C3DFileData.Groups.FORCE_PLATFORM.CAL_MATRIX.Data[1];
//      Switch_DrawForceVectorFromCOP = On;
    };

Kind regards,
Robin

Hello Robin,

Just a small note! Are you certain that the “VerticalDirection” variable is matching the direction of your gravity in TrialSpecificData?

Best regards,
Kasper Pihl Rasmussen

Hi Kasper,

Thank you for your suggestion but unfortunately this does not appear to be issue as gravity is set to -9.81 in the Z direction.

Kind regards,
Robin

The code for your force plates looks correct to me.

Some ideas for finding the issue:

  • Ensure that the plate types are correct with your c3d metadata.
  • The Height tolerance seems a bit high, try decreasing it.
  • Try running the model with muscles turned off.

#define BM_LEG_MUSCLES_BOTH CONST_MUSCLES_NONE
#define BM_TRUNK_MUSCLES CONST_MUSCLES_NONE

  • Are you sure you are running things in the correct sequence? (First MotionAndParameterOptimizationModel and then InverseDynamicAnalysisSequence)

If nothing comes up, I can take a look if you share the model.

Best regards,
Kasper Pihl Rasmussen

Kasper,

Many thanks - following your suggestions I have managed to run the inverse dynamics successfully. I am extremely appreciative of your help!

Best wishes,
Robin

Glad to hear it. Could you share the solution for us to learn from?

Best,
Kasper

Kasper,

The issue was that I had not re-loaded the model before the InverseDynamicAnalysisSequence. I also decreased the height tolerance to 0.5.

Thanks again,
Robin