Console.WriteLine("📜 Compensator: 1D");
int exitCode = 0;
const int INDEX_ZERO = 0;
const int INDEX_ONE = 1;
const int MIN = 0;
const int MAX = 100;
const int DELTA = 10;
const int POINTS = ((MAX - MIN) / DELTA) + 1;
double[] table0 = new double[POINTS] { 0, 1000, -5000, -10000, 10000, 5000, -5000, 2500, 0, 2500, 5000 };
double[] table1 = new double[POINTS] { 0, 500, 0, 0, 0, 0, 0, 0, 0, 0, 1000 };
Console.WriteLine($"Range: {MIN} to {MAX}, Delta: {DELTA}");
Console.WriteLine($"Points: {POINTS}");
try
{
Helpers.VerifyHardwareUsage(controller);
Helpers.VerifyAxisCount(controller, minRequiredSampleAxisCount: 2);
controller.CompensatorCountSet(2);
controller.CompensatorPointCountSet(INDEX_ZERO, table0.Length);
controller.CompensatorPointCountSet(INDEX_ONE, table1.Length);
Helpers.PhantomAxisReset(movingAxis);
Helpers.PhantomAxisReset(followerAxis);
if (controller.CompensatorPointCountGet(INDEX_ZERO) == table0.Length && POINTS == table0.Length)
{
controller.CompensatorConfigSet(
compensatorNumber: INDEX_ZERO,
inputAxis: movingAxis,
inputAxisMinimum: MIN,
inputAxisMaximum: MAX,
inputAxisDelta: DELTA,
outputAxis: followerAxis,
table: table0);
controller.CompensatorConfigSet(
compensatorNumber: INDEX_ONE,
inputAxis: movingAxis,
inputAxisMinimum: MIN,
inputAxisMaximum: MAX,
inputAxisDelta: DELTA,
outputAxis: followerAxis,
table: table1);
movingAxis.PositionSet(DELTA);
double compPos = followerAxis.CompensationPositionGet();
Console.WriteLine($"Compensation position: {compPos} (expected: {table0[1] + table1[1]})");
if (compPos != table0[1] + table1[1])
throw new Exception("❌ Compensator compensation position does not match expected value.");
Helpers.AbortMotionObject(followerAxis);
Helpers.AbortMotionObject(movingAxis);
}
}
catch (Exception e)
{
Console.WriteLine($"❌ Error: {e.Message}");
}
finally
{
controller.CompensatorCountSet(0);
controller.Delete();
}
return exitCode;
Constants used in the C# sample apps.
const int EXIT_FAILURE
Exit code for failed execution.
const int AXIS_0_INDEX
Default: 0.
const int EXIT_SUCCESS
Exit code for successful execution.
const int AXIS_1_INDEX
Default: 1.
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.