.

Fast Versions of mpiMotionStart() and mpiMotionModify()

Declaration

 
long _mpiMotionStart(MPIMotion       motion,
                     MPIMotionType   type,
                     MPIMotionParams *params)  
 

Required Header: stdmpi.h


 
long _mpiMotionModify(MPIMotion       motion,
                      MPIMotionType   type,
                      MPIMotionParams *params)   
 

Required Header: stdmpi.h

Description

_mpiMotionStart and _mpiMotionModify are streamlined start and modify functions available for point streaming applications using PT or PVT motion. The primary differences between these functions and the standard start/modify are the following:

  • Only PT, PTF, PVT, PVTF moves are supported.
  • No motion attributes are supported.
  • The input parameters are not checked for validity.
  • There is reduced motion status checking prior to executing a move. However, if the axis is in the error state the methods will return an error.
  • There is no on-host buffering of frames, the frames are written directly to the controller.
  • The number of points (params.xx.pointCount) is not checked. Care must be taken to avoid downloading more frames than can be held in the Axis’ frame buffer.
  • The retain parameter is ignored.

Using the fast start/modify methods

Other than the differences noted above, these functions are identical to the standard motion methods, mpiMotionStart(...) and mpiMotionModify(...). These methods are called in the same way as their standard counterparts. The primary difference in their use results from shifting the frame buffer management to the user application. The MPI method meiAxisFrameBufferStatus() is used to determine the number of points that can be loaded by a single call.

The most common use of these functions is for loading new points repetitively at regular intervals. For example, if the host has a timer interrupt that occurs every 10 milliseconds, the frames needed for the next time interval may be loaded. The sample code below shows the use of these methods for this type of application.

_mpiMotionStart and _mpiMotionModify return the following error codes:

Return Values
MPIMotionMessageERROR  
MPIMotionMessageMOVING MotionStart cannot be called when the Motion Supervisor is in the moving state
MPIMessageUNSUPPORTED

The motion type is not supported by the controller.

Possible Causes:
Unsupported motion type specified.

List of supported motion types:
MPIMotionTypePT
MPIMotionTypePVTF

Sample Code

 
#include "stdmpi.h"
#include "stdmei.h"



#define POINT_COUNT     (256)
#define POINT_LOW_LIMIT (20)
#define AXIS_COUNT	(2)

/* Load first points */
pointIndex = 0;
params.pvt.pointCount = POINT_LOW_LIMIT;
params.pvt.position = &position[pointIndex * AXIS_COUNT];
params.pvt.velocity = &velocity[pointIndex * AXIS_COUNT];
params.pvt.time = &time[pointIndex];
params.pvt.point.emptyCount = 5;
pointIndex += POINT_LOW_LIMIT;

returnValue = _mpiMotionStart(motion, MPIMotionTypePVT, ¶ms);
msgCHECK(returnValue);

/* Check and print the frame buffer status*/
while (pointIndex < POINT_COUNT)
{
    
    returnValue = meiAxisFrameBufferStatus(axis[0], &frameBufferStatus);
    msgCHECK(returnValue);
    printf("Frame buffer count is %ld\n", frameBufferStatus.frameCount); 
    
    if(frameBufferStatus.frameCount < POINT_LOW_LIMIT)
    {
        if ((pointIndex + POINT_LOW_LIMIT) < POINT_COUNT)
        {
            params.pvt.pointCount =  POINT_LOW_LIMIT;
            params.pvt.point.final = FALSE;
        }
        else
        {
            params.pvt.pointCount =  POINT_COUNT - pointIndex;
            params.pvt.point.final = TRUE;
        }
        params.pvt.position = &position[pointIndex * AXIS_COUNT];
        params.pvt.velocity = &velocity[pointIndex * AXIS_COUNT];
        params.pvt.time = &time[pointIndex];
        pointIndex += POINT_LOW_LIMIT;
        
        /* Add more points  */
        returnValue = _mpiMotionModify(motion, MPIMotionTypePVT, ¶ms);
        msgCHECK(returnValue);
    }
    meiPlatformSleep(10);
}

 

See Also

mpiMotionStart | mpiMotionModify

 

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