The slave (follower) axis is managed according to the following steps:
•M_POSITIONING: the initial positioning step must be requested by the user by setting the appropriate bits of the command parameter of the reference structure. The positioning request must necessarily be invoked from a condition where the slave is stationary in both velocity and acceleration (check that the ax_in_mov2 mask bit of the corresponding axis is 0). If positioning to the parking quota has been requested, the slave axis moves to the qParkSlave position, using the kinematics parameters velPositSlave, accPositSlave, and jerkPositSlave. In the case that the movement of the function is interrupted (for example, due to an emergency condition), if the master has not moved that far in the meantime, positioning can be performed at the cycle position relative to the current quota of the master. Use the corresponding bit of the command parameter to do this. During positioning to the relative quota of the master, it is essential that the master is stationary. The user can also perform the positioning in a different way, computed by an external function, the important thing is that he takes care to bring the slave axis to the correct position before using the mv_follow2() function. If at the first execution of the function (with positioning request) the slave is already in the correct position, it is possible to leave the kinematics parameters velPositSlave, accPositSlave and jerkPositSlave at 0
•M_WAITING: axis remains stationary at the qParkSlave parking quota; calculations are performed to check if it is time to start tracking according to the current quota of the master, the qSyncMaster quota, and the positions set for the various slave phases. If it is too late to start during the current cycle, the M_WAITING phase switches to M_WAITING_NEXT_CYCLE
•M_FOLLOWING: the axis starts tracking by performing a calculated movement such that it reaches the speed of the master axis at the slave quota qSyncSlave and the master quota qSyncMaster. If the slave axis is linear, a simple jerk ramp is executed (in which the space traveled by the master is twice the space traveled by the slave). If, on the other hand, the slave axis is cyclic, the movement performed in this phase depends on all the other parameters that make the cycle; in this case the tracking ramp may also have over-elongations
•M_SYNCHRONIZED: the slave axis keeps tracking to the master, until the slave quota qSyncOut has been reached or exceeded. During this phase, the speed of the slave axis is given by the following formula: vSlave = velMaster * kSlaveMaster
At the end of the synchronized phase the behavior differs depending on how the stru_follow2 structure has been configured:
•In the case of a linear slave(slaveCycle = 0), it switches to the M_DECEL deceleration phase in which the slave slows down to a stop by traversing the spaceStopSlave braking space and executing a simple jerk ramp (space traversed by the master double the space traversed by the slave).
At the end of the deceleration phase, the linear slave switches to the return phase to the parking position M_HOMING in which a bell-shaped velocity profile movement is executed such that the parking position qParkSlave is reached and maintained for the spaceWaitInPark duration before the next tracking phase begins
•In the case of a cyclic slave(slaveCycle > 0) with stopping at quota qParkSlave enabled during the cycle (see corresponding bit of the command parameter), it goes directly to the M_HOMING phase in which a calculated movement is performed so that the parking position qParkSlave is reached and held for the duration spaceWaitInPark before the next tracking phase begins
•In the case of a cyclic slave(slaveCycle > 0) with stopping at the qParkSlave elevation disabled during the cycle (see corresponding bit of the command parameter), it moves directly to the next tracking phase without stopping at the qParkSlave elevation. The movement is calculated to start at speed and reach the next synchronism always at speed at the qSyncSlave and qSyncMaster quotas. If the space missing for the master to reach the synchronism quota was significantly larger than the space missing for the slave, the slave could slow down and stop at an intermediate quota that could also be different from the quota qParkSlave
If the master cycle does not have a fixed duration (see the corresponding bit of the command parameter), it is necessary to set the new value of qSyncMaster in time at each cycle: the useful phases for setting the qSyncMaster synchronism quota relative to the next cycle are the tracking phase M_FOLLOWING and the synchronized phase M_SYNCHRONIZED relative to the current cycle.
If the quota qSyncMaster is set beyond the end of the synchronized phase M_SYNCHRONIZED the slave axis will go to the parking quota qParkSlave.
Also in the case of variable duration cycle masters, it is mandatory to set the masterCycle parameter such that a minimum duration of the master cycle is set. The minimum duration is used to limit the speed of the recovery phase and, in case the qSyncMaster quota is not set in time, to set the speed of the homing phase.
In case of a cyclic slave with dwell at the parking quota qParkSlave disabled during the cycle, it is possible to recover a qSyncMaster quota assigned beyond the time limit by enabling the corresponding bit of the command parameter. In this case, as soon as the new qSyncMaster synchronism quota is set, an on-the-fly connection will be performed (if possible) between the movement to the qParkSlave parking quota and the tracking movement to the new synchronism.
The kSlaveMaster parameter results very useful in those cases where the unit of measurement of the slave axis is different from that of the master axis (typical case a master expressed in mm and a slave in degrees). By specifying the K factor existing between the two axes, it is possible to perform tracking as if the units were homogeneous with each other. In addition, by slightly varying the kSlaveMaster parameter from its nominal value, it is possible to perform synchronism at different speeds (for example, if the slave axis is the jaw that welds and cuts the film of a wrapping machine, it is useful to reduce the speed of the slave axis relative to that of the master so as to avoid tearing the film during welding).
The first time the mv_follow2() function is called, it is necessary to have previously loaded a set of appropriate values into the stru_follow2 structure. In addition, in order to be certain of what the initial phase will be, a positioning request should be made via the appropriate bits of the command parameter.
If some parameters characterizing the loop are not consistent, the function returns the negative result M_IN_ALARM. In this case you can test the errorCode parameter to get an indication of what is wrong.
If the maxSpe and maxAcc parameters are set and if testing on the relative bits of the command parameter is not disabled, a check is made each time the mv_follow2() function is executed to avoid exceeding the set limits. If the limits are exceeded, the function returns the negative result M_IN_ALARM and executes a linear stop ramp with maxAcc acceleration. Again, the errorCode parameter can be consulted to see at what stage the speed and/or acceleration were exceeded.
|