2D position compensation table.
This sample application demonstrates how to use the compensator.
using RSI.RapidCode.dotNET;
using RSI.RapidCode.dotNET.Enums;
using System;
{
class Compensator2D
{
static void Main(string[] args)
{
try
{
const int X_AXIS_NUM = 0;
const int Y_AXIS_NUM = 1;
const int Z_AXIS_NUM = 2;
const int COMPENSATOR_NUM = 0;
const int USER_UNITS = 1048576;
const int ACCELERATION = 2;
const int DECELERATION = 2;
const int X_MIN = 0;
const int X_MAX = 50;
const int X_DELTA = 10;
const int Y_MIN = 0;
const int Y_MAX = 50;
const int Y_DELTA = 10;
const int COMPENSATOR_X_POINTS = ((X_MAX - X_MIN) / X_DELTA) + 1;
const int COMPENSATOR_Y_POINTS = ((Y_MAX - Y_MIN) / Y_DELTA) + 1;
const int POINTS = (COMPENSATOR_X_POINTS) * (COMPENSATOR_Y_POINTS);
double[] TABLE = new double[POINTS] {
0, 0, 0, 0, 0, 0,
100, 200, -200, 10, 300, 0,
100, 200, -500, 400, 500, 0,
0, 0, 0, 0, 0, 0,
-300, 300, -300, -300, -300, 0,
0, 0, 0, 0, 0, 0,
};
controller.
CompensatorConfigSet(COMPENSATOR_NUM, x,
RSIAxisMasterType.RSIAxisMasterTypeAXIS_ACTUAL_POSITION, X_MIN, X_MAX, X_DELTA, y,
RSIAxisMasterType.RSIAxisMasterTypeAXIS_ACTUAL_POSITION, Y_MIN, Y_MAX, Y_DELTA, z,
RSICompensatorOutputType.RSICompensatorOutputTypeSINGLE, TABLE);
Console.WriteLine("\nCompensator Configured\n");
while (!Console.KeyAvailable)
{
}
}
catch (Exception e)
{
Console.WriteLine(e.Message);
}
Console.WriteLine("\nPress Any Key To Exit");
Console.ReadKey();
}
}
}