Modify AnyForce timing

Hi Anybody,

This is an AnyForce class that applies force to the target segments. How can I change this so it only applies force, for example, from frames 50 to 100 and would be zero before and after this duration?

AnyForce LateralBand_R = {
AnyKinPLine ExoBandFront ={
AnyRefNode &Ori = Main.HumanModel.BodyModel.Trunk.SegmentsLumbar.PelvisSeg.ExotendonOrigin_R;
AnyRefNode &Ins = Main.HumanModel.BodyModel.Right.Leg.Seg.Thigh.ExotendonInsertion_R;
AnyDrawPLine Draw = {
Opacity = 1;
Thickness = 0.02;
RGB = {0, 0.9, 1};
};
};

AnyFloat A = -782.82;
AnyFloat B = 22666;
AnyFloat C = -141966;
AnyFloat D = 254502;
AnyVar L11 = vnorm (Main.ModelSetup.C3DFileData.Points.Markers.FR1.PosInterpol(t) - Main.ModelSetup.C3DFileData.Points.Markers.FR2.PosInterpol(t));

AnyFunPolynomial Force = {
PolyCoef = {.A, .B, .C, .D};
};

F = -{Force(L11)};
};

Hi Behnaz,

Welcome to the AnyScript forum!

You can do this using the AnyFunSquareWave class. Please see the reference manual for more details. Essentially, you will generate a square wave using time as an input and multiply this signal to the force value. Please note you will need to convert your frame values to time values. Here is how you can do it (I have skipped the initial part of your code but you must have that):

...
AnyFunPolynomial Force = {
PolyCoef = {.A, .B, .C, .D};
};
AnyFunSquareWave SqWave = {
  InitialValues = {0.0};
  Ts = {50,100}/FreqMocap; // convert frames to time by dividing with mocap frequency.
  Values = {{1.0,0.0}};
  dT = {0.1,0.1};
};
F = -{SqWave(t)[0]*Force(L11)};
};

Best regards,
Dave

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