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