.

Configuring the Compensator Objects for Operation

After determining the required compensator table size, we need to configure both the embedded compensation tables on controller and the MPI Compensator object.

We will illustrate how to do this using the X-Y-Z system defined in the Determining Required Compensator Table Size section.

Configuring Controller Compensation Table

From our example in the previous section we have calculated that we need at least a point count of 105 to hold all of our measured compensation points (Acquiring and loading compensation points will be described in in the next section). First we need tell the motion controller to allocate memory space to hold the compensation table. We also need to enable a compensator since compensator objects are disabled on the controller by default. For an example, see the code below.

MPIControlConfig config;
int32_t returnValue;

returnValue = mpiControlConfigGet(control, &config);
 
if (returnValue == MPIMessageOK) {
/* configure first compensator table size so our 2D array will fit */
config.dynamicMemAlloc.compensatorCount = 1;
config.enabled.compensatorCount = 1;
config.dynamicMemAlloc.compensatorPointCount[0] = 105;
 
/* WARNING: this is a low-level configuration that will
* reinitialize the controller's dynamic memory buffers!
* Only perform this operation at system initialization.
*/
returnValue = mpiControlConfigSet(control, &config);
}

The comment above reminds us that calling mpiControlConfigSet(...) will reallocate dynamic memory. Reallocation of dynamic memory affects other objects on the controller, so it should only be done during system initialization and not during the execution of a move.

Configuring the MPI Compensator Object

Continuing with our example, we will now assume that our axis numbers for axis X, Y, and Z are 0, 1, & 2 respectively. If we also assume that the MPI Compensator object has already been created, the code to configure the object would look like the following:


MPICompensatorConfig config;
returnValue = mpiCompensatorConfigGet(compensator, &config);
 
if (returnValue == MPIMessageOK) {
config.dimensionCount = 2;

/* configure first compensating (input) axis */ config.inputAxis[0].axisNumber = 0;
config.inputAxis[0].range.positionMin = 0;
config.inputAxis[0].range.positionMax = 250000;
config.inputAxis[0].positionDelta = 50000;

/* configure second compensating (input) axis */
config.inputAxis[1].axisNumber = 1;
config.inputAxis[1].range.positionMin = 25000;
config.inputAxis[1].range.positionMax = 225000;
config.inputAxis[1].positionDelta = 10000;

/* configure compensated (out) axis */
config.outputAxisNumber = 2;

returnValue = mpiCompensatorConfigSet(compensator,&config);

}

Once we have the Compensation table allocated and have a configured Compensation object, the last step is to Load the Compensation Table.

       Legal Notice  |  Tech Email  |  Feedback
      
Copyright ©
2001-2021 Motion Engineering