Jog
Jog moves an axis continuously at the specified velocity. After you send a Jog command, the axis will accelerate to the specified velocity and keeps moving at that speed, until you stop it.
Functions
JogAxis: moves an axis at a specified velocity without a target or distance. The axis keeps moving until it is stopped.
GetAnAxisVelocity: displays the velocity of an axis. For further details, see Get and set values.
GetAnAxisPosition: displays the end position of an axis. For further details, see Get and set values.
JogAxis
JogAxis makes a Jog move. Its direction is controlled by the Direction parameter. It can be mcPositiveDirection
or mcNegativeDirection
. See the McDirection type.
Stop a Jog move
You can use HaltAxis or StopAxis to stop a Jog move. For more information about how to use these functions, see Stop a movement.
- HaltAxis: decelerates an axis and puts it into the StandStill state after the velocity of the axis reaches zero. The axis can be moved by other motion functions later.
- StopAxis: decelerates an axis and puts it into the Stopping state after the velocity of the axis reaches zero. This function is for an emergency stop. When an axis is in Stopping, other functions can't move the axis, unless the state is aborted by AbortCommand.
Code
In SingleAxisMotion.cpp
, add the following code:
JogAxis
VOID Jog(int Index)
{
RtPrintf("Make a jog move.\n\n");
//Start a jog move.
KsCommandStatus status = JogAxis(Index, MAXIMUM_VELOCITY, MAXIMUM_ACCELERATION,
MAXIMUM_DECELERATION, MAXIMUM_JERK, mcNegativeDirection);
if (status.Error)
RtPrintf("JogAxis failed: %d\n", status.ErrorId);
//Let the axis moves for a while.
Sleep(5000);
GetAnAxisVelocity(Index);
RtPrintf("End position:\n");
GetAnAxisPosition(Index);
}
Output: