Motion profile

To create a motion profile for an axis, use SetAxisMotionProfile.

The unit of acceleration and jerk

Before you move an axis, you can decide the unit of acceleration and jerk, which is described in the McProfileType type. The unit determines how an axis accelerates and decelerates.

Code

To create a motion profile, create an instance of the McProfileSettings structure and use SetAxisMotionProfile. In AxisConfiguration.cpp, add the following code:

Copy
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");
}