GetAxisPosition
Gets the current position from an axis. The position can be set position or actual position.
Syntax
KsError GetAxisPosition(
int Index,
McSource Source,
double* Position
);
Parameters
Index: the index of an axis. Indexes are zero based. Aliases affect this parameter.
Source: selects a position value to read. See the McSource type.
Position: pointer to the value to receive the current position.
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 MoveAbsolute(INT Index, DOUBLE Target) {
//The direction is reserved for cyclic axes so it is currently ignored.
//Start an absolute move.
KsCommandStatus status = WaitForCommand(30, TRUE, MoveAxisAbsolute(Index, Target,
3600, 36000, 36000, 3600000, mcPositiveDirection, mcAborting));
//Print the final position.
double setPosition = 0;
KsError nRet = GetAxisPosition(Index, mcSetValue, &setPosition);
double actPosition = 0;
nRet = GetAxisPosition(Index, mcSetValue, &actPosition);
RtPrintf("Current Position: Target %d, Actual %d\n", (int)setPosition, (int)actPosition);
}
Requirements
RT | Win32 | |
---|---|---|
Minimum supported version | 4.0 | 4.0 |
Header | ksmotion.h | ksmotion.h |
Library | KsApi_Rtss.lib | KsApi.lib |
See also