AnyGait marker protocol

Have you had a chance to look at the previous question I posted concerning forces at the knee?

Hi,

First, sorry for late reply because Amir will be out of office for several weeks.

Instead, I will try to answer to your questions.

  1. As you pointed out, if we see ‘Jnt.any’ file in LegTD folder, we can find the following code:
AnyRevoluteJoint Knee = {
  Axis = z;
  AnyRefNode &ThighNode = ..Seg.Thigh.KneeJoint;
  AnyRefNode &ShankNode = ..Seg.Shank.KneeJoint;
}; // End of knee

So, the joint reaction force will acting on the second reference frame and its values will be described w.r.t. the first reference frame.
If the joint reaction force values are ‘negative’, then the reaction force is acting from second to first reference frame.

  1. Let’s see the ‘JointReactionForces.any’ file.
  AnyForceMomentMeasure RightKneeForces = 
  {
    AnyForceBase &force =
    Main.AnyBodyGaitAppModel.HumanModel.BodyModel.Right.Leg.Jnt.Knee.Constraints.Reaction;
    AnyRefFrame &knee =
    Main.AnyBodyGaitAppModel.HumanModel.BodyModel.Right.Leg.Jnt.Knee.ThighNode;
  };
  
  AnyVec3 RightKneeForceInShankCoordinateSystem =
  RightKneeForces.F*Main.AnyBodyGaitAppModel.HumanModel.BodyModel.Right.Leg.Seg.Shank.ScalingNode.Axes*MirrorZ;


AnyForceMomentMeasure object can transform any kind of forces and moments at a ‘point of interest’ into global values.
So here, ‘RightKneeForces.F’ and ‘RightKneeForces.M’ value are represented in global. You can see the detail description of AnyForceMomentMeasure class in the reference manual.

In AnyScript, you can use following transformation techniques:
GlobalVector = LocalVector * Axes’;
LocalVector = GlobalVector * Axes;

So you can transform any kind of force vector from global to local and vice versa.

So if you feel confusing about this, I would suggest you to modify this JointReactionForces.any file.
You can transform the reaction force vector from global to any local coordinate system which you want to use.

I hope this may help you.

Best regards,
Moonki

I am getting this error with specific trials again. Earlier Amir suggested changing the
StaticFrameNo = 5 (it was initially =10) in SetupSpecificData.any

However, this does not fix the problem for other c3d files to run.

What can I do?

Hi Brooke,

If it is only specific trials which fails I would look for marker dropout’s, are you sure there is no maker drop out in the datasets which fails. If one maker is missing in the first frame it would give this error.

Best regards
Søren

I am certain there are no markers dropping out.

Hi Brooke,

Attached please find a modified version of ‘AnyGaitSourceCode’ files.

Let me explain what I’ve changed.

  1. In ‘\AnyGaitSourceCode\Model\OptLegModel\KinOptModel’ folder, I had to change ‘Marker.any’ and ‘StickFigure.any’ file to make AnyGait work well with your marker set data.

  2. In ‘\AnyGaitSourceCode\Model\OptLegModel\BaseModel’ folder, I had to change ‘Environment.any’ file.

When you input the force plate data from C3D file using this ‘Environment.any’ file, you have to be careful whether you are using the right names of force components.

ForcePlateType4AutoDetection Plate1 (
PlateName = FP1,
Folder =Main.ModelSetup.DynamicDataSet,
Limb1=  ..HumanModel.BodyModel.Right.Leg.Seg.Foot,
Limb2=  ..HumanModel.BodyModel.Left.Leg.Seg.Foot,
No=0,
VerticalDirection ="Z",
HeightTolerance=0.07,
VelThreshold=2.2,
Fx=Main.ModelSetup.DynamicDataSet.Analog.DataFiltered.[b]FP1_Fx[/b],
Fy=Main.ModelSetup.DynamicDataSet.Analog.DataFiltered.[b]FP1_Fy[/b],
Fz=Main.ModelSetup.DynamicDataSet.Analog.DataFiltered.[b]FP1_Fz[/b],
Mx=Main.ModelSetup.DynamicDataSet.Analog.DataFiltered.[b]FP1_Mx[/b],
My=Main.ModelSetup.DynamicDataSet.Analog.DataFiltered.[b]FP1_My[/b],
Mz=Main.ModelSetup.DynamicDataSet.Analog.DataFiltered.[b]FP1_Mz[/b],
FootPresent=1)
={
  Cal=Main.ModelSetup.DynamicDataSet.Groups.FORCE_PLATFORM.CAL_MATRIX.Data[0];
};

So if your C3D file may have different name of these force components, then you have to modify this Environment.any file.

Please be aware of that this modified version of AnyGait is customized to your marker set.

I hope this may help you.

Best regards,
Moonki

Hi,
I've got a question regarding the AnyMomentMeasure function used above. I understand you multiply the reaction force with local axes to get the forces in the local coordinate system. Therefore, you used the 'Scalingnode' (However, in a very old post I found the joint was used). Therefore my questions:
What is the Scalingnode? I think it has something to do with the JointAnatomicFrame? So what is the difference between 'KneeJoint', 'KneeJointAnatomicFrame' and 'Scalingnode'?
Which one is the correct one to calculate Joint forces in the local axes?
Is it similar for the ankle and hip joint?

thanks in advance!

Peter

Hi Pieter,

You could check Seg.any for the explanation:

KneeJointAnatomicalFrame:
/// This coordinate system is placed based on the bony landmarks of femur.
/// O: Center of the two femural epicondyles
/// Z: A vector going through the lateral and medial femural epicondyle pointing to the right
/// X: The vector perpendicular to Z axis and the long axis of the femur point anteriorly
/// Y: The vector perpendicular to Z and X

HipJointAnatomicalFrame:
/// This coordinate system is placed according the International Society of Biomechanics' (ISB)
  /// recommendations for an anatomical coordinate system for the hip joint in the thigh segment.
  /// See ISB proposal by G. Wu, S. Siegler, P. Allard, C. Kirtley, A. Leardini, D. Rosenbaum, M. Whittle, D. 
  /// D'Lima, L. Cristofolini, H. Witte, O. Schmid, I. Stokes. J. Biomech. 35(4):543-548, 2002
  /// Section 4.4 

The KneeJoint node corresponds to the center of rotation between thigh and tibia, it will be scaled/constructed based on the nonscaled nodes of the generic model. You have a choice between a few options of how it can be constructed. For example, it can be constructed based on the scaled bony landmarks. Please check the code for more information.

ScalingNode is a pointer to the AnatomicalFrame node, which is a special coordinate system, constructed to scale/morph segments and ensure consistency between different datasets used in AnyBody. However, it does not necessarily correspond to ISB recommendations. It will be different for different segments. Example: Shank segment of the Klein Horsman dataset is defined wrt. to the hip joint center, the AnatomicalFrame is a ref. frame with the center in the middle of malleoli defined and the orientation defined by condyles and malleoli.

This means that the following code :

AnyVec3 RightKneeForceInShankCoordinateSystem =
  RightKneeForces.F*Main.AnyBodyGaitAppModel.HumanModel.BodyModel.Right.Leg.Seg.Shank.ScalingNode.Axes*MirrorZ;

will use the orientation only (Axes) of this internal AnatomicalFrame I described in the example to report forces in the knee.

Eventually it is up to you to decide what coordinate system you want your output to be in. There is no right or wrong, but it will depend on your goals. If you plan to publish these values you could use one of the predefined ref. frames, but it is a good idea to explain how this ref. frame was constructed.

Tip: you can use AnyDrawRefFrame object to display these ref. frames to make sure you understand orientation and centers.

Regards,
Pavel

Hello,

I’m trying to adjust the AnyGait (I just downloaded the most recent AMMR a few weeks ago) model to handle a marker set that is not one of the three defaults provided. I attempted to add the markers from my set to the Drivers.any file provided for the AnyGait model, but when I try to load the model with my marker names I receive the error:

ERROR(SCR.PRS9) : //B…C/T…e/S…e/R…y/A…y/Mine/A…t/A…e/M…l/O…l/K…l/Drivers.any(101) : ‘RTTL’ : Unresolved object
Model loading skipped

I’ve attached the C3D files I’m using for reference. NORM00103 is the static trial and the others are various dynamic trials. I was thinking it might be easier to rename the markers in my set to match those in the predefined sets, but we have a different marker set up than those in the default.

Any help with this would be appreciated! I included a fresh version of the AnyGait files because I think all of my tinkering may have edited the code too much.

Sincerely,
Rod

Hello again,

I have AnyBody version 6.0.5 with the most recenter version of the AMMR. When I try to use the Set Task View option in AnyGait I get the following error:

ERROR(SYS1) : Model View Update : Unknown error
Model graph could not be updated.
Attempting to recreate Modelview Scene.

with the following explanation: “An unknown error is an error that is not handled properly by the system or by the module indicated in the message. In other words, this is not supposed to happen. If an unknown error do occur, it could mean that data in memory has been corrupted and unpredictable behavior could be the result. Therefore, it may be necessary to restart AnyBody after such an error. Please contact AnyBody Technology in case of any reproducable Uknown error.”

This prevents the Execute task function from working. However, if I do execute task by itself then the task will complete. Opening a model view while the task is processing will cause the software to freeze and no longer respond. It will not allow me to reload the AnyGait.main file either and the only way to stop the simulation is to close the software and start it over again. I’ve tried redownloading the AMMR to see if I had inadvertently altered the source code, but even the fresh download fails in the same manner.

I have tried closing and opening the software multiple times, and I have also uninstalled and reinstalled my license to try to solve the issue. Any help with this issue would be greatly appreciated as I cannot think of any more solutions at this point.

Thanks!

Rod

Dear Rod,

Sorry for late reply.

For a quick solution, have you ever tried to test our MoCapModel instead of AnyGait?

Best regards,
Moonki

Hi,

Thank you for your reply. Yes, I have been working with the MoCapModel since I posted my question.

I could not adapt the MoCapModel to the marker protocol that I was given so I redid some experiments with the default protocol defined in the lower extremity model.

I would still like to work toward working with the other protocol that I have, but I’m not sure how to adjust the model. I also have some questions about adding ligaments and defining those in the MoCapModel.

I’ve attached my model with the different marker protocol if you would be willing to look at it and offer any suggestions for what to do.

Thank you,
Rodney

Hi Rodney,

sorry for the slow feedback.

I have taken a look at your model and made it run kinematics.

to that i have altered a few files which i have attached.

The changes are:

[ul]

  • in the main file added a statement which is adding a driver on the ankle joint, it is not enough with two makers on foot
  • added an extra pelvis marker bpv two markers are not enough to prevent pelvis from rotating
  • set many of the marker not to be optimized in position, done this for pelvis makers and markers on hip
    *excluded a number of markers which there was no data for
  • in the trialspecific file change the numbers which are removing frames in the start and end, the model will not run on data where markers was out of view.

[/ul]

Best regards
Søren