HaltAxis
Commands a controlled motion stop. The axis is in the Discrete Motion state until the velocity is zero. With the Done
field of KsCommandStatus set to TRUE, the state is changed to Standstill.
Syntax
KsCommandStatus HaltAxis(
int Index,
double Deceleration,
double Jerk,
McBufferMode BufferMode
);
Parameters
Index [in]: the index of an axis. Indexes are zero based. Aliases affect this parameter.
Deceleration [in]: a value of the deceleration. The unit is determined by the McProfileType type. [unit/second2] or [second]
Jerk [in]: a value of the jerk. The unit is determined by the McProfileType type. [unit/second3] or [second]
BufferMode [in]: defines how to blend the velocity of two functions. See the McBufferMode type.
Return value
Returns the KsCommandStatus structure.
Remarks
- HaltAxis is used to stop the axis under normal operation conditions. In the non-buffered mode, it is possible to set another motion command during deceleration of the axis, which will abort HaltAxis and will be executed immediately.
- If this function is active the next command can be sent. For example, a driverless vehicle detects an obstacle and needs to stop. HaltAxis is sent. Before the Standstill is reached, the obstacle is removed and the motion can be continued by setting another motion command, so the vehicle doesn't stop.
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