Velocity
Velocity moves an axis continuously at the specified velocity. After you send a Velocity command, the axis will accelerate to the specified velocity and keeps moving at that speed, until you stop it.
Functions
MoveAxisVelocity: 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.
Stop a Velocity move
To stop a Velocity move, you can use HaltAxis or StopAxis. 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:
MoveAxisVelocity
VOID Velocity(int Index)
{
RtPrintf("Make a velocity move.\n\n");
//Start a velocity move.
KsCommandStatus status = MoveAxisVelocity(Index, MAXIMUM_VELOCITY, MAXIMUM_ACCELERATION,
MAXIMUM_DECELERATION, MAXIMUM_JERK, mcNegativeDirection, mcAborting);
if (status.Error)
RtPrintf("MoveAxisVelocity failed: %d\n", status.ErrorId);
//Let the axis moves for a while.
Sleep(6000);
GetAnAxisVelocity(Index);
RtPrintf("End position:\n");
GetAnAxisPosition(Index);
}
Output: