예제 #1
0
        public bool HasRobotFault(ref string message, ref MvRobotAlarmInfo alarmInfo)
        {
            //************IMPORTANT*************************************************//
            //UO[1~20] address has been mapping to DI[1~20] address at addr.22
            //AND using BGLogic assign DI[1]~DI[20] to R[21]~R[40] respectivly
            //If you wanna read UO[1], plz read R[21] and so on
            //**********************************************************************

            object UO6Value      = (byte)0;
            bool   IsReadSuccess = false;

            //1:有err   0:normal
            mobjDataTable.Refresh();
            IsReadSuccess = mobjNumReg.GetValue(26, ref UO6Value);
            if (!IsReadSuccess)
            {
                throw new Exception("Read Fail");
            }
            if ((int)UO6Value == 1)
            {
                alarmInfo           = GetRobotAlarm();
                message             = "Robot Err Occur !";
                HasRobotFaultStatus = true;
                //if (RobotFaultStatus != almInfo.Result) { this.Equipment.IO_Switch("LaserIO", DeviceSwitch.OFF); }
            }
            else
            {
                message             = "Success";
                HasRobotFaultStatus = false;

                //if (RobotFaultStatus != almInfo.Result) { this.Equipment.IO_Switch("LaserIO", DeviceSwitch.ON); }
            }

            return(HasRobotFaultStatus);
        }
예제 #2
0
        /// <summary>
        /// must 用thread
        /// </summary>
        /// <param name="Target"></param>
        /// <param name="_SelectCorJ"></param>
        /// <param name="_SelectOfstOrPos"></param>
        /// <param name="_IsMoveUT"></param>
        /// <param name="Speed"></param>
        /// <returns></returns>
        public bool MoveStraightSync(Array Target, int _SelectCorJ, int _SelectOfstOrPos, int _IsMoveUT, int Speed)
        {
            MoveStraightAsync(Target, _SelectCorJ, _SelectOfstOrPos, _IsMoveUT, Speed);

            while (this.MoveIsComplete())
            {
                m_currRobotInfo = GetCurrRobotInfo();

                var msg       = "";
                var alarmInfo = new MvRobotAlarmInfo();
                if (HasRobotFault(ref msg, ref alarmInfo))
                {
                    break;
                }

                Thread.Sleep(100);
            }

            this.MoveCompeleteReply();

            return(true);
        }
예제 #3
0
        public MvFanucRobotInfo GetCurrRobotInfo()
        {
            lock (lockCurRobotInfo)
            {
                //short ValidC = 0, ValidJ = 0;	// 移除未使用的變數。by YMWANGN, 2016/11/17。
                //Alarm TEST
                var msg       = "";
                var alarmInfo = new MvRobotAlarmInfo();
                HasRobotFault(ref msg, ref alarmInfo);


                var robotInfo = new MvFanucRobotInfo();
                mobjCurPosUF.GetValue(ref robotInfo.posArray, ref robotInfo.configArray, ref robotInfo.jointArray,
                                      ref robotInfo.userFrame, ref robotInfo.userTool, ref robotInfo.validC, ref robotInfo.validJ);
                robotInfo.robotTime = DateTime.Now;

                object R5Value = 0;
                mobjNumReg.GetValue(5, ref R5Value);
                robotInfo.isReachTarget = ((int)R5Value == 51);

                return(robotInfo);
            }
        }
예제 #4
0
        /*AlarmFuncComment
         *
         * Specify argument Count as index of target alarm history item. (Specify 1 for the first item.)
         * Argument AlarmID will have returned alarm ID. In case of ‘SRVO-001’, AlarmID is 11 that represents
         * ‘SRVO’. Please see alarm code table in R-J3 reference. If there is no active alarm, AlarmID is zero for
         * active alarm reference.
         * Argument AlarmNumber will have returned alarm number. In case of ‘SRVO-001’, AlarmNumber is 1.
         * If there is no active alarm, AlarmNumber is zero for active alarm reference.
         * Argument CauseAlarmID will have returned cause alarm ID. Some alarm have two alarm messages.
         * The second alarm is cause code. This argument is to read cause code. If there is no cause code,
         * CauseAlarmID is 0.
         * Argument CauseAlarmNumber will have returned cause alarm Number. This argument is to read cause
         * code alarm number. If there is no cause code, CauseAlarmNumber is 0.
         * Argument Severity will have return alarm severity. Severity value means as follows:
         * NONE 128
         * WARN 0
         * PAUSE.L 2
         * PAUSE.G 34
         * STOP.L 6
         * STOP.G 38
         * SERVO 54
         * ABORT.L 11
         * ABORT.G 43
         * SERVO2 58
         * SYSTEM 123
         * Argument Year, Month, Day, Hour, Minute, Second will have returned alarm occurred date and time (24
         * hours format).
         * Argument AlarmMessage will have returned alarm message. The message is the top line to teach
         * pendant screen includes alarm code like ‘SRVO-001’. (Kanji message not supported.)
         * Argument CauseAlarmMessage will have returned cause code alarm message. (Kanji message not
         * supported)
         * Argument SeverityMessage will have returned alarm severity string like ‘WARN’
         *
         */
        public MvRobotAlarmInfo GetRobotAlarm()
        {
            MvRobotAlarmInfo alminfo = new MvRobotAlarmInfo();

            mobjDataTable.Refresh();
            mobjAlarm.GetValue(
                1,
                ref alminfo.AlarmID,
                ref alminfo.AlarmNumber,
                ref alminfo.CauseAlarmID,
                ref alminfo.CauseAlarmNumber,
                ref alminfo.Severity,
                ref alminfo.Year,
                ref alminfo.Month,
                ref alminfo.Day,
                ref alminfo.Hour,
                ref alminfo.Minute,
                ref alminfo.Second,
                ref alminfo.AlarmMessage,
                ref alminfo.CauseAlarmMessage,
                ref alminfo.SeverityMessage
                );
            return(alminfo);
        }