Ejemplo n.º 1
0
        public static bool CLAMP_DO()
        {
            if (GenericOp.EStop)
            {
                return(false);
            }
            // 重要步骤:上升到最高点(H点)
            SerialWireless.gtryCmd = SerialWireless.GTYRY_CMD.CLAMP;
            if (!SerialWireless.GetGtryState(SerialWireless.GTRY_STATE_CLAMP))
            {
                // 等待,直到命令结束
                return(false);
            }

            return(true);
        }
Ejemplo n.º 2
0
        public static bool CLAMP_RELAX_DO()
        {
            if (GenericOp.EStop || !GenericOp.AutoMode)
            {
                return(false);
            }

            // ---------------------------------------
            //  TODO:   松开夹爪时,一定要判定有无夹具。最好是显示屏给出提示,确认操作。
            //

            // 重要步骤:上升到最高点(H点)
            SerialWireless.gtryCmd = SerialWireless.GTYRY_CMD.CLAMP_RELAX;
            if (!SerialWireless.GetGtryState(SerialWireless.GTRY_STATE_CLAMP_RELAX))
            {
                // 等待,直到命令结束
                return(false);
            }
            return(true);
        }
Ejemplo n.º 3
0
    private void PRE_DOING(int pos_index)
    {
        // ----------------------------------------------------
        // 至上点
        bool isOver = false;

        while (!isOver)
        {
            isOver = Z_TO(zeroPos.Z, 1);       // 上点
            if (!drawOnly)
            {
                isOver = ABTask.Z_TO(true, ABTask.zeroPos.Z, ABTask.zSpeed);
            }
            Thread.Sleep(10);
        }
        if (!drawOnly)
        {
            int a = currTask.AB_TASK_A;
            if ((a == 6 || a == 11 || a == 12 || a == 10) && SerialWireless.GetGtryState(SerialWireless.GTRY_STATE_CLAMP))
            {
                Thread.Sleep(100000);
            }
        }

        // 判断炉盖的状态,如果炉盖已经打开,则允许前行,否则不允许前行
        // 需要打开炉盖的炉子有    _ _ _ 3、4、5、6 _ _ _ 10、11、12
        if (!drawOnly)
        {
            int openStoveLidIndex;
            for (openStoveLidIndex = 0; openStoveLidIndex < 7; openStoveLidIndex++)
            {
                if (stoveLidAction[openStoveLidIndex] == STOVE_LID_ACTION.OPEN)
                {
                    break;// 发现有炉盖需要打开
                }
            }

            //
            SerialManual.STOVE_LID_STATE state;
            if (openStoveLidIndex < 7)
            {
                // 有炉盖需要打开,则不断等待炉盖打开到位信号。
                state = SerialManual.stoveLidState[openStoveLidIndex];     // 查看当前这个炉盖的状态
                while (state != SerialManual.STOVE_LID_STATE.OPENED)
                {                                                          // 等待炉盖打开到位信号。
                    Thread.Sleep(100);                                     // 等待炉盖打开
                    state = SerialManual.stoveLidState[openStoveLidIndex]; // 查看当前这个炉盖的状态

                    // 超时处理
                    // TODO: 如果60秒都没有等到炉盖打开的话,需要给出提示信息。告诉用户炉盖故障:接近开关故障。
                    timeout_openStoveLid++;
                    if (timeout_openStoveLid > 600)
                    {
                        GenericOp.errCode |= 0x01;
                    }
                }
                GenericOp.errCode &= ~0x01;
            }
        }

        // ----------------------------------------------------
        // 进入 A或者B 点区域
        isOver = false;
        while (!isOver)
        {
            isOver = X_TO(loadPoints[pos_index].X, 50);     // 平移 --> A
            if (!drawOnly)
            {
                isOver = ABTask.X_TO(true, ABTask.loadPoints[pos_index].X, ABTask.xSpeed);     // 平移 --> A
            }
            Thread.Sleep(10);
        }
    }