I need more information about the AnyForceMomentMeasure2. It is a complicated function and we can think that our measure is correct while it is not. Seeing this function as a free body diagram (FBD) helps to understand it, but only partially from my point of view.

Take one of the gait models for example. I want to find the contribution of the vastus lateralis to the knee forces and moments around the knee joint, taking the shank KneeJoint reference node as the point of interest. Does the following measure is correct :

AnySeg &seg1=..Side.Leg.Seg.Patella; // Segment on which the muscles of interest have their common insertion
AnyVec3 FLocal = F*.ShankRef.Axes;
AnyVec3 MLocal = M*.ShankRef.Axes;

};

Here, I did not included the thigh segment, because I assume that the segment from where the muscle comes from is not needed in the FBD.

Regardless of the point of interest, does the FBD has to include all the segments between the origin and insertion of the muscle(s) of interest, excluding the origin segment if it is not the point of interest ?

As we can see here, to calculate the knee net moment by only muscles, this code only considers the downward directions from the knee joint( shank, foot, talus) so this code does not consider thigh.

I understand but I’m still unsure about the correct way to use that kind of measure. Is there another way to measure the contribution of a muscle to the knee joint moments ?

I did a really simple model to understand how to apply a AnyForceMomentMeasure2. This simple model (attached file) is based on your 2D shoulder model. However, the rotation is kept to 0 degree and the segment is at equilibrium in the vertical direction.

The active forces in that model are the mass of the segment and an external force applied at the elbow node {0,0,-0.4}m of 10 N.

Now if you run the model and look at the reaction forces and moments at the joint, you will find :

Fx = 0 N
Fy = 10 N
Fz = 19.62 N (ie. 2 kg segment mass * 9.81 m/s^2)

There are two other measures. I guess that these measures are respectively the moment in the X and Z direction, because the Y rotation is the only DOF.

The moment around the X-axis should be 4 Nm (0.4m10N) and the moment around the Z axis should be null. However, this is not what I obtain (Mx = Mz = 5.66 N*m).

I think you could use AnyForceMomentMeasure2 well.
When we see the Mlocal value which you defined, then it gives the same value which you could guess.

The reason why the reaction moments in the AnyRevoluteJoint are different from the value from AnyForceMomentMeasure2 is that the AnyKinRotational object type in an AnyRevoluteJoint is ‘PlanarAngles’.
As we know, the value of reactions will depends on which type of kinematics measures were used with those reactions.
So in this case it is natural to see the difference.
And I would say that you can believe the values from AnyForceMomentMeasure2 class. If the AnyKinRotational object in the AnyRevoluteJoint was in type of RotAxesAngles, then the reaction moment values from the AnyRevolueJoint would have been as same as the values from the AnyForceMomentMeasure2.

From the AnyBody version 6, each joint has an folder which is called ‘RefFrameOutput’ inside. In that folder you can see the F and M values in the global coordinate systems. This may be helpful to you.