MoveAxisAbsolute
Commands a controlled motion to a specified absolute position.
Syntax
KsCommandStatus MoveAxisAbsolute(
int Index,
double Position,
double Velocity,
double Acceleration,
double Deceleration,
double Jerk,
McDirection Direction,
McBufferMode BufferMode
);
Parameters
Index [in]: the index of an axis. Indexes are zero based. Aliases affect this parameter.
Position [in]: the target position for the motion. [unit] (negative or positive)
Velocity [in]: a value of the maximum velocity. Not necessarily reached if the target position is close. [unit/second]
Acceleration [in]: a value of the acceleration. Always positive. The unit is determined by the McProfileType type. (increasing power of the motor) [unit/second2] or [second]
Deceleration [in]: a value of the deceleration. Always positive. The unit is determined by the McProfileType type. (decreasing power of the motor) [unit/second2] or [second]
Jerk [in]: a value of the jerk. Always positive. The unit is determined by the McProfileType type. [unit/second3] or [second]
Direction [in]: the moving direction of an axis. See the McDirection type.
BufferMode [in]: defines how to blend the velocity of two functions. See the McBufferMode type.
Return value
Returns the KsCommandStatus structure.
Remarks
- If this command is aborted, the untraveled distance will be abandoned.
- This action completes with velocity zero if no further actions are pending.
- If there is only one mathematical solution to reach the commanded position (like in linear systems), the value of the input Direction is ignored.
- For modulo axis, valid absolute position values are in the range of [0, 360), or corresponding range. The application however may shift the "commanded position" of MoveAxisAbsolute into the corresponding modulo range.
- The enum type
mcShortestWay
focuses on a trajectory that goes through the shortest route. The decision which direction to go is based on the current position where the command is sent. - For more information about how the blending modes work, see Concepts > Blend movements.
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