External Forces in 3 dimensions

A bvh file of a person walking was imported in AMS and using AnyForce3D class force was applied locally to the ankle joint for four different cases

  1. Along the three axes Flocal = {-10.0, -20.0, -30.0}
  2. Only in the x axisFlocal = {-10.0, 0.0, 0.0}
  3. Only in the y axisFlocal = {0.0, -10.0, 0}
  4. Only in the z axis Flocal = {0.0, 0.0, -10.0}

The ankle proximodistal joint reaction force for all the four cases showed the same values after inverse dynamics simulation. The code has been attached below.

  1. Why is joint reaction force same in all the four cases?
  2. Should the force be applied globally or locally?
  3. Is there any other way to apply force to a particular joint along all three axes simultaneously?

Code:
AnyForce3D AnkleForce =
{
AnyFunInterpol force = {
Type = PiecewiseLinear;
T = {1.57,1.58,1.60,1.62,1.63 … }; more data in the form of array
Data ={{0, -62.49746,-26.90144,6.292313,40.76276, } }; more data in the form of array
};

 // Flocal = {-10.0, -20.0, -30.0};

// Flocal = {-10.0, 0.0, 0.0};
// Flocal = {0.0, -10.0, 0};
// Flocal = {0.0, 0.0, -10.0};

  AnyRefFrame &Jnt =Main.HumanModel.BodyModel.Right.Leg.Jnt.Ankle.FootNode;
};

Hi @NAGA_S and welcome to the forum!

The most likely reason is that you did not include the force in your study.
The study only uses objects which are included - this allows you to have multiple studies that only uses a subset of the objects defined in the model.
For instance you could have 4 studies with their own AnkleForce and then run all studies without having to reload.

If you have defined your force outside the study with no reference to it from the study - then the simulation does not know about it.

What you want to do is to make a reference to it like so:

AnyForce3D &ankleForce = Path.to.the.force;

this line you modify with the correct path to the ankle force and put the line inside your study.

Here is our tutorial on these concepts: 2. Getting started: AnyScript Programming — AnyBody Tutorials v7.4.0

It is up to you to decide if the force is applied in the global coordinate system or the local of the FootNode.

I noticed that you have created a interpolation function inside you AnyForce3D but you are not calling that interpolation function. If you want to have the force value change over time by using the interpol function then you should have something like Flocal = {force(.t),0,0};
If you Data and Time vectors match the study number of frames you can also load the force data from a file directly.

Best regards,
Bjørn

Hi Bjørn,
Thanks for your quick reply. There are some more issues with the code. The full code has been attached below. The force applied are already in the study. I tried calling the Interpolation function inside the flocal as you had mentioned, but error message keeps coming.

Main program

#include "../../../libdef.any"
#path MOCAP_LAB_SPECIFIC_DATA "../../../LabSpecificData.any"
#path MOCAP_SUBJECT_SPECIFIC_DATA "../SubjectSpecificData.any"
#path MOCAP_TRIAL_SPECIFIC_DATA "TrialSpecificData.any"
#include "<ANYMOCAP_MODEL>"

Main={
Studies.InverseDynamicStudy =

{
AnyFolder External_Forces = {
#include "External Forces_15Kg.any"
};
};
};

External Forces_15Kg.any
AnyFolder Exo_Forces = {

//-----------------External force on ankle--------------------------------
AnyForce3D AnkleForce =
{
AnyFunInterpol force = {
Type = PiecewiseLinear;
// T= {1.57,1.58,1.60,1.62}; more data in the form of array
// Data ={{0, -62.4974600000000,-26.9014400000000,6.29231300000000}; more data in the form of array
// };
T= 1.57;
Data =0;
};

	// F = {0.0, 0.0, 0.0};
	Flocal = {force(.t),0,0};
 					
  AnyRefFrame &Jnt =Main.HumanModel.BodyModel.Right.Leg.Jnt.Ankle.FootNode;
};

};

This is the error message
ERROR(SCR.PRS9) : External Forces 15Kg.any(33) : 't' : Unresolved object
Model loading skipped

Hi @NAGA_S

Yes, you need to modify the path to the .t variable. It is inside your study. Probably something like Main.Studies.InverseDynamicStudy.t

Best regards,
Bjørn

Thanks Bjørn it worked...

A node is created on the forehead and force is applied locally using class AnyForce3D. But the force is not acting along the required axis of the node.
How to align the force created using AnyForce3D with the axis of a new node created?

The code is attached below.
Main.HumanModel.BodyModel.Trunk.SegmentsThorax.SkullSeg ={
AnyRefNode ForeHead =
{
sRel ={0.11,0.05,0};

};

};
AnyForce3D FH =
{
Flocal = {-100.0, 0.0, 0.0};
// F = {0.0, 0.0, -100.0};
AnyRefFrame &k1 = Main.HumanModel.BodyModel.Trunk.SegmentsThorax.SkullSeg.ForeHead;
};

Thanks

Hi @NAGA_S,

Try displaying these reference frame and load vector - they should align. I don't see problems with the code. What is this statement, "but the force is not acting along the required axis of the node.", based on? Maybe the problem is on how you check it.

Kind regards,
Pavel

Hi Pavel,
The reference axis and the line of action of force are displayed in the above message. The statement, "but the force is not acting along the required axis of the node.", intended to mean the following. How to ensure that the force acted along the X-axis or Y axis or Z axis of the local reference node created at all instances of time.
Kind regards
Naga

Everything works like it should on my end.

    Main.HumanModel.BodyModel.Trunk.SegmentsThorax.SkullSeg ={
      AnyRefNode ForeHead =
      {
        sRel ={0.11,0.05,0};
        AnyDrawRefFrame fr = {ScaleXYZ={1,1,1}*0.1;};
      };
      AnyForce3D FH =
      {
        Flocal = {-10.0, 0.0, 0.0};
        // F = {0.0, 0.0, -100.0};
        AnyRefFrame &k1 = Main.HumanModel.BodyModel.Trunk.SegmentsThorax.SkullSeg.ForeHead;
        viewForce.Visible = On;
      };
    };

image

Your drawing code must have a problem, same as your previous evaluation.

Kind regards,
Pavel

Thanks Pavel for the inputs.
There is another small issue that I am facing with the AnyMoment3D. Kindly help.
A node was created and moment is applied on the node using class AnyMoment3D. The external moment as a file is given using class AnyInputFile.
image
(Sample of the input data)
This is the error message which comes.

  1. Is this the correct format of giving the external input data?
  2. How to call the input file into AnyMoment3D?

The CODE is given below

AnyMoment3D HipM1 =
{
AnyInputFile moment =
{
FileName = "HIPMOMENT.csv";

  };
Mlocal=moment(Main.Studies.InverseDynamicStudy.HipExoM1.t); 
AnyRefFrame &k3 =  Main.HumanModel.BodyModel.Right.Leg.Seg.Thigh.HipJoint.HipNode;

};

Thanks in advance.

Hi,

Check our ref. manual for AnyFunInterpol (you will find a link to a ClassExample file, showing how to use it). AnyInputFile is just a class allowing to read the data in, without constructing interpolation function.

Regards,
Pavel

Thanks @pgalibarov .