 OMRON Forums

# Sine wave profile

## Recommended Posts

Currently working with the PPMAC with 24E2A's and could use some advice on the obtaining the following motion profile:

- Use current position as starting point

- Define end point, amplitude, and frequency of motion profile

- Using the above parameters, the robot moves in a sine wave with the overall average path of motion being a linear transition from the start to end point. See attached.

Currently considering PVT mode but would like to avoid defining each curve independently. Any help would be much appreciated.  • Replies 3
• Created

#### Posted Images

Is the plot one of position-versus-time for a single axis, or the path in a Cartesian (e.g. XY) plane? I'm confused from the description.

In either case, I would probably use short spline mode moves of uniform time in a loop, calculating each destination position as the sum of the cyclic and linear components.

##### Share on other sites

Is the plot one of position-versus-time for a single axis, or the path in a Cartesian (e.g. XY) plane? I'm confused from the description.

In either case, I would probably use short spline mode moves of uniform time in a loop, calculating each destination position as the sum of the cyclic and linear components.

Path in Cartesian coordinates. Thanks I'll give this a try.

##### Share on other sites

I have used this solution before, but I never had a chance to post it online.

The idea is to superimpose a repeating pattern (function of traveled distance or time) over the commanded trajectory. This can be very useful in certain applications such as welding. In this approach we use a Kinematic routines to "inject" the pattern over the commanded trajectory.

In this example, I have injected a Sinusoidal function based upon traveled distance over the commanded trajectory from Power PMAC. This can be modified such that it is a function of time (This will cause "compression" of pattern at slower speeds or corners depending on your acceleration and jerk limitations). Please note that this doesn't have to be a one-to-one function. As long as you can define a continuous repeating pattern based upon time or based upon traveled distance, it can be implemented in this manner.

The implementation is in 3 sections : Global Definitions, Forward Kinematics, Inverse Kinematics

global definitions.pmh

```undefine all;
&1#1->i;
&1#2->i;

global Period, Amplitude;
global PrevX,PrevY;
global XAxisSf, YAxisSf;
global LastAngle;
global TraveledDistance;
global PatternVector(2);
global RotationMatrix(4);
global OffsetVector(2);

Period = 500;
Amplitude = 100;

XAxisSf=1;
YAxisSf=1;

LastAngle=0;
TraveledDistance=0;
```

forward1.kin

```open forward (1)
PatternVector(0)= 0;
PatternVector(1)= Amplitude*sind((TraveledDistance/Period)*360);
RotationMatrix(0)=cosd(LastAngle);
RotationMatrix(1)=-sind(LastAngle);
RotationMatrix(2)=sind(LastAngle);
RotationMatrix(3)=cosd(LastAngle);
P0 = mmul(&OffsetVector(0),&RotationMatrix(0),&PatternVector(0),2,2,1);
KinPosAxisX = KinPosMotor1/XAxisSf - OffsetVector(0);
KinPosAxisY = KinPosMotor2/YAxisSf - OffsetVector(1);
KinAxisUsed = \$C0;
PrevX = KinPosAxisX;
PrevY = KinPosAxisY;
close```

inverse1.kin

```open inverse (1)
TraveledDistance+=sqrt(pow((KinPosAxisX - PrevX),2)+pow((KinPosAxisY - PrevY),2));
LastAngle = atan2d((KinPosAxisY - PrevY),(KinPosAxisX - PrevX));
PrevX=KinPosAxisX;
PrevY=KinPosAxisY;
PatternVector(0)= 0;
PatternVector(1)= Amplitude*sind((TraveledDistance/Period)*360);
RotationMatrix(0)=cosd(LastAngle);
RotationMatrix(1)=-sind(LastAngle);
RotationMatrix(2)=sind(LastAngle);
RotationMatrix(3)=cosd(LastAngle);
P0 = mmul(&OffsetVector(0),&RotationMatrix(0),&PatternVector(0),2,2,1);
KinPosMotor1=KinPosAxisX*XAxisSf+OffsetVector(0);
KinPosMotor2=KinPosAxisY*YAxisSf+OffsetVector(1);
close
```

Period defines the sine wave period.

Amplitude defines the sine wave amplitude.

TraveledDistance which defines where to start in the pattern. It also keeps track of the traveled distance. If user wants to define a new value, motion program should be in Dwell mode with a PMATCH command called after the Dwell.

LastAngle defines the last traveled angle tangent to the motion in 2D space (this can be expanded to 3D). This also defines the starting point of the motion if the pattern doesn't start from the 0 offset.

Here are some results for a few example trajectories:

Note that for more detailed or smaller pattern, a lower segmentation time

is required.

##### Share on other sites This topic is now closed to further replies.

×
• Forums

• Events
• #### Browse

×
• Create New...