Cart push pull with C3D file

Hey, AnyBody support,

Based on GaitFullBody model, I imported my own C3D and force plate data and run the model (both kinematics and inverse dynamics analysis) successfully. But I had some problems for running inverse dynamic model:

(1) I know that the Inverse model runs with generated angle output text file from the kinematic model.
But I want the human model can move (push) the cart in the model view, the same as in the kinematic model. I found that the Inverse model can only run when I commented out “Cart” segment in “EnvironmentAutoDetection.any” and the 4 cart markers I created in “ModelSetup.any” files.
Otherwise, there will be 16 unsolvable constraints even the cart markers (4) are not commented out.

(2) I have no idea how to use the analog data of “force platform” in the “EnvironmentAutoDetection.any” because my file does not include the CALMATRIX_DATA.

(3) Is there any place that I can check the reaction force applied between the handle and cart in the output file?

Could you please advise me how to solve the above problems?

Thanks for your doing such a great job for AnyBody community!

Sincerely,

Cathy

Hi Cathy,

Thanks for the kind words!

Here are some answers:

A1: You are right, the inverse analysis runs on the calculated angles from the motion optimization study. You may not be able to just add at the cart in the same way as in the motion optimization study. The inverse dynamic analysis requires does not run the overdetermined kinematics so it will cause it the the problems you have seen if you apply extra kinematics constraints to the model.

The solution is to dump out the position and orientation of the cart in the kinematic analysis and then read this motion into the inverse analysis, this is exactly how is done with the joint angels. Please have a look in the files

JointAngleoutputs.any here the angles are written to files and you add a new one with the cart position.

JointAndDriversOptimized.any here the angles are being used to drive the inverse dynamic model and you could add a driver for the cart.

You will also need to have proper reactions between the cart and the hand, so simply add AnyReacForce to the dof you have active in the kinematic optimization study. This will create the possibility for the model to have a force but it will not add a kinematic constraint.

So if you have the following in the kinematic optimization model:

AnyKinLinear lLin = {
  AnyRefNode &CartNode = Main.Studies.InverseDynamicStudy.EnvironmentModel.Cart.HandleLeft;
  AnyRefNode &HandNode = Main.Studies.InverseDynamicStudy.HumanModel.Left.ShoulderArm.Seg.Hand.PalmJoint;   
  Ref = 0;
};
AnyKinRotational lRot = {
  
  AnyRefNode &CartNode = Main.Studies.InverseDynamicStudy.EnvironmentModel.Cart.HandleLeft;
  AnyRefNode &HandNode = Main.Studies.InverseDynamicStudy.HumanModel.Left.ShoulderArm.Seg.Hand.PalmJoint;   
  Type = RotVector;
  AngVelOnOff = On;
  
};




AnyKinEqSimpleDriver lHandle = {
  AnyKinLinear &LinearMeasure = .lLin;
  AnyKinRotational &RotMeasure = .lRot;
  MeasureOrganizer = {0,2,3,4,5};
  DriverPos = {0,0,0,0,0};
  DriverVel = {0,0,0,0,0};
  Reaction.Type = {On,On,Off,On,Off};
};



Then in the inverse study it should only apply the reaction forces not the motion.

AnyKinLinear lLin = {
  AnyRefNode &CartNode = Main.Studies.InverseDynamicStudy.EnvironmentModel.Cart.HandleLeft;
  AnyRefNode &HandNode = Main.Studies.InverseDynamicStudy.HumanModel.Left.ShoulderArm.Seg.Hand.PalmJoint;   
  Ref = 0;
};
AnyKinRotational lRot = {
  
  AnyRefNode &CartNode = Main.Studies.InverseDynamicStudy.EnvironmentModel.Cart.HandleLeft;
  AnyRefNode &HandNode = Main.Studies.InverseDynamicStudy.HumanModel.Left.ShoulderArm.Seg.Hand.PalmJoint;   
  Type = RotVector;
  AngVelOnOff = On;
  
};

AnyReacForce lHandle = {
  AnyKinLinear &LinearMeasure = .lLin;
  AnyKinRotational &RotMeasure = .lRot;
  MeasureOrganizer = {0,2,4};
};


A2: according to the c3d file in the model you have two forceplates of type2, these do not need a calibration matrices …?
see also http://www.c3d.org/html/type2.htm

A3: If you apply the AnyReacFroces between the hands and the cart you can read out the forces from these.

Best regards
Søren

Hey, Søren,
Thank you for your input!

But I still failed to run the inverse dynamics when I tried your way.
(1) Such warning messages were shown up:
“MeasureOrganizer”: unresolved object, after I typed these scripts:

AnyReacForce lHandle = {
AnyKinLinear &LinearMeasure = .lLin;
AnyKinRotational &RotMeasure = .lRot;
MeasureOrganizer = {0,2,4};
};

(2) I was not sure what cart position or orientation to be dumped out from kinematics; I tried to use rLin,rRot, or Cart.Pos, or Cart.r, all of them were failed, because of the AnyKinMeasureOrg or other problems.
“Trial2-35kg-Push-output-euler-cart.txt” file is already saved.

So, what can I do to deal with the cart part in
JointAngleoutputs.any, and
JointAndDriversOptimized.any?

(3) For the force plate, do I just comment out the force plate part in the EnvironmentAutoDetection.any file? Then change type 4 to type 2 which are included in the ToolBox already? Anything else I need to deal with about the force plates?

//Class used to construct a forceplate of type4 --> changed to type 2?
#include “…/…/…/Body/AAUHuman/ToolBox/Mocap/ForcePlateType4AutoDetection.any”
#include “…/…/…/Body/AAUHuman/ToolBox/Mocap/ForcePlateType4.any”

(4) After the model finished the MotionAndParameterOptimizationModel running, I found that the cart and human body is not like real; the foot was inside the cart or the human stood right side of the cart without attaching the cart.

Could you please suggest me how to deal with these problems?
(Tomorrow I will try to use AnyKinDriverMarker class to simulate this model, not using GaitFullBody model as the basis, although I know it is the best choice.)

Thank you!

Cathy

Hi Cathy,

Here are some answers:

A1: my fault… sorry … AnyReacForce does not allow a measureorganizer…

Please try instead.


AnyKinMeasurOrg mymeasure ={
AnyKinLinear &LinearMeasure = .lLin;
AnyKinRotational &RotMeasure = .lRot;
MeasureOrganizer = {0,2,4}
};

AnyReacForce lHandle = {
AnyKinMeasurOrg &ref=.mymeasure;
};

A2:
You will need to dump out the positon of the linear and rotational measure on the cart.

so something like :




AnyOutputFile OutputFileXX = {
    FileName = Main.ModelSetup.C3DFileData.NameOfFile+"-MyCartPosition.txt";
    SepSign = " ";
    
    AnyVector CartLin= .CartLin.Pos;  //make a reference to the linear measure between cart and global ref
    AnyVector CartLin= .CartRot.Pos;//make a reference to the rotational measure between cart and global ref

  };

similarly in the JointOptimized.any

you need to drive the same two measures with the saved values:

AnyKinEqInterPolDriver JntDriverCart = {
    FileErrorContinueOnOff = On;
    Type = Bspline;
    BsplineOrder = 4;
    FileName = Main.ModelSetup.C3DFileData.NameOfFile+"MyCartPosition.txt";
    AnyKinLinear &ref1=.CartLin;  //make ref to linear measure.. if it does not exist in inverse model, then construct it as in kinematic model
    AnyKinRotatioanl &ref2=.CartRot;//make ref to rotational measure.. if it does not exist in inverse model, then construct it as in kinematic model
    Reaction.Type={Off,Off,Off,Off,Off,Off};
  };

A3: You will need to include the forceplate class that you make use of, so if this is a type two, you should include

#include "../../../Body/AAUHuman/ToolBox/Mocap/ForcePlateType2AutoDetection.any"
#include "../../../Body/AAUHuman/ToolBox/Mocap/ForcePlateType2.any"

also in the environmentautodection.any file you will need to make a similar change.

A4: This sounds as if the connection between the cart and hand is not correct , i looked into the environemtautodection file and it looks ok you have connected the hands and the cart.
While the optimization is running is it connected?

Is it when you are running the inverse analysis that it disconnects?

I would not recommend starting from scratch with AnyKinDriverMarker… then you would need a lot of steps… before you have the model running invers analysis.

Best regards
Søren

Hey, Søren,

Thanks for your great help in a very timely reply!

Q1:
With your suggestion, the force plates data is imported into the EnvironmentAutoDetection.any file and the kinematic constraints can be solved and started to run Inverse now. But the error message is :
“InverseDynamicStudy.InverseDynamics : Muscle recruitment solver : solver aborted due to singular KKT matrix”.

Q2:
Besides this problem, I still have the connection problem between cart and human body. After optimization and beginning Inverse, they are disconnected; while during optimization, some times they are really connected very well. The first several trials they are connected also very well actually.
Is it possible that the Cart’ dimensions are not exactly the same what we are using, because I downloaded the stl file from some library?
I made some changes on the cart scale, and made it running like real in some trials. I thought it should work fine.
I also made the four cart markers x, y, z coordinate (relative position) exactly the same as they are put on the cart.

What else can I do to deal with this problem?

Q3:
The last problem is that: the force plate data recorded the reaction force not only on human’s foot, but also on the Cart.
Will it be possible that the EnvironmentAutoDetection to wrongly detect the Cart’s reaction force as on Human’s foot?

Thanks a lot for your patience in helping me out!

Cathy

Hi Cathy,

I have taken a look at your model and and noticed a few things:

The analysis starts while the cart is on the force plates and the person is standing in front of the plate, this will not work, please adjust tstart so that the first foot is touching the plate.

The cart is located to the side of the human, please rerun the kinemtic optimization using the following settings for the hand cart contact

AnyKinEqSimpleDriver rHandle = {
  AnyKinLinear &LinearMeasure = .rLin;
  AnyKinRotational &RotMeasure = .rRot;
  MeasureOrganizer = {0,1,2,3,4,5};
  DriverPos = {0,0,0,0,0,0};
  DriverVel = {0,0,0,0,0,0};
  Reaction.Type = {On,On,On,Off,On,Off};
};

This will make sure the y direction of the handle is being constrained to meet the hand. (similar for left side)

Since you have no measured forces between the cart and the hands? you will need to have a proper model for the cart, meaning that its mass properties boundary conditions has to be correct.
So the cart need to have linear reactions at both wheels acting normal to the ground, and it need to have a mass located at the correct position. Please note that the CoM can be altered on a segment.

I hope this answers your questions otherwise please write again.

Best regards
Søren

Hey, Søren,

Your suggestion helped me a great!

(1) In the file of: #include “EnvironmentAutoDetection.any”
I created a cart(load) and two wheels by myself, which will make it easier to control the dimensions. I still found that if I put {0,1,2,4} or {1,2} reaction.type = On, the foot will still be trapped under the cart after optimization. Then I have to try other combination of the measure organizers (on or off) to make the cart and human body look real, right? Is there an easy way? I guess the On type forces on {0} (x axis) should push cart “away” the body, however, it seems that it is pulling the cart toward the body closer and closer actually.

(2) the problem is about: InverseDynamicStudy
#include “JointAngleOutputs.any”
#include “JointsAndDriversOptimized.any”

I created two revolute joints between right or left wheel and the cartload, a linear measure between cart and globalref goundnode. I tried many ways to dump out the positions for the cart or wheels, the Inverse study still finally cannot solve the constraints, inter-determinate or over-constrained.

The two problems are very difficult for me to figure out. Could you please help me out?

Thank you so much!

Cathy

Hi Cathy,

I have done some modification to your model…

[ol]
[li]Extradrivers.any: added drivers for ankle eversion/inversion so that these are fixed to zero deg… there is not enough markers on the forefoot to have this dof free
[/li]
[li]EnvironmentAutodection.any multiple changes please search for st_abt to see them.
[/li][ul]
[li]Change GlobalRef origin to be at 0,0,0… it is not recommended to chanege this…
[/li][li]Removed the wheel segments to simply model
[/li][li]Added reaction forces in vertical directions between the wheels joint node on the cart and globalRef
[/li][li]Changed the direction of the force from Y to Z in the forceplate definitions!
[/li][li]Removed the drivers between hand and cart… they are not needed since the cart and hand both have markers, there is still an anyreacforce to take the load…
[/li][/ul]

[li]Created a new file named EnvironmentAutodection.any which is used by the inversedynamic model. The file is very much the same as in EnvironmentAutodection.any but the drivers between hand and cart has been removed.
[/li]
[li]ModelSetup.any
[/li][ul]
[li]fixed markers in cart to have a fixed position… you can not have all of them free it will just rotate the entire cart segment… i have fixed all of them not … it might be possible to release a few of the dof.
[/li][li]for the Rank and LANk makers i fixed them not to be allowed to move while optimizing.
[/li][li]fixed the tstart and tend values to be taken from trialspecific… you have two different values
[/li][/ul]

[li]GaitFullbodyModel.main.any
[/li][ul]
[li]Include the EnvironmentautodectionInverse.any file in the inverse dynamic analysis
[/li][/ul]

[/ol]

I have tested that kinematics runs in both models, i have not look at the forces …

Best regards
Søren

Hey Søren,

Thanks for your taking time and effort helping me out. Much appreciated for your swift response and great work! I really cannot thank you enough!

I just wanted to compare push and pull output. But I still met problems during the optimization. I guess it might me the marker optimization on or off choices and adding or not extra markers. No matter I tried different ways to optimize some markers or not, or to add some more hard constraints in extra drivers file. Maybe I did not get into the point.

Could you please give me a hint?

All of the ERROR messages are about both right and left shoulder arms, which is shown in the attached text document file “1109 Pull - Error Message”.

Thanks again for your effort!

Cathy

Hi Cathy,

I think the problem you have found here is not your fault, but a known issue with the model, that will be fixed in the next release.

Please have a look at this thread for description and a solution to the problem.

http://forum.anyscript.org/showthread.php?t=2584

Best regards
Søren

Hey Søren,

Thank you!
The problem is solved after I replaced the files. Just sometimes I will need to increase the SPLine values when the Inverse study fails. :slight_smile:

Best regards,

Cathy

Hi Dear AnyBody Support,

First, thanks for your help for debugging the model for my pilot study.

Now we plan to mount two transducers between hands and the cart handle, to measure the six components of the hand forces/torques.
As for the model, can you help me answer the following questions so that I can plan ahead to modify the model?

(1) Since we will measure the real hand forces/torques at the hand-cart interface, we will use “AnyFoce3D” and “AnyMomen3D” with “AnyFunInterpol” driver of the measured hand forces/torques text files.

In the meantime, is it correct to remove/comment out the “AnyReacForce” for the right/left wheel vertical forces and right/left handcart forces, based on the current model shown in this thread?

(2) Since we will apply the hand forces/torques directly to the hands(nodes), the Jii (inertial moment: Ixx, Iyy, Izz) of the cart/load will not have any effect on the joint loading output, right? Do I have to compute the Jii accurately to match the real situation?

(3) The current cart pushing/pulling model is along a flat walkway. We will collect data on two ramps recently. So we will specify the two force plates’ XYZ position and orientation in Vicon accordingly.
Since the “EnvironmentAutoDetection” can automatically detect the locations of force plates from C3D data file, I guess I don’t need to specify anything for the force plates, right?

Please advise,

Thank you so much!
Sincerely,
Cathy

Hi Cathy,

Yes you should remove the AnyReacForce on the right/left hands, but keep one on the cart (on the 6 dof).

Yes again, the Jii of the cart is not important in this case.

And yes again, the force plates will be placed automatically. You just have to define he usual settings (name of plate, name of channels, etc).

Best regards, Sylvain.

Dear Support,

We are going to submit our paper for publication now. But we are a bit worried about the model output. Can you please help us check/run the attached model and also check the output for three shoulder joints loading - joint reaction forces acting at right sternoclavicular, right acromioclavicular, and right glenohumeral joint in three directions: ML/DIS, AP, and PD/IS?

Our questions are:

  1. why model is showing high ML loading ?
  2. why such a high loading for AC joint?

Please help us, because we will be more confident in submitting this paper with your generous help!

Thank you very much!


The attached is the model files for my cart push model. The first zipped folder include the model files for Gradient = 0, 5,
10 degrees, Weight = 20 kg, Push.The second one is for Gradient = 0, 5, 10 degrees, Weight = 30 kg, Push.The third one is for Gradient = 0, 5, 10 degrees, Weight = 40 kg, Push.

The other attached file is our statistical results for 12 subjects pushing the cart along walkways with three gradients under three weight conditions.

Cathy

Hi,

I looked and run your model, and thought about your two questions. The ML forces and the loading in the AC joint do not seem very strange to me. Do you have any values to compare to? Why did you expect lower values?

Two more things:

  • the skull looks very large in the model. This will not affect lower back nor shoulder, but you could try to change that for visualization.
  • please be aware that the auto-detect for the force plates (environment) can probably not handle the inclination and might not use the correct loads from the force plates. However, this affects only the lower extremities!