Additive linear move

The way Additive moves an axis group is "distance." Just like Relative, you decide how far your group moves. The difference is that Additive adds a distance after the group reaches a position or travels a distance commanded by the previous function. Additive can be used independently or with Absolute or Relative.

Functions

MoveLinearAdditive: moves an axis group a specified distance from the last commanded position.

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

MoveLinearAdditive

MoveLinearAdditive moves an axis group from the last commanded position. The axis group stops after it travels the specified distance.

Starting point: this is where your group starts traveling. It is zero.

Relative distance: the relative distance your group travels. It is 10000.

Absolute position: the target position your group will reach. It is 10000. This is where MoveLinearAdditive starts to move.

Additive distance: the additional distance the group will travel after it reaches a position or travels a distance commanded by the previous motion command. It is 4000.

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

MoveLinearAdditive

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

    const int LENGTH = 3;   //The length of the Distance array.
    double Distance[LENGTH] = { -3000, -2000, -4000 };

    KsCommandStatus additiveMove = WaitForCommand(30, TRUE, MoveLinearAdditive(Group, LENGTH,
        Distance, MAXIMUM_VELOCITY, MAXIMUM_ACCELERATION, MAXIMUM_DECELERATION, MAXIMUM_JERK,
        mcAxisCoordSystem, mcAborting, mcNone, NULL));
    if (additiveMove.Error)
        RtPrintf("MoveLinearAdditive failed: %d\n\n", additiveMove.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:

Relative distance: 5000, 6000, 7000

Additive distance: -3000, -2000, -4000