GaitFullBody with initial contact

Hi,

I’m trying to run my GaitFullBody model with conditional contact, because I do not have measurements of ground reaction forces or other contact forces.
The movement is an ingress motion; so I want to use the conditional contact on the ground, on the ground inside the car and on the seat.
At first I attempt to generate the contact forces between the ground and the feet… The kinematic analysis is no problem, but when I run the inverse dynamic analysis following error message appears
InverseDynamicStudy.InverseDynamics : Muscle recruitment solver : solver aborted after maximum number of line-search iterations
What could be the reason for this error?

Thanks in advance and best regards
Evi

I’m using AMS 5.1 and AMMR V1.4.

model is attached :slight_smile:

Hi Evi,

  1. First, you should modify ‘JointsAndDriversOptimized.any’ file like this:
  AnyKinEqInterPolDriver JntDriverTrunk = {
    FileErrorContinueOnOff = On;
    Type = Bspline;
    BsplineOrder = 4;
    FileName = Main.ModelSetup.C3DFileData.NameOfFile+"-output-euler-trunk.txt";
    AnyKinMeasureOrg &PelvisPosX = ...HumanModel.Interface.Trunk.PelvisPosX;
    AnyKinMeasureOrg &PelvisPosY = ...HumanModel.Interface.Trunk.PelvisPosY;
    AnyKinMeasureOrg &PelvisPosZ = ...HumanModel.Interface.Trunk.PelvisPosZ;
    AnyKinMeasureOrg &PelvisRotX = ...HumanModel.Interface.Trunk.PelvisRotX;
    AnyKinMeasureOrg &PelvisRotY = ...HumanModel.Interface.Trunk.PelvisRotY;
    AnyKinMeasureOrg &PelvisRotZ = ...HumanModel.Interface.Trunk.PelvisRotZ;
    AnyKinMeasureOrg &PelvisThoraxExtension = ...HumanModel.Interface.Trunk.PelvisThoraxExtension;
    AnyKinMeasureOrg &PelvisThoraxLateralBending = ...HumanModel.Interface.Trunk.PelvisThoraxLateralBending;
    AnyKinMeasureOrg &PelvisThoraxRotation = ...HumanModel.Interface.Trunk.PelvisThoraxRotation;
    //AnyKinMeasureOrg &NeckExtension = ...BodyModel.Interface.Trunk.NeckJoint;
    Reaction.Type={[b]Off,Off,Off,Off,Off,Off[/b],Off,Off,Off};
  };
  
  AnyFolder Pelvis_Residual = 
  {
      AnyMuscleModel mus = 
      {
          F0 = 50;
      };
      
      AnyGeneralMuscle PosX_Pos = 
      {
          AnyKinMeasure& org = ....HumanModel.Interface.Trunk.PelvisPosX;
          AnyMuscleModel& mus = .mus;
          ForceDirection = 1;
      };
      AnyGeneralMuscle PosX_Neg = 
      {
          AnyKinMeasure& org = ....HumanModel.Interface.Trunk.PelvisPosX;
          AnyMuscleModel& mus = .mus;
          ForceDirection = -1;
      };      
      AnyGeneralMuscle PosY_Pos = 
      {
          AnyKinMeasure& org = ....HumanModel.Interface.Trunk.PelvisPosY;
          AnyMuscleModel& mus = .mus;
          ForceDirection = 1;
      };
      AnyGeneralMuscle PosY_Neg = 
      {
          AnyKinMeasure& org = ....HumanModel.Interface.Trunk.PelvisPosY;
          AnyMuscleModel& mus = .mus;
          ForceDirection = -1;
      };
      AnyGeneralMuscle PosZ_Pos = 
      {
          AnyKinMeasure& org = ....HumanModel.Interface.Trunk.PelvisPosZ;
          AnyMuscleModel& mus = .mus;
          ForceDirection = 1;
      };
      AnyGeneralMuscle PosZ_Neg = 
      {
          AnyKinMeasure& org = ....HumanModel.Interface.Trunk.PelvisPosZ;
          AnyMuscleModel& mus = .mus;
          ForceDirection = -1;
      };
      AnyGeneralMuscle RotX_Pos = 
      {
          AnyKinMeasure& org = ....HumanModel.Interface.Trunk.PelvisRotX;
          AnyMuscleModel& mus = .mus;
          ForceDirection = 1;
      };
      AnyGeneralMuscle RotX_Neg = 
      {
          AnyKinMeasure& org = ....HumanModel.Interface.Trunk.PelvisRotX;
          AnyMuscleModel& mus = .mus;
          ForceDirection = -1;
      };      
      AnyGeneralMuscle RotY_Pos = 
      {
          AnyKinMeasure& org = ....HumanModel.Interface.Trunk.PelvisRotY;
          AnyMuscleModel& mus = .mus;
          ForceDirection = 1;
      };
      AnyGeneralMuscle RotY_Neg = 
      {
          AnyKinMeasure& org = ....HumanModel.Interface.Trunk.PelvisRotY;
          AnyMuscleModel& mus = .mus;
          ForceDirection = -1;
      };
      AnyGeneralMuscle RotZ_Pos = 
      {
          AnyKinMeasure& org = ....HumanModel.Interface.Trunk.PelvisRotZ;
          AnyMuscleModel& mus = .mus;
          ForceDirection = 1;
      };
      AnyGeneralMuscle RotZ_Neg = 
      {
          AnyKinMeasure& org = ....HumanModel.Interface.Trunk.PelvisRotZ;
          AnyMuscleModel& mus = .mus;
          ForceDirection = -1;
      };
      
      AnyVar PosX_Force = PosX_Pos.Fout[0] + PosX_Neg.Fout[0];
      AnyVar PosY_Force = PosY_Pos.Fout[0] + PosY_Neg.Fout[0];
      AnyVar PosZ_Force = PosZ_Pos.Fout[0] + PosZ_Neg.Fout[0];
      AnyVar RotX_Moment = RotX_Pos.Fout[0] + RotX_Neg.Fout[0];
      AnyVar RotY_Moment = RotY_Pos.Fout[0] + RotY_Neg.Fout[0];
      AnyVar RotZ_Moment = RotZ_Pos.Fout[0] + RotZ_Neg.Fout[0];      
  };

The role of this code is to replace the traditional pelvis residual force(AnyReacForce) with AnyGeneralMuscle.

  1. And I would recommend you to change the setting inside AnyBodyStudy class:
InverseDynamics.Criterion.UpperBoundOnOff=Off;

Because there are some joint muscles in the upper body joints,
sometimes they need to be overloaded.
Also if the artificial muscle for pelvis residuals may have small strength,
then it may be also overloaded.

  1. Finally, you have to define the locations of conditional contacts very well.
    Of course I may be able to do that, but I can’t spend too much time on one question. :slight_smile:

Good luck!
-Moonki

Hi Moonki,

no doubt that you can do that, but there should also be something left for me to do :slight_smile:
Thank you again for your help!
But I still have some questions left. When you speak of the locations of conditional contact - do you mean the body part it’s referred to, e. g. left foot toe and the direction {2,0,1}??? I was now able to run inverse dynamics, but my model has some weird positions in the beginning :slight_smile: I understand that my ‘surface’ needs the ‘basenode’ which has a normal vector pointing upwards from the surface. In most cases this is the y component - so I have to set the direction to {1,0,2}?
Then another questions I would like to ask you for a better understanding. When e. g. the left foot is in the air and the right foot on the ground inside the car - is it right to increase the static friction coefficient of the right leg in this step?
Sorry if there may be a stupid question, but I think I haven’t already understood the whole conditional contact topic in detail :slight_smile:

Best regards
Evi

Hi Evi,

First, there is no stupid question on your post. Please don’t worry. :slight_smile:

  1. First, all the related files about conditional contact exist here:
    ‘\AMMRV1.4\Body\AAUHuman\ToolBox\FrictionContactMuscles’

  2. It seems that you are using ‘ContactSurfaceLinPush.any’ file directly.
    In that case, you have to define several ‘BaseObject’ which can be regarded as a ‘landmine’.
    If the normal direction of the baseobject is ‘Y’ then you are right. You should set the direction as {1, 0, 2} or {1, 2, 0}.

  3. If you can put much of your time and effort, then you can put as many targetobject on the human foot as you can.
    But if you want to just test quickly, then there are some class templates for that purpose.
    ‘ConditionalContactClass.any’ and ‘ConditionalContactFootPlaneClass.any’ files.

If you want to see how these files can be used, then I would suggest you to see the ‘StandingLift’ example in the repository.
When you open ‘StandingLift.main.any’ then you can see that those two files are included at the top of the main file.
And if you see ‘JointsAndDrivers.any’ file in the StandingLift model, then you can see how ConditionalContactFootPlaneClass can be used.

I hope this may help you.

Best regards,
Moonki

Hi Moonki,

thank you! After looking closely to your suggested model I tried to use the conditional contact in my ingress model again. I’ve added a foot plane for the floor, a ground of the car inside and seats (from the AnyBody Egress Model). Both last named have just an optical task right now, but there are also ‘ConditionalContactFootPlaneClass’ and ‘ConditionalContactClass’ with them. Furthermore I’ve added some nodes in the EnvironmentAutoDetection file as a ground ref and used them for conditional contact in the JointsAndDriversOptimized.any. I’m not really sure, if everything works fine. Additionally I would like to have the seat surface and structure having an influence on the contact forces between human model and seat.
Do you think I can do this in the JointsAndDriverOptimized.any file with the lines

ConditionalContactClass Pelvis_Right_Post (
BaseObject = Main.Studies.InverseDynamicStudy.EnvironmentModel.GlobalRef,
TargetObject = Main.Studies.HumanModel.BodyModel.Trunk.SegmentsLumbar.PelvisSeg.RightPostNode,

when I take the seat (from GlobalRef3 in the EnvironmentAutoDetection file) as BaseObject??

Thanks in advance and best regards
Evi

Hi Evi,

Attached please find the modified version of your model.

Let me explain something for your model:

  1. For inversedynamics, the direction of gravity was wrong in your model.
    So I had to change it. You can find what I’ve changed.

  2. Your ‘AnyMan.any’ file contained strange code for Talus segment.
    Please compare your file with the original ‘AnyMan.any’ file of the GaitFullBody example in the repository.
    So if you run your original model, you could see that the talus shape is so strange.
    So with the new AnyMan.any file I had to re-run MotionAndParameterOptimization process!

  3. Because I had to change many things about your conditional contact objects,
    instead of writing all explanations here, I would like to just upload the modified version of your model.
    When you can understand what I’ve changed perfectly, then there will no no more things to ask again. :slight_smile:

  4. Of course this model is not perfect. There are many things to be improved by putting more efforts.
    But because those things may be beyond the scope of free support, I hope that you can find possible improvements well.

Good luck!
-Moonki

Hi Moonki,

thank you again!!
I understand your changes on the conditional contact objects. So I was able to run inverse dynamics with some other c3d-files from other subjects.
But with some files there’s a problem: Muscle recruitment solver: solver aborted after maximum number of iterations.
In some cases I could solve the problem with changing the location, the height and the radius of the foot planes. But now in some other cases the error still appears even if theres a contact shown in the simulation between foot and plane.
What can I do to fix it?

Best regards
Evi

Hi Evi,

Without model, I can’t say anything about your model.

I would suggest you to upload your new model which has problems.

Best regards,
Moonki

Ok, here it is :slight_smile:

Hi Evi,

Please upload your model in the ‘Debug model’ section if you want us to investigate your model.
http://forum.anyscript.org/forumdisplay.php?f=21

Best regards,
Moonki