.

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.

 

/* Make the actual position use the commanded position. */
MEIXmpAxis * axisMemory;
MEIAxisConfig meiAxisConfig;

mpiAxisMemory( axis2, (void**) &axisMemory );

mpiAxisConfigGet( axis2, 0, &meiAxisConfig );

meiAxisConfig.FeedbackDeltaPtr[0] = &axisMemory->TC.PositionDelta;

mpiAxisConfigSet( axis2, 0, &meiAxisConfig );

/* Configure the motor object so that it does not affect the virtual axis. */
MPIMotorConfig mpiMotorConfig;
MEIMotorConfig meiMotorConfig;

mpiMotorConfigGet( motor2, &mpiMotorConfig, &meiMotorConfig );

mpiMotorConfig.event[MPIEventTypeLIMIT_SW_NEG].action = MPIActionNONE;
mpiMotorConfig.event[MPIEventTypeLIMIT_SW_POS].action = MPIActionNONE;

meiMotorConfig.disableAction = MEIMotorDisableActionNONE;

mpiMotorConfigSet( motor2, &mpiMotorConfig, &meiMotorConfig );

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 be Axis 2.

 

MPIAxisConfig mpiAxisConfig;
mpiAxisConfigGet( axis0, &mpiAxisConfig, 0 );

mpiAxisConfig.masterCorrection = 2;

mpiAxisConfigSet( axis0, &mpiAxisConfig, 0 );

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

 

MPIAxisConfig mpiAxisConfig;
mpiAxisConfigGet( axis0, &mpiAxisConfig, 0 );

mpiAxisConfig.masterCorrection = -1;

mpiAxisConfigSet( axis0, &mpiAxisConfig, 0 );

 

Linking Axes for Slave Corrections

The gear configuration fields of the MEIAxisConfig 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 be Axis 2.

 

MEIXmpData    *firmware;
MEIPlatform   platform;
void          *adress;

mpiControlMemory( control, (void**)&firmware, 0 );
platform = meiControlPlatform(control);
address = &firmware->Axis[2].CmdPosition;

/* Convert address to low word (for ZMP) */
meiPlatformHostAddress64To32(platform, &address, TRUE);

MEIAxisConfig meiAxisConfig;
mpiAxisConfigGet( axis0, 0, &meiAxisConfig );

meiAxisConfig.Gear.Ratio.A = 1;
meiAxisConfig.Gear.Ratio.B = 1;
meiAxisConfig.Gear.Ptr = address;

mpiAxisConfigSet( axis0, 0, &meiAxisConfig );

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

 

MEIXmpData *firmware;

mpiControlMemory( control, (void**)&firmware, 0 );

MEIAxisConfig meiAxisConfig;
mpiAxisConfigGet( axis0, 0, &meiAxisConfig );

meiAxisConfig.Gear.Ratio.B = 0;

mpiAxisConfigSet( axis0, 0, &meiAxisConfig );

 

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.

 

MPIMotionParams correctionMotionParams;
double position[] = { 10 };
MPITrajectory trajectory[] = { {10000, 100000, 100000, 0, 0, 0} };
correctionMotionParams.trapezoidal.position = position;
correctionMotionParams.trapezoidal.trajectory = trajectory;

mpiMotionStart( motion2,
    (MPIMotionType)( MPIMotionTypeTRAPEZOIDAL |
                     MPIMotionAttrMaskRELATIVE),
&correctionMotionParams );

 

 

 

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