Console.WriteLine("📜 Compensator: 2D");
const int INDEX_ZERO = 0;
const int X_MIN = 0;
const int X_MAX = 500;
const int X_DELTA = 100;
const int X_POINTS = ((X_MAX - X_MIN) / X_DELTA) + 1;
const int Y_MIN = 0;
const int Y_MAX = 500;
const int Y_DELTA = 100;
const int Y_POINTS = ((Y_MAX - Y_MIN) / Y_DELTA) + 1;
const int TOTAL_POINTS = X_POINTS * Y_POINTS;
double[] table = new double[TOTAL_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,
};
Console.WriteLine($"X Range: {X_MIN} to {X_MAX}, Delta: {X_DELTA}");
Console.WriteLine($"Y Range: {Y_MIN} to {Y_MAX}, Delta: {Y_DELTA}");
Console.WriteLine($"Points: {TOTAL_POINTS}");
Console.WriteLine($"2D Compensator Table ({X_POINTS}x{Y_POINTS}):");
for (int i = 0; i < Y_POINTS; i++)
{
for (int j = 0; j < X_POINTS; j++)
{
Console.Write($"{table[i * X_POINTS + j],6}");
}
Console.WriteLine();
}
try
{
controller.CompensatorCountSet(1);
controller.CompensatorPointCountSet(INDEX_ZERO, table.Length);
Axis x = controller.AxisGet(axisNumber: 0);
Axis y = controller.AxisGet(axisNumber: 1);
Axis z = controller.AxisGet(axisNumber: 2);
controller.CompensatorConfigSet(
compensatorNumber: INDEX_ZERO,
firstInputAxis: x,
firstInputAxisMinimum: X_MIN,
firstInputAxisMaximum: X_MAX,
firstInputAxisDelta: X_DELTA,
secondInputAxis: y,
secondInputAxisMinimum: Y_MIN,
secondInputAxisMaximum: Y_MAX,
secondInputAxisDelta: Y_DELTA,
outputAxis: z,
table: table);
x.PositionSet(0);
y.PositionSet(0);
double compPos1 = z.CompensationPositionGet();
x.PositionSet(X_DELTA);
y.PositionSet(Y_DELTA);
double compPos2 = z.CompensationPositionGet();
Console.WriteLine($"Compensation at (0,0): {compPos1} (expected: {table[0]})");
Console.WriteLine($"Compensation at ({X_DELTA},{Y_DELTA}): {compPos2} (expected: {table[7]})");
if (compPos1 != table[0] || compPos2 != table[7])
throw new Exception("❌ Compensator compensation position does not match expected value.");
}
finally
{
controller.CompensatorCountSet(0);
controller.Delete();
}
void ErrorLimitTriggerValueSet(double triggerValue)
Set the Position Error Limit trigger value.
Represents a single axis of motion control. This class provides an interface for commanding motion,...
static MotionController * Get()
Get an already running RMP EtherCAT controller.
Represents the RMP soft motion controller. This class provides an interface to general controller con...
RSICompensatorOutputType
Compensator output types.
RSIAxisMasterType
Sources available to a slave Axis for electronic gearing & camming.
Helpers namespace provides utility functions for common tasks in RMP applications.