GetAxisVelocity
Gets the current velocity from an axis. The velocity can be set velocity or actual velocity.
Syntax
KsError GetAxisVelocity(
int Index,
McSource Source,
double* Velocity
);
Parameters
Index: the index of an axis. Indexes are zero based. Aliases affect this parameter.
Source: selects a velocity value to read. See the McSource type.
Velocity: pointer to the value to receive the velocity.
Return value
If the function succeeds, it returns errNoError
, otherwise an error code. For more information about the error code, see the KsError list.
Example
VOID MoveVelocity(INT Index, DOUBLE Velocity, INT Duration) {
McDirection direction = mcPositiveDirection;
if (Velocity < 0)
direction = mcNegativeDirection;
//Start the velocity motion
KsCommandStatus status = WaitForCommand(5, FALSE, JogAxis(Index, Velocity,
36000, 36000, 3600000, direction));
double velocity = 0;
KsError nRet = GetAxisVelocity(Index, mcActualValue, &velocity);
RtPrintf("Current Velocity: %d degree/s\n", (int)velocity);
//Let it spin a bit
Sleep(3000);
//Stop the axis
status = WaitForCommand(5, FALSE, HaltAxis(Index, 36000, 3600000, mcAborting));
}
Requirements
RT | Win32 | |
---|---|---|
Minimum supported version | 4.0 | 4.0 |
Header | ksmotion.h | ksmotion.h |
Library | KsApi_Rtss.lib | KsApi.lib |
See also