JogAxis
下达一个永远照特定速度移动之运动指令。不同于 MoveAxisVelocity,JogAxis 没有 BufferMode,其将持续移动至寸动输入重设后会才停止。
语法
KsCommandStatus JogAxis(
int Index,
double Velocity,
double Acceleration,
double Deceleration,
double Jerk,
McDirection Direction
);
参数
Index [in]:轴索引。索引以零为起点;别名将影响此参数。
Velocity [in]:指定速度的值,[单位/秒]。
Acceleration [in]:加速度值,单位由 McProfileType 类型决定,(马达的增加能源) [单位/秒2] 或 [秒]。
Deceleration [in]:减速度值,单位由 McProfileType 类型决定,(马达的减少能源) [单位/秒2] 或 [秒]。
Jerk [in]:加加速度值,单位由 McProfileType 类型决定,为 [单位/秒3] 或 [秒]。
Direction [in]:寸动移动的方向,可为 mcPositiveDirection
或 mcNegativeDirection
。请见 McDirection 类型。
回传值
返回 KsCommandStatus 结构。
备注
因 JogAxis 持续控制著轴,当到达极限时将触发错误。
范例
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 |
参见