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.