.

Correction Moves

Master-Slave Concept | Camming | Correction Moves

Introduction

Correction moves can be superimposed on cam moves. These moves allow the controller to counterbalance small offsets and biases that will accumulate over extended periods and will affect the relative positions of the master and slave axes.

Correction moves can either be injected before or after the cam calculations. Normally only one correction is used. The physical effect that you are trying to negate will dictate which type and when the correction move will be used. Injecting a master correction will advance or retard the cam/gear and injecting a slave correction will offset (bias) the resulting motion.

There are no restrictions on the size and type of corrections that can be applied. Large moves would normally be applied when starting a cam and small moves would be applied periodically to compensate for biases, drifts, or slippages.

The correction axis can be used to generate any type of motion, but in most cases, a small position move (eg. trapezoidal or s-curve) is sufficient.

The corrections are generated by another motion and axis object. This correction motion and axis object are normally not used to control any physical motor, but can be thought of as a virtual or pseudo axis.

Creating a Virtual Axis

By default, the MPI configures each axis to use a filter and motor object for controlling a physical motor. But for generating corrections, the axis and motor objects will need to be set up to operate as a standalone axis that is not relying on any hardware.

The following MPI code shows how to change the default configuration of Axis 2 to be a virtual axis.

MPIAxisConfig axisConfig;
MPIMotorConfig motorConfig;
MFWAxisData *axisDataPtr;

mpiControlObjectPtr(control,
                                  MPIControlObjectTypeAXIS_DATA,
                                   2,
                                   TRUE,
                                   &axisDataPtr);

mpiAxisConfigGet(axis, &axisConfig);

axisConfig.feedbackDeltaPtr[0] = &axisDataPtr->TC.PositionDeltaLong;

mpiAxisConfigSet(axis, &axisConfig);

mpiMotorConfigGet(motor, &motorConfig);

motorConfig.disableAction = MPIMotorDisableActionNONE;
motorConfig.limit[MPIMotorLimitTypeAMP_FAULT].action = MPIActionNONE;
motorConfig.limit[MPIMotorLimitTypeAMP_WARNING].action = MPIActionNONE;
motorConfig.limit[MPIMotorLimitTypeFEEDBACK_FAULT].action = MPIActionNONE;
motorConfig.limit[MPIMotorLimitTypeERROR].action = MPIActionNONE;
motorConfig.limit[MPIMotorLimitTypeTORQUE].action = MPIActionNONE;
motorConfig.limit[MPIMotorLimitTypeHW_NEG].action = MPIActionNONE;
motorConfig.limit[MPIMotorLimitTypeHW_POS].action = MPIActionNONE;
motorConfig.limit[MPIMotorLimitTypeSW_NEG].action = MPIActionNONE;
motorConfig.limit[MPIMotorLimitTypeSW_POS].action = MPIActionNONE;

mpiMotorConfigSet(motor, &motorConfig);

This code makes two changes:

  • The source of the actual position of the axis is changed to be the commanded position of the axis.

  • The software limits and disable actions of the motor object are disabled.

Linking Axes for Master Corrections

The masterCorrection field of the MPIAxisConfig structure is used to make the connection between the correction axis and the slave axis. Setting this field to the axis number of the slave axis makes the connection. Setting this field to -1 breaks the connection.

Here is the MPI code for setting the master correction source to Axis 2.

MPIAxisConfig axisConfig;

mpiAxisConfigGet(axis, &axisConfig);

axisConfig.masterCorrection = 2;

mpiAxisConfigSet(axis, &axisConfig);

Here is the MPI code to disable the master correction from being applied.

MPIAxisConfig axisConfig;

mpiAxisConfigGet(axis, &axisConfig);

axisConfig.masterCorrection = -1;

mpiAxisConfigSet(axis, &axisConfig);

Linking Axes for Slave Corrections

The gear configuration fields of the MPIAxisConfig structure are used to make the connection between the correction axis and the slave axis. The gear configuration of the slave axis needs to make its source the command position of the correction axis and enable the gear feature by setting the denominator (Ratio.B) to one. The correction axis can be disconnected from the slave axis by disabling the gear feature of the slave axis by setting the denominator (Ratio.B) to zero.

Here is the MPI code for setting the slave correction source to Axis 2.

MPIAxisConfig   axisConfig;
MFWAxisData        *axisDataPtr;

mpiControlObjectPtr(control,
                                   MPIControlObjectTypeAXIS_DATA,
                                   2,
                                   TRUE,
                                   &axisDataPtr);

mpiAxisConfigGet(axis, &axisConfig);

axisConfig.gear.ratio.A = 1;
axisConfig.gear.ratio.B = 1;
axisConfig.gear.ptr = &axisDataPtr->TC.PositionDeltaLong;

mpiAxisConfigSet(axis, &axisConfig);

To disable the slave correction source, set the gear ratio to zero:

mpiAxisConfigGet(axis, &axisConfig);

axisConfig.gear.ratio.A = 0;
axisConfig.gear.ratio.B = 0;

mpiAxisConfigSet(axis, &axisConfig);

How to Command a Correction

Since we now have a separate motion and axis object for corrections we can use this to command any type of correction move at any time. Usually, the correction moves will be small position moves, for example trapezoidal or S-CURVE moves.

For example, here is the MPI code that applies a correction of 10 counts in the form of a trapezoidal move.

mpiMotionTrapezoidalMove(motion,
                                             10.0,
                                             10000.0,
                                             10000.0,
                                             10000.0,
                                             0.0,       /* final vel */
                                             MPIMotionPointToPointAttrMaskRELATIVE_MOVE,
                                             NULL);

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