Normal group stop

A normal stop is to decelerate a group first and then stop it, so the group won't be damaged during the stopping process.

Functions

HaltGroup: decelerates a group until the velocity of the group is zero. While the group is decelerating, it is in the GroupMoving state. When the group's velocity is zero, the group is in the GroupStandStill state. You can send another motion function to move the group when it is in GroupStandStill.

WaitForCommand: waits for a command to be finished.

 

To test HaltGroup, use it with a continuous move command such as JogGroup. Because a group needs some time to be stopped, we use WaitForCommand to give it a few seconds to finish its work.

Code

In GroupMotion.cpp, add the following code:

Copy

HaltGroup

VOID GroupHalt(int Group)
{
    //Give some time for the axis to be halted.
    KsCommandStatus halt = WaitForCommand(5, FALSE, HaltGroup(Group, MAXIMUM_DECELERATION,
        MAXIMUM_JERK, mcAborting));
    if (halt.Error)
        RtPrintf("HaltGroup failed: %d\n", halt.ErrorId);

    RtPrintf("Halt Group %d.\n\n", Group);
}

 

Output:

Jog group: while the axes are jogging, they keep moving without a target or distance until you stop them, so the end positions are where they are detected by GetAGroupPosition.