Relative linear move

The way Relative moves an axis group is "distance." You decide how far your group moves. The starting point is the group's current position, and the distance is how far your group moves. Each axis moves to the specified position just like it does when you move it alone. The difference is that all the axes move concurrently when they are in the same group.

Functions

MoveLinearRelative: moves an axis group a specified distance.

GetAGroupPosition: gets and displays the set and actual positions of a group. For further details, see Get and set group values.

MoveLinearRelative

MoveLinearRelative moves an axis group from the starting point. The axis group stops after it travels the specified distance.

Starting point: this is where your axis group is now. It is zero.

Distance: how far your axis group moves. It is 10000.

Notice the following parameters:

BufferMode and TransitionMode are relevant to blending. For more information about blending, see Blend movements.

Code

When you make a linear move, you can choose to use blending or not. We demonstrate this function without blending. For more information about a blending sample, see Blending for group motion.

In GroupMotion.cpp, add the following code:

Copy

MoveLinearRelative

VOID MoveLinearRelativeGroup(int Group)
{
    RtPrintf("Make linear relative group move.\n\n");

    const int LENGTH = 3;   //The length of the Distance array.
    double Distance[LENGTH] = { 5000, 6000, 7000 };

    KsCommandStatus relativeMove = WaitForCommand(30, TRUE, MoveLinearRelative(Group, LENGTH,
        Distance, MAXIMUM_VELOCITY, MAXIMUM_ACCELERATION, MAXIMUM_DECELERATION,
        MAXIMUM_JERK, mcAxisCoordSystem, mcAborting, mcNone, NULL));

    if (relativeMove.Error)
        RtPrintf("MoveLinearRelative failed: %d\n\n", relativeMove.ErrorId);

    //Wait a few cycles to get the correct end positions.
    Sleep(5);

    //Display the end positions.
    RtPrintf("End positions:\n\n");
    GetAGroupPosition(Group);
}

 

Output:

Distance: 5000, 6000, 7000