◆ CompensatorConfigSet() [2/4]

virtual void CompensatorConfigSet ( int32_t  compensatorNumber,
Axis firstInputAxis,
RSIAxisMasterType  firstInputAxisType,
double  firstInputAxisMinimum,
double  firstInputAxisMaximum,
double  firstInputAxisDelta,
Axis secondInputAxis,
RSIAxisMasterType  secondInputAxisType,
double  secondInputAxisMinimum,
double  secondInputAxisMaximum,
double  secondInputAxisDelta,
Axis outputAxis,
RSICompensatorOutputType  outputType,
double *  table 
)
pure virtual

Configure a 2D compensator. This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

ℹ This function is avaliable in RapidCode

Part of the Compensator method group.

Sample Code:
Compensator1D
//---ARRANGE---
// To use a compensator space in memory must be reserved before creating axis objects. For this sample app we will create two overlapping compensation tables.
controller.CompensatorCountSet(2);
// To know how much memory will be required for the compensator table you must first know your MIN, MAX, and DELTA. See our compensator topic page for more information.
const int MIN = 0; // The smallest value in counts on the input axis where a table will be applied to the output axis.
const int MAX = 200; // The largest value in counts on the input axis where a table will be applied to the output axis.
const int DELTA = 10; // The number of encoder counts on the input axis between values in the table.
const int POINTS = ((MAX - MIN) / DELTA) + 1; // The space required in memory for the table to be held. (21)
// Compensator table values use Axis COUNTS NOT user units to be applied to the output axis.
double[] TABLE0 = new double[POINTS] { 0, 1000, -5000, -10000, 10000, 5000, -5000, 2500, 0, 2500, 5000, 7500, 1000, 1250, 1000, 7500, 5000, 2500, 0, -2500, -1000 };
double[] TABLE1 = new double[POINTS] { 0, 500, 0, 0, 0, 0, 0, 0, 0, 0, 1000, -5000, -1000, 1000, 5000, -5000, 2500, 0, -1000, 0, 0 };
// Reserve space in memory for the compensator tables.
controller.CompensatorPointCountSet(Constants.COMP_NUM_ZERO, TABLE0.Length);
controller.CompensatorPointCountSet(Constants.COMP_NUM_ONE, TABLE1.Length);
controller.AxisCountSet(2);
Axis moving_axis = CreateAndReadyAxis(Constants.MAIN_AXIS_NUMBER); //Helper function to setup an axis
Axis follower_axis = CreateAndReadyAxis(Constants.DRIVEN_AXIS_NUMBER); //Helper function to setup an axis
//---TEST ASSERT---
//NOTE the three following values must be equal before a compensator can be configured. Otherwise an error will be thrown. See topic page for more info.
Assert.That(controller.CompensatorPointCountGet(Constants.COMP_NUM_ZERO), Is.EqualTo(TABLE0.Length));
Assert.That(POINTS, Is.EqualTo(TABLE0.Length));
//---ARRANGE---
// Initalize the Compensator
controller.CompensatorConfigSet(Constants.COMP_NUM_ZERO, moving_axis, RSIAxisMasterType.RSIAxisMasterTypeAXIS_ACTUAL_POSITION, MIN, MAX, DELTA, follower_axis, RSICompensatorOutputType.RSICompensatorOutputTypeSINGLE, TABLE0);
// You can also configure multiple overlaping compensation tables. Note the first compensator remains in SINGLE mode but the second is set to ADDITIVE
controller.CompensatorConfigSet(Constants.COMP_NUM_ONE, moving_axis, RSIAxisMasterType.RSIAxisMasterTypeAXIS_ACTUAL_POSITION, MIN, MAX, DELTA, follower_axis, RSICompensatorOutputType.RSICompensatorOutputTypeADDITIVE, TABLE1);
Parameters
compensatorNumberwhich compensator to configure?
firstInputAxisThis specifies the axis of the first compensating Axis object. The position from this Axis will be used to index a single dimension of the compensation table. This number must correspond to a valid (existing) and enabled Axis on the controller.
firstInputAxisMinimumThe minimum feedback position (COUNTS) along the first compensation axis where compensation will occur.
firstInputAxisMaximumThe maximum feedback position (COUNTS) along the first compensation axis where compensation will occur.
firstInputAxisDeltaSpacing between compensation positions on the compensating axis. positionDelta must meet some specifications: positionDelta must be an exact multiple of the range (i.e. ((range.positionMax - range.positionMin) / positionDelta) must be an integer value). positionDelta must be greater than zero. positionDelta must be greater than (positionMax - positionMin).
secondInputAxisNumberThis specifies the axis number of the second compensating Axis object. The position from this Axis will be used to index a single dimension of the compensation table. This number must correspond to a valid (existing) and enabled Axis on the controller.
secondInputAxisMinimumThe minimum feedback position (COUNTS) along the second compensation axis where compensation will occur.
secondInputAxisMaximumThe maximum feedback position (COUNTS) along the second compensation axis where compensation will occur.
secondInputAxisDeltaSpacing between compensation positions on the secondcompensating axis. positionDelta must meet some specifications: positionDelta must be an exact multiple of the range (i.e. ((range.positionMax – range.positionMin) / positionDelta) must be an integer value). positionDelta must be greater than zero. positionDelta must be greater than (positionMax - positionMin).
outputAxisThis specifies the axis of the Axis to be compensated by the Compensator object. This number must correspond to a valid (existing) and enabled Axis on the controller.
outputTypeSets the behavior of a compensator. SINGLE: Only the most recent compensator configured to output on a specific axes will be applied ADDITIVE: The output of the compensator will be added with the result form the previously applied compensator on the specific axis.
tablethe points which will be written to the table
Sample Code:
Compensator1D
//---ARRANGE---
// To use a compensator space in memory must be reserved before creating axis objects. For this sample app we will create two overlapping compensation tables.
controller.CompensatorCountSet(2);
// To know how much memory will be required for the compensator table you must first know your MIN, MAX, and DELTA. See our compensator topic page for more information.
const int MIN = 0; // The smallest value in counts on the input axis where a table will be applied to the output axis.
const int MAX = 200; // The largest value in counts on the input axis where a table will be applied to the output axis.
const int DELTA = 10; // The number of encoder counts on the input axis between values in the table.
const int POINTS = ((MAX - MIN) / DELTA) + 1; // The space required in memory for the table to be held. (21)
// Compensator table values use Axis COUNTS NOT user units to be applied to the output axis.
double[] TABLE0 = new double[POINTS] { 0, 1000, -5000, -10000, 10000, 5000, -5000, 2500, 0, 2500, 5000, 7500, 1000, 1250, 1000, 7500, 5000, 2500, 0, -2500, -1000 };
double[] TABLE1 = new double[POINTS] { 0, 500, 0, 0, 0, 0, 0, 0, 0, 0, 1000, -5000, -1000, 1000, 5000, -5000, 2500, 0, -1000, 0, 0 };
// Reserve space in memory for the compensator tables.
controller.CompensatorPointCountSet(Constants.COMP_NUM_ZERO, TABLE0.Length);
controller.CompensatorPointCountSet(Constants.COMP_NUM_ONE, TABLE1.Length);
controller.AxisCountSet(2);
Axis moving_axis = CreateAndReadyAxis(Constants.MAIN_AXIS_NUMBER); //Helper function to setup an axis
Axis follower_axis = CreateAndReadyAxis(Constants.DRIVEN_AXIS_NUMBER); //Helper function to setup an axis
//---TEST ASSERT---
//NOTE the three following values must be equal before a compensator can be configured. Otherwise an error will be thrown. See topic page for more info.
Assert.That(controller.CompensatorPointCountGet(Constants.COMP_NUM_ZERO), Is.EqualTo(TABLE0.Length));
Assert.That(POINTS, Is.EqualTo(TABLE0.Length));
//---ARRANGE---
// Initalize the Compensator
controller.CompensatorConfigSet(Constants.COMP_NUM_ZERO, moving_axis, RSIAxisMasterType.RSIAxisMasterTypeAXIS_ACTUAL_POSITION, MIN, MAX, DELTA, follower_axis, RSICompensatorOutputType.RSICompensatorOutputTypeSINGLE, TABLE0);
// You can also configure multiple overlaping compensation tables. Note the first compensator remains in SINGLE mode but the second is set to ADDITIVE
controller.CompensatorConfigSet(Constants.COMP_NUM_ONE, moving_axis, RSIAxisMasterType.RSIAxisMasterTypeAXIS_ACTUAL_POSITION, MIN, MAX, DELTA, follower_axis, RSICompensatorOutputType.RSICompensatorOutputTypeADDITIVE, TABLE1);
See also
CompensatorCountSet