Vector line from COM to COP in fullbody main

Hello
I have been trying to get some vector lines to be drawn for my musculoskeletal models running on ballet movements. The idea is to get a visible vector line from COP to COM. I have created a dummy segment with zero mass in the center and connected it to the COM of the body. So now the dummy seg ball will follow the position of the Center of mass of the body model. I also figured a way to get a straight line from the dummy seg to the ground. But now my main concern is to get a vector line from COP to this dummy seg (COM). I am using AnyKinPLine to connect two reference frames to get a vector line. The problem is i have connected the dummy seg reference frame to the MLine. But there is no reference frame for the COP ball on the force plates.


The Blue line is the COP line from the COP ball which is the ground reaction force (green). I want a vector from COP (green) to COM ball (red)

AnyKinPLine MLine = {
AnyRefFrame &r0 = Main.HumanModel.BodyModel.Interface.dummyseg ; %COM dummy seg
AnyRefFrame &r1 = Main.EnvironmentModel.ForcePlates.Plate2.ForcePlate.ForcePlateSeg; % This line needs to be changed

     AnyDrawPLine drw = {
    Thickness = 0.01;
    RGB = {0,1,0};
  };

};

My COM ball with dummy seg attached to it.
The COM calculated from AnyKinKom as given in the fullbodymain template. The below code is for COM ball i created which is working fine.

AnyFolder Interface = {
AnyKinCoM CenterOfMass = {

      #if  BM_ARM_RIGHT
      AnyFolder &RightArmSeg = ..Right.ShoulderArm.Seg;
      #endif
      #if  BM_ARM_LEFT
      AnyFolder &LeftArmSeg = ..Left.ShoulderArm.Seg;
      #endif
      #if BM_LEG_RIGHT
      AnyFolder &RightLegSeg = ..Right.Leg.Seg;
      #endif          
      #if BM_LEG_LEFT
      AnyFolder &LeftLegSeg = ..Left.Leg.Seg;
      #endif
      AnyFolder &TrunkSegmentsLumbar = ..Trunk.SegmentsLumbar;
      AnyFolder &TrunkSegmentsThorax = ..Trunk.SegmentsThorax;
      AnyFolder &TrunkSegmentsCervicalSpine = ..Trunk.SegmentsCervicalSpine;
    };  

     //  Global Reference Frame
AnyFixedRefFrame GlobalRef = {
 // AnyDrawRefFrame drw={Origin={0,0,0};
AnyDrawRefFrame drw={ScaleXYZ=0.1*{1,1,1};};

};
//};

AnyDrawSphere Sphere ={
RGB={1,0,0};
Position = Main.HumanModel.BodyModel.Interface.CenterOfMass.Pos;
ScaleXYZ={1,1,1}*0.05;
};
AnySeg dummyseg={
Mass=0;
Jii={0,0,0};
AnyDrawNode drw={ ScaleXYZ={1,1,1}*0.02; RGB={0,1,1};};
};

AnyKinEq rotcon ={
  AnyKinRotational rot={
    AnyFixedRefFrame &ref1=..GlobalRef;
    AnySeg &ref2=..dummyseg;
    Type=RotAxesAngles;
  };
};


AnyKinLinear lin={
  AnyFixedRefFrame &ref1=.GlobalRef;
  AnySeg &ref2=.dummyseg;
};

//This will drive the massmeasure and the lin measure to be identical
//which will ensure that the pos of the dummy seg is positioned at the CoM
AnyKinEq Driver ={
       
  AnyKinMeasureLinComb lincomb={
    AnyKinLinear &ref1 = ..lin;
    AnyKinCoM &ref2 = ..CenterOfMass;
    
    OutDim = 3;

    Coef={{1,0,0,-1,0,0},{0,1,0,0,-1,0},{0,0,1,0,0,-1}}; //lin(x,y,z) = massmeasure(x,y,z) };
  };
  

  
};

};

Now i want to create a similar kind of dummy seg to follow the COP ball (green) in the body model. So i could connect them using AnyKinPLine thus making a vector line. the below code is for COP:

         AnySeg dummyseg2={
          Mass=0;
          Jii={0,0,0};
          AnyDrawNode drw={ ScaleXYZ={1,1,1}*0.02; RGB={0,1,1};};
        };
        
    AnyKinEq rotcon ={
  AnyKinRotational rot={
    AnyFixedRefFrame &ref1= Main.EnvironmentModel.GlobalRef;
   AnySeg &ref2=..dummyseg2;
  Type=RotAxesAngles;
 };
};


AnyKinLinear lin={
 //AnyFixedRefFrame &ref1=.GlobalRef;
 AnyRefFrame& ref_ForcePlate = ..ForcePlate.ForcePlateSeg.PlateSurface;
  AnySeg &ref2=.dummyseg2;
};

%Need Help here, HOW to connect
%dummyseg2 to COP ball

 AnyRefFrame& ref_ForcePlate = .ForcePlate.ForcePlateSeg.PlateSurface;
 ref_ForcePlate  = 
 {
    AnyDrawSphere COP_ball = 
    {
        RGB = {0,1,0};
        ScaleXYZ = 0.015 *{1,1,1};
        //Opacity = iffun(gtfun(..fz, -10.0), 0.0, 1.0);
        Opacity = ..OnOff;
       Position = {..Vx, ..Vy, ..Vz};
       // Position = {0, 0, 0};

    };

Now I want the dummyseg2 to be positioned at the COP. I want to do the same way as the AnyKinMeasureLinComb as done for COM. or connect the position of the COP ball with dummyseg2.
If somebody can help me it would be great.

Hi Bharathhs,

Sorry for the slow feedback, accidentally this message was overlooked.

If the task is to create a line between CoM and CoP, there is no need to create the CoP as a segment. Instead you can use AnyDrawVector object it takes two points as input, and here you can use "dummyseg.r " as one of the points and the CoP point as the other point (it is possible you might to transform this point into a global system i am not sure)

Best regards
Søren

yes you are right. I want to make a vector line between COP ball and COM ball. I dont understand how to make a reference frame in the COP ball. I am using Fullbodymain.any under mocap examples. This is where I need your guidance.

Attached my forceplateautodetection.any file. ForcePlateAutoDetection.any (23.6 KB)

Hi Bharathhs,

You do not need to have a reference frame if you use the AnyDrawVector object, it simply takes two vectors as input, so you do not need to create a segment in CoP.

Best regards
Søren

could you send me how to fix the vector for COP. There is no vector here. The COP line is drawn from AnydrawLine with its own Po and P1 values . and the class template for AnyDrawVector takes reference frame as input.

Hi Bharathhs,

You can use either AnyDrawLine or AnyDrawVector it will eventually be the same. In both cases you will need a reference frame, but you can create a fixed reference frame inside the class using the AnyFixedRefFrame object.

Best regards
Søren


thank you so much for your support, with some help from others and your instructions I finally got the vectors to work.
I am very happy.
thank you so much.

1 Like

Hello
I successfully presented my master thesis in musculoskeletal modeling of ballet using the AnyBody Modeling System. I would like to thank the forum and the members at AnyBody technology for making this happen, I have received great suggestions and remarks and lots of help with musculoskeletal modeling from this forum. I would surely recommend this platform to people working with AnyBody Software.
I would like to thank @toerholm @pgalibarov @Bjorn for considering my questions and giving me meaningful suggestions.

3 Likes

Hi Bharathhs,

Congratulations and thanks for the feedback, if your thesis is online somewhere please share a link :wink:

Best regards
Søren

1 Like

Congratulations on the thesis!

1 Like

yes, I will share the link soon. I am asking for permission from my university.

This is the link to my thesis work: http://urn.kb.se/resolve?urn=urn:nbn:se:liu:diva-171924
thank you

1 Like

This topic was automatically closed 125 days after the last reply. New replies are no longer allowed.