The RMP Motion Controller APIs

◆ CompensatorCountSet()

void CompensatorCountSet ( int32_t  compensatorCount)
CompensatorCountSet sets the number of Compensators enabled on the controller. This must be configured before creating Axis or MultiAxis objects, as these object counts change the dynamic memory allocation inside the controller's firmware.
This function is also available in RapidSequencer.

Part of the Compensator method group.

Sample Code:
// 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.
// 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);
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
// 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.
if (controller.CompensatorPointCountGet(Constants.COMP_NUM_ZERO) == TABLE0.Length && POINTS == TABLE0.Length)
// 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);
The firmware default is 0. This should be done after Creating the Controller and before any other RapidObject creation as it will invalidate non-Controller Objects.
See also
CompensatorCountGet, CompensatorPointCountSet
int32_t CompensatorPointCountGet(int32_t compensatorNumber)
Get the number of points for use with a Compensator.
Sources available to a slave Axis for electronic gearing & camming.
Definition: rsienums.h:1150
void CompensatorPointCountSet(int32_t compensatorNumber, int32_t pointCount)
Set the number of points for use with a Compensator.
Compensator output types.
Definition: rsienums.h:1324
void AxisCountSet(int32_t axisCount)
Set the number of allocated and processed axes in the controller.
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.