Best option to manually set pelvic tilt

Hi everyone,

I have a question on how to best set the pelvic tilt on an Anybody model. I am using Motion tracking data to set my bone landmark marker.
So far I have tried to change the coefficients of my Design variables RASIS_X, RPSIS_X from my following constraint:

I tried to put different coefficients into the constraint and reloaded the model but didn't see any changes. What is my problem and which other options do I have? My study is to investigate the effects of the pelvic tilt on the Hip Joint forces, so I would like to adjust the pelvic tilt manually.

Thanks!

Hi Christian,

The class that creates this link looks like this

class_template LinkDesignVars (DesVar1, DesVar2,
Contraint_Type = EqualToZero, Coef1 = 1, Coef2= 1, PARAMETER_OPT_STUDY = Main.Studies.ParameterIdentification){
  
  Main.ModelSetup.ParameterIdentification = {
     AnyDesMeasure LinkedDesignVars_##DesVar1##_##DesVar2 = {
         Type = Contraint_Type;
         Val = (Coef1) *.DesVar1.Val - (Coef2)*.DesVar2.Val;
     }; 
  };
  
  PARAMETER_OPT_STUDY = {
      AnyDesMeasure &LinkedDesignVars_##DesVar1##_##DesVar2 = Main.ModelSetup.ParameterIdentification.LinkedDesignVars_##DesVar1##_##DesVar2 ;  
   };
  
  
}; 

So if the coefficients are 1 and -1 it will mean the values are constrained to be the same. You will not see this at load time, this is constraint in the parameter optimization so it will only impact model after running this.

The constraint will be
-1desvar1+1desvar2 =0

If you use values of different size i think you can enforce a tilt so e.g.
-1desvar1+3desvar2 =0

Best regards
Søren

Hi Soren,

Thank you for your answer.

I have tried changing the coefficients and run the parameter optimization but couldn't see any changes in the model view. Here are the results with the relevant coeffizients:

I have also run the inverse dynamics analysis and the visual representation of the model did not change.
Do I have to pick larger coefficients? or what other way to approach this problem do I have?

Best regards
Christian

Hi Christian,

Quick question did you write the line below in the model ?

#define _SIS_SymmetryConstraint

Otherwise the constraint is not added

This is because the line

#ifdef _SIS_SymmetryConstraint

will effectively disable the constraint if _SIS_SymmetryConstraint is not defined

Please check that you see this constraint present when you browse the model tree folder "Main.Studies.ParameterIdentification" among all the desing variables and constraint you should see this one you added.

Hope it helps

Best regards
Søren

Hi Soren,

Yes, the #define _SIS_SymmetryConstraint line is mentioned at the beginning in my Markerprotocol file.
I will add both my screenshots and modelviews after customizing the coefficients and running the RunParameterIdentification:

Maybe this will help to identify the problem.

Could I add another constraint to define the value between two Markers, for example the x value distance difference between RASIS and RGTR and force a pelvic tilt? I marked the 2 markers in the following picture.

There already is a constraint defined earlier which constraints the left and right side of the pelvic to be symmetrical.

Best regards
Christian

Hi Christian,

Please try to verify that after the opimization has finished that the added constraint is indeed fulfilled.

You can add more constraints that is not a problem, i am not sure it will be a good idea to have constraints between markers which originates from different segments, which i think the two makers you mention does. In principle it would work, but i may change angles in an undesired way.

Best regards
Søren

Hi Soren,

I looked for the constraint after the RunParameterIdentification Study in the model tree and this is what i found highlighted in the model tree. I believe that is the constraint I customized. The constraint is also shown in the middle column with the corresponding coefficients. I changed Coef2 from a -1 to a -3 in this case.

Hi Christian,

What you show in the modeltree is a reference to the design variable, if you double click it you can find its real location in the modeltree which is the folder "Main.ModelSetup.ParameterIdentification" there you can check and verify that the val of RASIS_x and RPSIS_x is indeed x 3.

Best regards
Søren

Hi Soren,

Thank you for your reply.
These are my RPSIS_X = 0,001378248 and RASIS_X = -0,004134743 values. So it is confirmed that RPSIS_X is 3 times smaller then RASIS_X. I have attached the screenshots too:

So my constraint works, but why is a difference in the modelview not visible? I really appreciate your help!

edit1:
I actually tried it with different coefficients now and it seems that my values of RASIS and RPSIS stay the same. In this case i put Coef1= 1 and Coef2=-10:

So does that mean the constraints are not working and the first case was just right coincidentally?

Hi Christian

The constraints are working, but the value are effectively both zero so that is maybee why you do not see it visually.

I can understand this if you have use the PlaceMarkerAt argument and placed both markers relative to a marker point on pelvis, but i do not know if this is the case for these two markers? in this case the variables will be the marker position relative to this point.

I also think you should constrain the y coordinate instead of the x direction this will be more effective to control pelvic tilt, but note that if from the start both markers have y to be almost zero then constraining them to be different by a factor of 3 will not be an effective way to introduce pelvic tilt.

Best regards
Søren

Best regards
Søren

Hi Soren,

Thanks for the advice. I have thought about constraining the y coordinate too. But the RPSIS_Y = 0 so i won't be able to constrain it. The Optimization for the RPSIS_Y has been turned off.

To your second point: both RASIS and RPSIS use PlaceMarkerAt argument.

Also I made an edit in my previous post about the values not changing despite changing the coefficients. That's probably part of the problem but i'm still unsure to why it doesn't change.

Hi Christian,

If both markers use PlaceMarkerAt the sRelOpt value is relative to this point. This means that if your point are good estimates from the start the RASIS_X and RPSIS_X values will be both small, this is also what you when looking at the values they are 1-4 mm. So i think this is why you can not really see a difference.

What about creating a variable which would be added to RPSIS_Y and subtracted from RASIS_Y ?

Best regards

Søren

Hi Soren,

Thanks for your advice. Where would you ideally place this new variable? I'm still new to Anybody so I'm not that familiar with the program yet. Should I place this new variable in the Marker Protocol? Also do I create a new constraint for this specific task and can does Anybody acknowledge iterative variable e.g. X=X+1?

What I have tried now is to create a new constraint and increase the Y_value distance between RASIS and RPSIS. Here is a screenshot of my implementation:

Also where can i find some documentation or information on the different functions and arguments used to create the Markers, such as MarkerPlacement or UseC3DWeightResiduals? I could not find anything in the Anyscript Reference manual. I attached a screenshot of the relevant section if that helps. Thanks!

Bildschirmfoto 2020-04-23 um 17.06.51

Hi Chstian,

You can find more info on this wiki page https://github.com/AnyBody/support/wiki/New-How-to-setup-your-own-MoCap-driven-Model
The CreateMarkerDriver is an AnyScript class, a good way to find it's defintion is simply to search for it using the search icon in the menu. This will list all location of the class in the loaded model including its definition.

UseC3DWeightResiduals specifically sets if you wan the solver to utilize the information in the C3D regarding the markers visibility. If the setting is On it is automatically handled if there is a short marker drop out in the data.

Concerning the previous post, i do not think this code would load? Value can not be assigned twice.

I think i would add it in the MarkerProtocol, you can not write x=x+1 it will complain that it is a circular expression.

Simplest solution would be to add a variable to the sRelOpt values like e.g.

AnyVar MyTiltVariable =0.02;

CreateMarker …. = {

sRelOpt ={0,0.05+.MyTiltVAriable,0};
};

Best regards
Søren

Best regards
Søren

Hallo Soren,

Thanks so far. I can now tilt my pelvic using an Anyvar Variable and adding/subtracting it with my ASIS and PSIS markers.
But it is not exactly reacting as it expected it would. I added MyTiltVariable to X value of sRelOpt of ASIS and subtracted MyTiltVariable to the x value of PSIS. If I now have a positive MyTiltVariable my pelvic will tilt forward (anterior pelvic tilt) and if I change it to a negative MyTiltVariable it will tilt backwards (posterior Pelvic Tilt). So it is optimizing the Y values of the markers in the opposite direction. Why is this happening?

Here is an example with MyPelvicTiltVariable at 0.05:
loaded model :

Model after RunParameterIdentification:

As you can see the red markers are behaving the way one would expect but after MarkerOptimization it ends up tilting the other way around.

Also do you maybe have an idea how i could assign MyPelvicTiltVariables to a Degree of Pelvic Tilt? Basically I would like to know what degree of Pelvic Tilt I have when using MyPelvicTiltVariable. I tried running the Simulation multiple times using different values for MyPelvicTiltVariable and using tangens with deltaY (RASIS_Y-RPSIS_Y) divided by deltaX (RASIS_X-RPSIS_X) values. But my degree values don't seems to really make sense since it floats around 88 - 70 degrees and don't seem to have a linear correlation with MyPelvicTiltVariable.
Is there maybe already a variable for the pelvic tilt in the model tree where i can just pick up the current pelvic tilt in the model?

Hi Christian,

I think the main issue here is that the y values are still being optimized the OptY needs to be Off otherwise we just made a different estimate on its starting position, but it can still move it.

I have made this small script which can be added in the main file

Main ={
 
  AnyFloat offset = 0.1;
  
  AnyOperationSetValue ChangePelvicTilt = {
    
    AnyFloat NewRASIS = Main.HumanModel.BodyModel.Trunk.SegmentsLumbar.PelvisSeg.RASI.sRel+{0,0.1,0}; 
    AnyFloat NewLASIS = Main.HumanModel.BodyModel.Trunk.SegmentsLumbar.PelvisSeg.LASI.sRel+{0,0.1,0}; 
    AnyFloat NewRPSI = Main.HumanModel.BodyModel.Trunk.SegmentsLumbar.PelvisSeg.RPSI.sRel+{0,-0.1,0}; 
    AnyFloat NewLPSI = Main.HumanModel.BodyModel.Trunk.SegmentsLumbar.PelvisSeg.LPSI.sRel+{0,-0.1,0}; 
    

    Target = {
      &Main.HumanModel.BodyModel.Trunk.SegmentsLumbar.PelvisSeg.RASI.sRel,
      &Main.HumanModel.BodyModel.Trunk.SegmentsLumbar.PelvisSeg.LASI.sRel,
      &Main.HumanModel.BodyModel.Trunk.SegmentsLumbar.PelvisSeg.RPSI.sRel,
      &Main.HumanModel.BodyModel.Trunk.SegmentsLumbar.PelvisSeg.LPSI.sRel
    };
    Source = {
      &NewRASIS,
      &NewLASIS,
      &NewRPSI,
      &NewLPSI
    };
    
  };
};

It will essentially read the current value of the marker position, edit it and override the first first value.
This is an operation which needs to be executed to have an effect so you will have to do this manually.

So then the steps are:

  1. Run the parameter optimization this will give you optimized values
  2. run the "changePelvicTilt" operation, this will override optimized values.
  3. Run markertracking operation

I think you can try to introduce a tilt angle in the script i wrote like you tried before , i think it will work now if you tried it with this concept.

Best regards
Søren

Hi Soren,

I will be trying ur method and compare it to my current method.

I have discussed the above-mentioned problem with my supervisor and I think it does make sense how it behaves, because the model tries to reach those skin marker points. In essence, from what I have understood, the red markers try to reach the blue markers.
With just these changes I am able to control my pelvic tilt. I will run ur method too and try to analyze the results and see which one delivers better results.

My main concern right now is the pelvic tilt angle. Can you specify what you mean by introducing a tilt angle in the skript? Basically what I need is to know my pelvic tilt angle when I use a certain Value for PelvicTiltVariable. It is quite bothersome to always calculate it manually by hand and i feel like it might not be the right approach since my the visual of the model seem okay but my calculated angles don't match. Ideally Anybody already has a Pelvic Tilt Variable that i can just read off from the model tree or implement a function in the code to do it for me.
Thanks!
Christian

Hi Soren

I realized I tried to calculate the pelvic tilt angle with my through Main.ModelSetup.ParameterIdentification.RASIS_Y.Val for example. I realized these are the only the optimized values and if I switch the OptY=0 then Y=0. Wouldn't it be better to look at Main.HumanModel.BodyModel.Trunk.SegmentsLumbar.PelvisSeg.LASIS.r ?
I ran a Parameter Optimization Study as you described in your previous post and I received these results for Main.HumanModel.BodyModel.Trunk.SegmentsLumbar.PelvisSeg.LASIS.r :
RASIS: {0.3496912, 0.7410907, 1.025721} and
LASIS: {0.3415555, 0.9723225, 1.012364}.
Shouldn't the z-axis (medial/lateral) have the biggest difference and not the Y-value (superior/inferior) since its the left and right ASIS markers?

Also this warning shows up when I run the ChangePelvicTilt. I'm guessing it has something to do about overriding the old sRel values.

I tried both simulation. One with the Skript you suggested and one with the PelvicTiltVariable as seen in my previous post. The difference in Main.HumanModel.BodyModel.Trunk.SegmentsLumbar.PelvisSeg.LASIS.r and PelvicTiltVariable with OptY turned off is between 1mm-5mm when I change the PelvicTiltVariable=0,05. So I guess both options work relatively fine but which is the more accurate one?

Hi Christian,

Here are some clarifications.

  • ".r" is the nodes global position in space at any given time of the analysis, this is output from the model.
    ".sRel" this is the modes relative position wrt frame it is placed in, so normally the segmental frame.

  • "Val" in this case is relative to the sRel so if all design vars are zero then marker did not move.

Since all pelvic markers are in the same frame, you can use the sRel values, it will not be possible to sue the "r" values i the same manner because they are not ready until later in the analysis.

When you say you are able to calculate the pelvic tilt angle by hand you can use the same expressions in the script.

AnyVar MyTrigometricCalculation = tan( XX.sRel / XX.sRel ) ;   //Sample code for illustration only

The advantage of the way i suggest is that you first allow the model to track the makers in the best possible way. Then you by purpose change the pelvic tilt, and nothing else in the model.

Hope it helps

Best regards
Søren