Apply force to dummy seg

Hi,
I’m using AMMRV1.3.1 and the FreePostureMove model.
I’m trying to apply a time varying force to a dummy segment, which also moves in time but is rigidly connected to the thigh segment. I have included the code for the dummy segment and the force.

My problem is that the force doesn’t seem to be applied to the thigh segment. In the ChartFX I can see the force as it should be. But… I’ve only applied the force to the right thigh, but the muscle activities etc. are identical between left and right. I even magnified the force by a factor of 100 to try to highlight the difference.

Any help would be greatly appreciated!
Regards,
Chris


AnyFolder RThighCoP = {
  
  AnySeg Seg= //Adds a dummy segment of zero mass etc
  {
    //AnyRefFrame &BodySeg = Main.HumanModel.BodyModel.Right.Leg.Seg.Thigh;
    Mass = 0;
    Jii = {0, 0, 0};
    AnyDrawNode DRW= 
    {
      Visible = On;
      Opacity = 1;
      RGB = {1, 0, 1};
      ScaleXYZ = {0.025, 0.025, 0.025};
    };
  }; // *DummyThighSeg
  

  
  AnyKinEq RotFix= 
  {
    AnyKinRotational ROT= 
    {
      Type = RotAxesAngles;
      AnyRefFrame &Seg= ..Seg;
    };
  };// *RotFix
  
  
  AnyKinEqInterPolDriver CoPDriver= {
    Type = Bspline;
    BsplineOrder = 4;
    FileName = Main.MatlabInputParameters.SegForceFilePath  +"\CoP_Thigh.txt";   
    AnyRefFrame &SegRef = .Seg;
    AnyKinLinear LIN={
      Ref = 0;//-1;
      AnyRefFrame &SegRef = ..Seg;
      AnyRefFrame &BodySeg = Main.HumanModel.BodyModel.Right.Leg.Seg.Thigh;
    };
    Reaction.Type={Off,Off,Off}; //Implies it has no influence on/from the environment
  }; // *CoPDriver
  
  
  AnyReacForce Reac= {
    AnyKinLinear LIN= //Creates "infinitely" strong link between the segment and the dummy segment
    {
      Ref = 0;
      AnyRefFrame &BodySeg = Main.HumanModel.BodyModel.Right.Leg.Seg.Thigh;
      AnyRefFrame &Seg = ..Seg;  
    };
    
  }; // *Reac
  
  
  
  AnyFunInterpol ForceFun={
    Type = Bspline;
    BsplineOrder = 4;
    FileName = Main.MatlabInputParameters.SegForceFilePath  +"\Force_Thigh.txt";   //Read in Force on Seg 
    
  }; // *ForceFun
  
  
  AnyForce3D Force= {  //Apply the Force to the Seg
    F = .ForceFun(t)*100;
    //F={1000,0,0};
    AnyRefFrame &Seg = .Seg;
  }; // *Force
  
  
  
  AnyDrawVector drwVector1 = {
    AnyRefFrame &Seg= .Seg;
    Visible = On;
    Opacity = 1;
    Vec = .Force.F *0.0001;
    GlobalCoord = Off;
    //Vec = {1, 1, 1};
    Line = {
      Thickness = 0.01;
      RGB = {0.5, 1, 1};
      
      End = 
      {
        Style = Line3DCapStyleArrow;
        RGB = {1, 1, 1};
        Thickness = 0.025;
        Length = 0.025;
      };// *End
      
    };// *Line
    
  }; // *drwVector1 
  
  
  
  
  
}; /* RThighCoP */


Hi Chris,

Your code looks apparently ok…

Are you sure this extra lines are part of the active study?

They could be loaded without being inside the study…then there would be no effect…

Best regards
Søren

Hi Søren,
Many thanks for your response.
I’m still a relative novice with AnyBody and how it operates, but I’m fairly confident these lines are in the Study.
The model I’m using is almost identical to the FreePostureMove model. I added the lines above as an include in the Environment folder, as I thought this is where I should add any external loads. The Environment folder is in the Model folder, which is referenced in the study as “AnyFolder &Model = .Model;”.

Based on this I’m assuming it’s in the right place?

Could the error be anything to do with the order in which the “AnyRefFrame” are referenced? Or the “Ref” values being wrong?

Regards,
Chris

Hi Chris,

I don’t see an obvious error as well. The place is ok, as it is loaded in the study. It’s of course easy to mix something with the ref’s. You can try to change some Reference Frames and have a look if any changes are visible.

If you don’t get it running, upload the model and I’ll try to run it.
If you don’t want to upload your Matlab files, you could change the driver to something really simple.


Hi Amir,

Thanks for your reply. Sorry, trying to do too many things at the moment and have only just come back to this! Anyway, I’ve included my above file into the Environment file of the PushUp model and I can see a clear difference between the left and right side, so it would suggest it’s something else in my model. I’ll let you know if I find out what it is. Otherwise I’ll up load it here and if you get a chance may be you could have a look.

Many thanks,
Chris

Hi Amir,
Thanks again for your help on this. I think I’ve found the cause. The code below is what I was using to drive the Flexion of the left hip. I realised that the Reaction.Type = {On}; However, when changing it to {Off} it works. The only thing is that I’m slightly confused as to why this should be set {Off}, my instinct would have thought this should be the opposite.
Anyway, thanks again.
Chris

  AnyKinEqInterPolDriver Flexion_Left_Hip =                      
  {                     
    CType = {Soft};                     
    Type = Bspline;                     
    BsplineOrder = 4;                     
    FileName = Main.MatlabInputParameters.JAngleFilePath + "\Flexion-LeftHip.txt";                     
    AnyKinMeasureOrg LHipFlexion = {                     
      
      AnyKinRotational HipRot = {                     
        AnyRefNode &ThighNode = Main.HumanModel.BodyModel.Left.Leg.Seg.Thigh.HipJoint.RotNode;                     
        AnyRefNode &PelvisNode = Main.HumanModel.BodyModel.Trunk.SegmentsLumbar.PelvisSeg.HipJointLeft.RotNode;                     
        Type = RotAxesAngles;                     
      };                     
      MeasureOrganizer={0};                           
    };        
    
    Reaction.Type = {Off}; 

  };

Hi Chris,

If the Reaction.Type is On it means that the driver provides an artificial force to move the joint instead of the muscles. So it has to be Off for the muscles to do the work.

Best regards, Sylvain.