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.

Code

In SingleAxisMotion.cpp, add the following code:

Copy

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: