Console.WriteLine("📜 Compensator: Single Axis");
const int INDEX_ZERO = 0;
const int MIN = 10;
const int MAX = 110;
const int DELTA = 10;
const int POINTS = ((MAX - MIN) / DELTA) + 1;
double[] table = new double[POINTS] { 0, 2, -3, -5, -3, 2, -3, 0, 2, -3, -5 };
Console.WriteLine($"Range: {MIN} to {MAX}, Delta: {DELTA}");
Console.WriteLine($"Points: {POINTS}");
Console.WriteLine("Compensator Table:");
for (int i = 0; i < POINTS; i++)
{
int inputPos = MIN + (i * DELTA);
Console.WriteLine($"@ Pos: {inputPos}, Compensate by: {table[i]}");
}
try
{
Axis axis = controller.
AxisGet(Constants.AXIS_0_INDEX);
{
compensatorNumber: INDEX_ZERO,
inputAxis: axis,
inputAxisMinimum: MIN,
inputAxisMaximum: MAX,
inputAxisDelta: DELTA,
outputAxis: axis,
table: table);
Console.WriteLine($"Compensation position: {compPos} (expected: {table[1]})");
if (compPos != table[1])
throw new Exception("❌ Compensator compensation position does not match expected value.");
}
}
finally
{
}
static void CheckErrors(RapidCodeObject rsiObject)
Checks for errors in the given RapidCodeObject and throws an exception if any non-warning errors are ...
Helpers class provides static methods for common tasks in RMP applications.
double CompensationPositionGet()
Get the compensator position.
void PositionSet(double position)
Set the Command and Actual positions.
void MoveSCurve(double position, double vel, double accel, double decel, double jerkPct)
Represents a single axis of motion control. This class provides an interface for commanding motion,...
Axis * AxisGet(int32_t axisNumber)
AxisGet returns a pointer to an Axis object and initializes its internals.
static MotionController * Get()
Get an already running RMP EtherCAT controller.
int32_t CompensatorPointCountGet(int32_t compensatorNumber)
Get the number of points for use with a Compensator.
void CompensatorPointCountSet(int32_t compensatorNumber, int32_t pointCount)
Set the number of points for use with a Compensator.
void SampleWait(uint32_t samples)
Wait for controller firmware to execute samples.
void Delete(void)
Delete the MotionController and all its objects.
void CompensatorCountSet(int32_t compensatorCount)
Set the number of Compensators available in the firmware.
void CompensatorConfigSet(int32_t compensatorNumber, int32_t firstInputAxisNumber, RSIAxisMasterType firstInputAxisType, double firstInputAxisMinimum, double firstInputAxisMaximum, double firstInputAxisDelta, int32_t secondInputAxisNumber, RSIAxisMasterType secondInputAxisType, double secondInputAxisMinimum, double secondInputAxisMaximum, double secondInputAxisDelta, int32_t outputAxisNumber, RSICompensatorOutputType outputType, const double *const table)
Configure a 2D compensator.
Represents the RMP soft motion controller. This class provides an interface to general controller con...
void ClearFaults()
Clear all faults for an Axis or MultiAxis.
void Abort()
Abort an axis.
int32_t MotionDoneWait()
Waits for a move to complete.
int32_t AmpEnableSet(bool enable, int32_t ampActiveTimeoutMilliseconds=AmpEnableTimeoutMillisecondsDefault, bool overrideRestrictedState=false)
Enable all amplifiers.
RSICompensatorOutputType
Compensator output types.
@ RSICompensatorOutputTypeSINGLE
Compensator output will overwrite any other compensation values.
RSIAxisMasterType
Sources available to a slave Axis for electronic gearing & camming.
@ RSIAxisMasterTypeAXIS_COMMAND_POSITION
Use command position from master.