External Force not changing during inverse dynamics


I am running a model using BVH as kinematic input and measured load cells as kinetics (external force). I have gone through previous posts and I saw that the recommendation is for people to reference the external force in the Inverse Dynamic Study. I have done likewise but then when running the simulation, my Flocal still same as the first value in my text file. Can you check the attached code to see what I am doing wrong?

 Main.EnvironmentModel = {
   AnyFolder ModelExternalForce = {
      AnyFunInterpol ForceFun = {
        FileName = "C:\Users\Coal Miners\Documents\AnyBody Projects\Dissertation Main\load-cell-files\" + Main.ModelSetup.TrialSpecificData.TrialFileName + ".csv";
        //Data = .Fx;
        //T = Main.EnvironmentModel.ModelExternalForce.FileName.T;
        Type = PiecewiseLinear;
      AnyForce3D MyHandForce = {
        //AnyVector Fx = Main.EnvironmentModel.ModelExternalForce.ForceFun(Main.Studies.InverseDynamicStudy.t)[0];
        Flocal = Main.EnvironmentModel.ModelExternalForce.ForceFun(Main.Studies.InverseDynamicStudy.t);
        //F = {-15,-15,-15};
        AnyRefFrame &AttahForce1 = Main.HumanModel.BodyModel.Right.ShoulderArm.Seg.Hand;
        viewForce ={
                ShowComponentForces = On;
                ShowTotalForces = On;
                AppliedForceColor = {0.3, 0.8, 0.3};
                 AnyDrawVector DrawForce = {
           Vec = Main.EnvironmentModel.ModelExternalForce.MyHandForce.Flocal *-1/100;
           Line = {
           Style = Line3DStyleFull; 
           Thickness = 0.01; 
           RGB = {0,1,0}; 
           End = {
             Style = Line3DCapStyleArrow;
             RGB = {0,1,0};
             Thickness = 0.02; 
             Length = 0.04;
         AnyRefFrame &ref = Main.HumanModel.BodyModel.Right.ShoulderArm.Seg.Hand;
        viewForce.Visible = On;

 Main.Studies.InverseDynamicStudy = {
   AnyFolder &handforce = Main.EnvironmentModel.ModelExternalForce;

I will appreciate it if you can attend to this as soon as you can.

Thank you.

Hi Aanu,

Your code looks ok. I just tested this code with some invented data and it works as expected.

Can you please check the values of Data and T in ForceFun? They should normally be of this format:

T = {1.5,2,2.5,3,3.5};
Data = {
          {1,0.5,0,0,0}, // values Fx
          {0,0,1,1,0}, // values Fy
          {0,0,0,0.5,1}  // values Fz

Can you also double check if the tStart and tEnd of the study corresponds to a time interval in the force function where you expect some changes in the force? It may be the case that the study time interval is cropped and does not correspond to the relevant interval in the force function.

If nothing works, would it possible for you to share an extract of the input file for the ForceFun?

Best regards,

Hello Divyaksh,

I managed to resolve the error.

For anyone with the same issue in the future, the key is to ensure that the first row in your force data is time, not frame, i.e., divide your frames by frequency. It might sound like a rookie mistake, but who knows :slight_smile:

1 Like

This topic was automatically closed 125 days after the last reply. New replies are no longer allowed.