HaltAxis
命令控制的运动站。直到速度为零前,轴将维持在离散运动状态,KsCommandStatus 的 Done
栏位设为 TRUE ,则状态变更为静止 (Standstill)。
语法
KsCommandStatus HaltAxis(
int Index,
double Deceleration,
double Jerk,
McBufferMode BufferMode
);
参数
Index [in]:轴索引。索引以零为起点;别名将影响此参数。
Deceleration [in]:减速度值,单位由 McProfileType 类型决定,为 [单位/秒2] 或 [秒]。
Jerk [in]:加加速度值,单位由 McProfileType 类型决定,为 [单位/秒3] 或 [秒]。
BufferMode [in]:定义如何融合两功能的速度,请见 McBufferMode 类型。
回传值
返回 KsCommandStatus 结构。
备注
- HaltAxis 在正常运作情况下用来停止轴,在非缓冲区模式,可在轴减速时设定另一个运动指令,此将中断 HaltAxis 且指令会立即生效。
- 此函式执行中时可传送下一个指令,例如,当一无人驾驶车辆侦测到障碍物需要停止时传送了 HaltAxis,在到达静止 (Standstill) 状态前,障碍物即被移除,且可透过设置另一个运动命令继续移动,因此车辆不会停止。
范例
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));
}
使用需求
RT | Win32 | |
---|---|---|
最低支援版本 | 4.0 | 4.0 |
标头档 | ksmotion.h | ksmotion.h |
程式库 | KsApi_Rtss.lib | KsApi.lib |
参见