C3D-Files from the Xsens MVN BIOMECH in GaitFullBody

Hi everybody,

I have some C3D-Files from the Xsens MVN BIOMECH and want to do a inverse dynamic analysis with the GaitFullBody model (AMMRV1.4). I’ve used the model without both arms (and without force plates). The main loads well, but when I’m trying to run the Motion and Parameter Optimization following error message appears:

Macro command > runmacro “C:…\AnyBody.5.x.x\AMMRV1.4\Application\Examples\MyGaitFullBody2\Sequence1.anymcr”

Macro command > operation Main.Studies.ParameterIdentification.ParameterOptimization

Macro command > run

  1. Operation Sequence: (Operation: Main.Studies.ParameterIdentification.Analysis):
    0.0) Kinematics (Operation: Main.Studies.KinematicStudyForParameterIdentification.Kinematics):
    0.0.0) PreOperation (Operation: Main.Studies.KinematicStudyForParameterIdentification.Kinematics.PreOperation):
    0.0.0.0) InitialConditions (Operation: Main.Studies.KinematicStudyForParameterIdentification.InitialConditions):
    0.0.0.0) …Design variables have been updated.
    0.0.0.1) …Load-time positions have been re-established.
    0.0.0.2) …Kinematic analysis completed. The kinematic constraints have been resolved.
    0.0.0.3) …Initial conditions are fully updated.
    0.0) Kinematic analysis…
    0.88) …Kinematic analysis completed
    0.0) Optimization (Operation: Main.Studies.ParameterIdentification.ParameterOptimization):
    0.0) Optimization step (Operation: Main.Studies.ParameterIdentification.ParameterOptimization):
    0.0) Evaluating KKT conditions (Operation: Main.Studies.ParameterIdentification.ParameterOptimization):
    0.0) Evaluating the objective function (Operation: Main.Studies.ParameterIdentification.ParameterOptimization):
    0.0) Calculating a new search direction (Operation: Main.Studies.ParameterIdentification.ParameterOptimization):
    Kinematic parameter analysis failed : there are 68 design variables but only 5 independent associated optimality conditions
  • attempts to continue (attempt no. 1)
    0.0) Optimization step (Operation: Main.Studies.ParameterIdentification.ParameterOptimization):
    0.0) Evaluating KKT conditions (Operation: Main.Studies.ParameterIdentification.ParameterOptimization):
    WARNING! NAN reached!
    Unexpected error in computational kernel
    ERROR(OBJ.DES2) : C:/U…s/…/D…p/A…x/A…4/A…n/E…s/M…2/GaitFullBody.main.any : ParameterIdentification.ParameterOptimization : Optimization failed : Failed to solve position analysis

Macro command > runmacro “SaveMacroOperation-Save.anymcr”

Macro command > classoperation Main.ModelSetup.SaveMacroOperation “Save AnyString to file” --file=“RunMacroOperation-Save.anymcr”

Macro command > runmacro “RunMacroOperation-Save.anymcr”

Macro command > classoperation Main.Studies.ParameterIdentification “Save design” --file=“C3D-001-OptimizedParameters.txt”

Main.Studies.ParameterIdentification : Saving design…

Macro command > operation Main.Studies.MotionOptimization.Kinematics

Macro command > run

0.0) Kinematics (Operation: Main.Studies.MotionOptimization.Kinematics):
0) PreOperation (Operation: Main.Studies.MotionOptimization.Kinematics.PreOperation):
0.0) InitialConditions (Operation: Main.Studies.MotionOptimization.InitialConditions):
0.0) …Design variables have been updated.
0.1) …Load-time positions have been re-established.
WARNING! NAN reached!
Unexpected error in computational kernel
ERROR(OBJ.MCH.KIN3) : C:/U…s/…/D…p/A…x/A…4/A…n/E…s/M…2/GaitFullBody.main.any : MotionOptimization.InitialConditions : Kinematic analysis failed in time step 0

What could be the reason (and a possible solution) for this error?
Thanks in advance!

Best regards
Evi

Hi Evi,

Welcome to AnyBody world!

To solve your problems, would you upload your model in the ‘Debug’ section?

And please let us know which version of AMS and AMMR you are using.

Best regards,
Moonki

Hi Moonki,
thanks for your answer! I’m using AMS 5.1 and AMMR V1.4.
Since I did some changes on the whole bodymodel, I’ve uploaded that too (just without the BonesSpine folder).
Best regards
Evi

Hi Evi,

I tried to debug your model but because I don’t have enough time so I’ve attached the modified model of yours, but it still needs to be modified…

Let me explain something about your model:

  1. First, I would ‘not’ recommend you to modify ‘CreateMarkerClass.any’ and ‘CreateMarkerClassTD.any’ files. Please just use the original files unless you can understand those files perfectly.

  2. In the ‘ModelSetup.any’ file, you should modify ‘MarkerLabels’ property in the AnyInputC3D class.

  3. When you use ‘CreateMarker’ or ‘CreateMarkerTD’ class templates, the ‘MarkerPlacement’ targets should be original segments.
    When I looked your code, you tried to use your own reference nodes for this ‘MarkerPlacement’. But there may be no ‘ScalingNode’ in your reference nodes.

  4. ‘PointsScaleFactor’ property in the AnyInputC3D class does not seem to be correct. Please find the correct value.

If you download the attached model, you can understand what I’ve wrote here.

Actually, I may not be able to find all the problems of your model. There may be other problems.
But right now, from this modified model, I would re-define the markers’ positions if I were you.

In general, we can’t support some models which contain a modified version of ‘Body’ folder in AMMR. Your model also contains a modified ‘Body’ folder.

The reason is that if users modify the ‘Body’ folder, it means that he or she should understand the AnyBody models very well.

Also if you do not write everything about your change on this ‘Body’ folder, we should spend a lot of time to find what you’ve changed.

I hope that you can understand what I’ve written here.

So my suggestions are:

  1. If possible, please do not touch ‘Body’ folder when you upload your model for the debug section.
  2. If you should keep your modified version of ‘Body’ folder, please provide us every information about your change.

Best regards,
Moonki

Hi Moonki,

thanks for your advice!
Now I’ve defined the positions of the markers again and used the original body folder.
I think it’s better now, but there’s still a problem with the parameter optimization sequence
(“ParameterIdentification.ParameterOptimization : Optimization failed : Failed to solve position analysis”).

Best regards
Evi

Hi Evi,

I looked your model again and I would make some suggestions for you…

  1. When you are using AnyInputC3D class in the ‘ModelSetup.any’ file,
    let’s try to change these properties as follows:
    ConstructChartOnOff=Off;
    ConstructModelOnOff = Off;
    MarkerUseAllPointsOnOff = Off;

Then you can see the only markers which are described in the ‘MarkerLabels’ section. It will make you see more clearly.

  1. I don’t know much about your XSENS marker set.
    But if you can see the GaitFullBody example in the repository,
    you may pick up several markers which have similar positions with VICON plug-in-gait marker set.
    I think you should redefine the marker set in the ‘ModelSetup.any’ file.
    When you define your own marker set, first I would recommend you not to change the Anthropometrics data in the ‘TraialSpecificData.any’ file.
    When you finish marker re-definition, then you can put your own anthropometric value of the subject.

If you can let me know the detail information of Xsens marker set, then I can recommend you which markers may be the best.

So, right now, I may not be able to support your current model.

Could you modify your marker set more nicely and upload here again?

Best regards,
Moonki

Hi Moonki,

thanks again!
Now I’ve tried to choose markers with similar positions as the VICON marker set (as far as possible). After the marker re-definition I’ve also changed the anthropometric values in the ‘trialspecifdata’ file.
I’m not sure, if my changes were helpful, because the parameter optimization stops earlier than before: ‘ERROR(OBJ1): C:/U…s/Evi/D…p/E…e/A…n/E…s/M…2/ModelSetup.any: C3DFileData.Points.Markers.pRightCSI.PosInterpol: Parameter has an invalid value for this interpolation; extrapolations are not allowed.’

Currently I’m also waiting for some detail information about the Xsens markers - perhaps this will help proceeding.

Best regards
Evi

Hi Moonki,

here the informations about the Xsens marker set.

Best regards
Evi

Hi Evi,

Attached please find the modified version of your model.
Now it is working well.

Let me explain what I’ve changed on your model.

  1. In ‘TrialSpecificData.any’ file, I changed UserFirstFrameNo and UserLastFrameNo values.
    Usually, UserLastFrameNo value should be bigger than the first frame no. of C3D file.
    And UserLastFrameNo value should be less that the last frame no. of C3D file.
    If not, then the interpolation problems may occur.

  2. Also in ‘TrialSpecificData.any’ file, I changed the initial rotation of pelvis:

    AnyVar PelvisRotZ = 90;   
    AnyVar PelvisRotY = 0;
    AnyVar PelvisRotX = 90;   
  1. In ‘ModelSetup.any’ file, when you use ‘CreateMarker’ and ‘CreateMarkerTD’ class templates, the optimization settings such as OptX, OptY, OptZ can be ‘On’ or ‘Off’.
    We should this values as many ‘Off’ as you can.
    For instance, if we know that a certain marker is very close to bone geometry feature point, then we can set these values as ‘Off’.

  2. In the main file, I put these two lines somewhere(try to find by yourself)

      InitialConditions.MaxIteration = 5000;
      Kinematics.MaxIteration = 5000;

These lines let AnyBody do more calculation for kinematics until AnyBody can find a solution to avoid kinematic errors.

Now you can run inverse dynamics.
But because there is no force plate data in your C3D file, the pelvis residual values will be very higher.

I hope this may help you.

Good luck!
-Moonki

Hi Evi,

Attached please find a new modified version of your model, which includes neck joint so looks more realistic.

Best regards,
Moonki

Hi Moonki,

thats really great, would have never come to the idea with the iteration!
THANK YOU!

Best regards
Evi

Hi Moonki,

with most models (75 %) it’s possible to run the kinematic analysis.
The other 25 percent show following error message:

Failed to resolve kinematic constraints. Newton relaxation too small. (final kin. error = 1.644522E-005)
Constraint no. 14 above error tolerance 0.000001, error = 0.000002.
Constraint no. 15 above error tolerance 0.000001, error = 0.000011.
Constraint no. 17 above error tolerance 0.000001, error = 0.000002.
Constraint no. 18 above error tolerance 0.000001, error = 0.000002.
Constraint no. 20 above error tolerance 0.000001, error = 0.000001.
Constraint no. 36 above error tolerance 0.000001, error = 0.000001.
Constraint no. 43 above error tolerance 0.000001, error = 0.000002.
Constraint no. 50 above error tolerance 0.000001, error = 0.000002.
Constraint no. 57 above error tolerance 0.000001, error = 0.000003.
Constraint no. 71 above error tolerance 0.000001, error = 0.000003.
Constraint no. 126 above error tolerance 0.000001, error = 0.000008.
Constraint no. 127 above error tolerance 0.000001, error = 0.000013.
Constraint no. 128 above error tolerance 0.000001, error = 0.000008.
Constraint no. 129 above error tolerance 0.000001, error = 0.000009.
Constraint no. 130 above error tolerance 0.000001, error = 0.000004.
Constraint no. 131 above error tolerance 0.000001, error = 0.000016.
Constraint no. 132 above error tolerance 0.000001, error = 0.000010.
Constraint no. 133 above error tolerance 0.000001, error = 0.000006.
Constraint no. 134 above error tolerance 0.000001, error = 0.000005.
Constraint no. 135 above error tolerance 0.000001, error = 0.000004.
Constraint no. 136 above error tolerance 0.000001, error = 0.000004.
Constraint no. 137 above error tolerance 0.000001, error = 0.000013.
Constraint no. 140 above error tolerance 0.000001, error = 0.000001.
Constraint no. 141 above error tolerance 0.000001, error = 0.000003.
Constraint no. 142 above error tolerance 0.000001, error = 0.000002.
Constraint no. 143 above error tolerance 0.000001, error = 0.000008.
Constraint no. 145 above error tolerance 0.000001, error = 0.000010.
Constraint no. 146 above error tolerance 0.000001, error = 0.000006.
Constraint no. 155 above error tolerance 0.000001, error = 0.000001.
Constraint no. 157 above error tolerance 0.000001, error = 0.000002.
Constraint no. 162 above error tolerance 0.000001, error = 0.000002.
Constraint no. 164 above error tolerance 0.000001, error = 0.000001.
Constraint no. 165 above error tolerance 0.000001, error = 0.000001.
Constraint no. 166 above error tolerance 0.000001, error = 0.000001.
Constraint no. 260 above error tolerance 0.000001, error = 0.000002.
Constraint no. #0 in ‘Main.Studies.KinematicStudyForParameterIdentification.HumanModel.BodyModel.Trunk.JointsCervicalSpine.Rotation.CervicalRotationRhythmDrv’ above error tolerance 0.000001, error = 0.000002.
ERROR(OBJ.MCH.KIN3) : C:/U…s/Evi/D…p/E…n/A…n/E…s/F…1/Ingress.main.any : MotionOptimization.InitialConditions : Kinematic analysis failed in time step 0

I’ve tried several things… I used some markers more in the modelsetup.any file. In the main file I made changes in the max. iteration, in the steps and the kinematic tool. In trialspecifcdata.any I used the optimized parameters and changed the last/first frame. And in the bodypartsetup files I took only ‘trunk’ instead of trunk+neck. Nothing worked. Do you have an idea how to fix it?

Best regards
Evi

Hi,

Please upload your model in the ‘debug’ section.
http://forum.anyscript.org/forumdisplay.php?f=21

Best regards,
Moonki