AnyKinEqFourierDriver: Sinus driver Modification

Hello everybody

For my model I want to drive a joint in a “realistic” way, meaning inital velocity of 0, smooth acceleration phase, maximum velocity in mid phase, smooth deceleration phase to final velocity of 0.
To implement this in an easy way my first idea was to use AnyKinEqFourierDriver with a Sin function like that:

AnyKinEqFourierDriver SinDriver = {
AnyRevoluteJoint &Jnt = Main.ModelDef.Jnts.Shoulder;
Type = Sin;
Freq = 1.0/2;
A = { {0.0, 1} };
B = { {0.0, -3.14/2 } };

  Reaction.Type = {Off};
};

The results can be find attached as “sinus driver_current”

Everything looks great, but the inital starting point. As you can see on the plot (and as expected), the motion is starting from -1 instead of 0.
Thus, is there a way to shift the sin function in y-direction? How could i implement it in Anybody (e.g. using differnent driver class).
Attached you will find an image of the desired motion task profile.

Looking forward to your answers!

regards
Tobi

Hi Topi,

There might be more elegant ways to this by using the Fourier in another way, my solution below is making use of the a linear combination measure which simply add an offset of 1.


Main ={
  
  
  
  AnyFolder model ={
    
    AnyFixedRefFrame GlobalRef ={  };
    
    AnySeg  Mass ={
      Mass=10;
      Jii={0,0,0};
      AnyDrawRefFrame drw ={};
    };
    
    AnyRevoluteJoint jnt ={
      AnyFixedRefFrame GlobalRef ={  };
      AnySeg &ref2=.Mass;
      Axis=z;
    };
    
    AnyKinEqFourierDriver SinDriver = {
      AnyRevoluteJoint &Jnt = .AddOffset ;
      Type = Sin;
      Freq = 1.0/2;
      A = { {0, 1} };
      B = { {0.0, -3.14/2 } };
      
      Reaction.Type = {Off};
    };
    
    AnyKinMeasureLinComb  AddOffset ={
      AnyRevoluteJoint &Jnt = .jnt;
      Coef ={{1}};
      Const={-1};
      OutDim=1;
    };
  };
  
  AnyBodyStudy study={
    AnyFolder &ref=.model;
    Gravity ={0,0,0};
  };
};

Please have a look, i think it does what you need…

Best regards
Søren

Hey Søren,

thanks a lot! It is working perfectly!

Best regards
Tobi