#include "rsi.h"
#include "HelperFunctions.h"
void PVTmotionMultiAxisMain()
{
const int AXIS_X = (0);
const int AXIS_Y = (1);
const int POINTS = (3000);
const int AXIS_COUNT = (2);
const double TIME_SLICE = (0.01);
const int USER_UNITS = 1;
char rmpPath[] = "C:\\RSI\\X.X.X\\";
try
{
axisX = controller->
AxisGet(AXIS_X);
axisY = controller->
AxisGet(AXIS_Y);
long radius = 1000;
double PI = 3.14159265358979323;
double degrees = 90.00 / (POINTS);
double position[POINTS * AXIS_COUNT];
double vel[POINTS * AXIS_COUNT];
double time[POINTS];
for (int i = 0, x = 0, y = 1; i < POINTS; i++)
{
position[x] = (radius*cos((i + 1)*degrees*PI / 180.0));
position[y] = (radius*sin((i + 1)*degrees*PI / 180.0));
x = x + 2;
y = y + 2;
time[i] = TIME_SLICE;
}
for (int i = 0, x = 0, y = 1; i < (POINTS - 1); i++)
{
vel[x] = (position[x + 2] - position[x]) / TIME_SLICE;
vel[y] = (position[y + 2] - position[y]) / TIME_SLICE;
x = x + 2;
y = y + 2;
}
vel[(POINTS * 2) - 2] = 0;
vel[(POINTS * 2) - 1] = 0;
multiAxisXY->
MovePVT(position, vel, time, POINTS, -1,
false,
true);
}
{
printf(
"\n%s\n", err.
text);
}
system("pause");
}