I have a a few questions regarding the center of mass of the human body model and center of pressure. I am currently using the AMMR.v2.4.2 version.
I am interested in exporting the center of mass displacement, velocity and acceleration. I am currently using the Pos, Vel and Acc values from the CenterOfMass folder and I am wondeing if this is the correct approach. For example: Center of Mass displacement in x,y & z directions:
I would like to create a line between the Center of Mass of the whole body and center of pressure (each force plate separately). Then, to calculate the angle between this line and the vertical line/axis at different planes during the dynamic trial. This can be explained in the picture attached below for the coronal and sagittal plane. Could you please help me with this problem? I would be glad if you kindly help me with this.
Your approach for Center of mass (CoM) is ok. Your approach for center of pressure (CoP) will export the coordinates in the local reference system of the force plate. You may want to convert that into the global system (I have shared the code below).
Please see the code below. The code creates a line from the CoP to CoM, and evaluates the angles in the sagittal and frontal plane. You would need to include the code inside your inverse dynamics analysis study as otherwise the variables used in the code will not be evaluated.
AnyDrawLine line = {
AnyRefFrame &ref = Main.EnvironmentModel.GlobalRef;
p0 = Main.HumanModel.BodyModel.Interface.CenterOfMass.Pos *
Main.EnvironmentModel.ForcePlates.Plate1.CenterOfPressure.OnOff;
p1 = CoPGlobal;
Line.Thickness = 0.01;
Line.RGB = {1, 0, 0}; // Red line
AnyFloat CoPLocal = {Main.EnvironmentModel.ForcePlates.Plate1.CenterOfPressure.Vx,
Main.EnvironmentModel.ForcePlates.Plate1.CenterOfPressure.Vy,
0};
AnyFloat CoPGlobal = CoPLocal *
Main.EnvironmentModel.ForcePlates.Plate1.ForcePlate.ForcePlateSeg.PlateSurface.Axes' +
Main.EnvironmentModel.ForcePlates.Plate1.ForcePlate.ForcePlateSeg.PlateSurface.r *
Main.EnvironmentModel.ForcePlates.Plate1.CenterOfPressure.OnOff;
// This calculates the angles in the sagittal and frontal plane.
AnyFloat CoMtoCoP1 = Main.HumanModel.BodyModel.Interface.CenterOfMass.Pos-CoPGlobal;
AnyVar AngleSagittal =90 - atan2(CoMtoCoP1[1], CoMtoCoP1[0])*180/pi; // atan2(Y, X)
AnyVar AngleFrontal = atan2(CoMtoCoP1[1], CoMtoCoP1[2])*180/pi - 90; // atan2(Y, Z)
};
This code works in the Plug-in-gait_Simple model in the AMMR. You may need to adjust the code, especially the calculation of the angles, for the coordinate system of your lab and the direction of motion of the subject.
Thanks very much, Dave. This worked fine. I will adjust the code to calculate the correct angle based on my lab coordinate system and direction of the motion. Have a nice day!