Absolute linear move
The way Absolute moves an axis group is "position." You decide the position your group moves to. The starting point is the group's current position, and the end point is the target position. The target position is counted from the origin in the specified coordinate system. 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
MoveLinearAbsolute: moves an axis group to an absolute position.
GetAGroupPosition: gets and displays the set and actual positions of a group. For further details, see Get and set group values.
MoveLinearAbsolute
MoveLinearAbsolute: moves an axis group from the starting point to end point. The group stops after it reaches the end point.
Starting point: this is where your group is now. It is zero.
Endpoint: the target position your group will reach. It is 10000.
Notice the following parameters:
- Length: the length of the Position array.
- Position: the target positions (end points) for each axis in the group. It is an array.
- BufferMode: defines how to blend the velocity of two functions. See the McBufferMode type. For details, see Chapter 5: Single-Axis Motion > Motion states -> Common parameters.
- TransitionMode: inserts a transition curve to blend the path. If you want to perform a sequence of movements smoothly, you need to use this parameter. In KS 4.2, KINGSTAR supports only
mcCornerDistance
. See the McTransitionMode type.
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:
MoveLinearAbsolute
VOID MoveLinearAbsoluteGroup(int Group)
{
RtPrintf("Make a linear absolute group move.\n\n");
const int LENGTH = 3; //The length of the Position array.
double EndPositions[LENGTH] = { 4000, 3000, 5000 };
KsCommandStatus absoluteMove = WaitForCommand(30, TRUE, MoveLinearAbsolute(Group, LENGTH,
EndPositions, MAXIMUM_VELOCITY, MAXIMUM_ACCELERATION, MAXIMUM_DECELERATION,
MAXIMUM_JERK, mcAxisCoordSystem, mcAborting, mcNone, NULL));
if (absoluteMove.Error)
RtPrintf("MoveLinearAbsolute failed: %d\n\n", absoluteMove.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:
Target positions: 4000, 3000, 5000