Problem with Oscillating movement?

Hello,

I'm trying to make an oscillating movement in Hinge13, but I'm confused somewhere. Is it possible for you to help with advice? If necessary, I can send all the files by email.
Thank you in advance!

AnyFolder MachineOperation =

{
AnyVar T_period = 1.0; // Period of oscillation in seconds
AnyVar amplitude = 10.0; // Amplitude in degrees (±10°)
AnyVar phase_offset = 0.0; // Phase offset in radians

AnyKinEqSimpleDriver Rotation_Drv =
{
AnyRevoluteJoint& jnt = Main.Model.Assem1.Mates.Hinge13;

DriverPos ={ ( ( ( pi / 180.0 ) * .amplitude ) * sin( ( ( ( ( 2.0 * pi ) * t ) / .T_period ) + ( ( ( 2.0 * pi ) * .phase_offset ) / .T_period ) ) ) ) };
DriverVel = { ( ( ( ( pi / 180.0 ) * .amplitude ) * ( ( 2.0 * pi ) / .T_period ) ) * cos( ( ( ( ( 2.0 * pi ) * t ) / .T_period ) + ( ( ( 2.0 * pi ) * .phase_offset ) / .T_period ) ) ) ) };

Reaction.Type = {Off};
};
};

Dear Georgi,

There is already a Fourier function implemented in AnyBody that you can use to easily create oscillating movements.

To use it, you just need to include the class template to your main file. The file is located in the Tools\ModelUtilities\Drivers, and you can include it like this:

#include "<ANYBODY_PATH_MODELUTILS>/Drivers/Fourier.any"

For an example of how to use the Fourier function, you can refer to the thoracic.any file in the Examples folder.

SimpleFourierDriver Trunk_Extension = 
{
   AnyKinMeasure &ref1 = .BodyModel.Interface.Trunk.PelvisThoraxExtension;
   RangeOfMotion = {-60, 10}*pi/180;
   Freq = 2/(Main.Study.tEnd-Main.Study.tStart);
   Phase = 0*pi/180;
   Reaction.Type ={Off};
};

Hope it helps,
Hamed

Hello Hamed,
I'm trying to get Hinge running on a device that I converted from Solidworks. I will try to apply the specified driver for my model.