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 |
參見