Motion profile complete code

This page contains the complete code of Motion profile.

In AxisConfiguration.cpp, your Motion profile code should be as follows:

Copy
#include "RT_Project_01.h"
#include "AxisConfiguration.h"
using namespace std;

VOID MotionProfile(int Index)
{
    RtPrintf("Create a motion profile.\n");

    McProfileSettings Motion =
    {
        MINIMUM_ERROR,          //MinimumFollowingError
        MAXIMUM_ERROR,          //MaximumFollwingError
        MAXIMUM_VELOCITY,       //MaximumVelocity
        MAXIMUM_ACCELERATION,   //Acceleration
        MAXIMUM_DECELERATION,   //Deceleration
        MAXIMUM_JERK,           //Jerk
        MAXIMUM_JOLT            //Jolt
    };

    //MotionProfileType: profileUnitPerSecond.
    KsError nRet = SetAxisMotionProfile(Index, MOTION_PROFILE_TYPE, Motion);
    if (nRet != errNoError)
        RtPrintf("SetAxisMotionProfile failed: %x\n", nRet);

    RtPrintf("\n");
}