| | |
| | | short capture = 0; |
| | | |
| | | GTSCardAPI.TTrapPrm trapPrm; |
| | | //搜索距离 阶段1 |
| | | // 启动Home捕获 |
| | | short sRtn = GTSCardAPI.GT_SetCaptureMode((short)IConfig.CardNum, (short)movingOption.AxisIndex, GTSCardAPI.CAPTURE_HOME); |
| | | |
| | | // 切换到点位运动模式 |
| | | sRtn = GTSCardAPI.GT_PrfTrap((short)IConfig.CardNum, (short)movingOption.AxisIndex); |
| | | short sRtn = GTSCardAPI.GT_PrfTrap((short)IConfig.CardNum, (short)movingOption.AxisIndex); |
| | | // 读取点位模式运动参数 |
| | | sRtn = GTSCardAPI.GT_GetTrapPrm((short)IConfig.CardNum, (short)movingOption.AxisIndex, out trapPrm); |
| | | trapPrm.acc = movingOption.VelocityPara.Acc; |
| | |
| | | { |
| | | PositionReset(movingOption.AxisIndex, 1); |
| | | ClearStatus(movingOption.AxisIndex, 1); |
| | | |
| | | //搜索距离 阶段1 |
| | | // 启动Home捕获 |
| | | sRtn = GTSCardAPI.GT_SetCaptureMode((short)IConfig.CardNum, (short)movingOption.AxisIndex, GTSCardAPI.CAPTURE_HOME); |
| | | |
| | | // 设置点位模式目标位置,即原点搜索距离 |
| | | sRtn = GTSCardAPI.GT_SetPos((short)IConfig.CardNum, (short)movingOption.AxisIndex, homeDirection ? 99999999 : -99999999); |
| | |
| | | |
| | | if (isStop && capture != 1) |
| | | { |
| | | ClearStatus((short)movingOption.AxisIndex, 1); |
| | | |
| | | if (((axisStatus.AxisStatus & 0x20) != 0) || ((axisStatus.AxisStatus & 0x40) != 0)) |
| | | { |
| | | //movingOption.GoHomePara.HomeDir = (short)(movingOption.GoHomePara.HomeDir == 1 ? -1 : 1); |
| | |
| | | isRightLimitReached = true; |
| | | } |
| | | |
| | | |
| | | //负限位 |
| | | if ((axisStatus.AxisStatus & 0x40) != 0 && goHomePara.IsCaptureDirPositive) |
| | | { |
| | |
| | | |
| | | homeDirection = !homeDirection; |
| | | } |
| | | |
| | | ClearStatus(movingOption.AxisIndex, 1); |
| | | } |
| | | |
| | | if (capture == 1) |
| | |
| | | if (!isRightLimitReached) |
| | | { |
| | | capture = 0; |
| | | ClearStatus(movingOption.AxisIndex, 1); |
| | | //GTSCardAPI.GT_SetCaptureMode((short)IConfig.CardNum, (short)movingOption.AxisIndex, GTSCardAPI.CAPTURE_HOME); |
| | | continue; |
| | | } |
| | |
| | | //先stop |
| | | MoveStop((short)movingOption.AxisIndex, 0); |
| | | ClearStatus((short)movingOption.AxisIndex, 1); |
| | | |
| | | //已经捕获到Home才可以回零 阶段2 |
| | | // 运动到"捕获位置+偏移量" |
| | | sRtn = GTSCardAPI.GT_SetPos((short)IConfig.CardNum, (short)movingOption.AxisIndex, pos + goHomePara.HomeOffset); |