Exemplo n.º 1
0
 private bool BlobAreaDetect(double area, out double[] dblResult)
 {
     return(BackLightLocation.BlobAreaDetect(
                ModelParams.cmd_PreciseFailed,
                ModelParams.AreaMax,
                ModelParams.AreaMin,
                AMP,
                ModelParams.ProductArea,
                area,
                RegeditMain.R_I.ID,
                ModelParams.IfRecordData,
                out dblResult
                ));
 }
Exemplo n.º 2
0
        /// <summary>
        /// 精定位偏差计算
        /// </summary>
        /// <param name="r">第一次定位取得的角度</param>
        /// <param name="delta">像素偏差</param>
        /// <returns></returns>
        private bool BolbDevationCalc(double r, Point2D delta, out Point2D pDelta)
        {
            //根据配方,选择平台放片目标点
            Point4D dst = ModelParams.confWastagePlatStation == 1 ? ModelParams.PosWastagePlat1 : ModelParams.PosWastagePlat2;

            return(BackLightLocation.BolbDevationCalc(dst,
                                                      delta,
                                                      ModelParams.PreciseRobotAngle,
                                                      ModelParams.BotWastageAngle,
                                                      r,
                                                      ModelParams.cmd_PreciseResult,
                                                      ModelParams.cmd_PreciseFailed,
                                                      ModelParams.PreciseThreadX,
                                                      ModelParams.PreciseThreadY,
                                                      ModelParams.BotPlaceAngle,
                                                      ModelParams.DisplayAngle,
                                                      ModelParams.BLPlaceAngle,
                                                      RegeditMain.R_I.ID,
                                                      ModelParams.IfRecordData,
                                                      out pDelta));
        }
Exemplo n.º 3
0
        public bool BlobAngleCalc(string cellName, out Hashtable htResult)
        {
            htResult = null;
            double[] dblResult = new double[2];
            bool     blResult  = true;

            try
            {
                #region 空跑
                if (ParStateSoft.StateMachine_e == StateMachine_enum.NullRun)
                {
                    ShowState(string.Format("相机{0}空跑,默认发送OK", g_NoCamera));
                    LogicRobot.L_I.WriteRobotCMD(ModelParams.PrecisePos, ModelParams.cmd_PreciseAngle);
                    return(true);
                }
                #endregion

                StateComprehensive_enum stateComprehensive_e = g_BaseDealComprehensive.DealComprehensivePosNoDisplay(
                    g_UCDisplayCamera, g_HtUCDisplay, Pos_enum.Pos1, out htResult);
                ResultBlob resultBlob = (ResultBlob)htResult[cellName];

                //算子基准值记录到基准值当中
                if (ModelParams.PreciseStdValue.DblValue1 == 0)
                {
                    ModelParams.PreciseStdValue = new Point2D(resultBlob.StdX, resultBlob.StdY);
                }
                //面积判断
                #region 面积检测
                if (!BlobAreaDetect(resultBlob.Area, out dblResult))
                {
                    ShowState("精定位第一次拍照失败");
                    blResult = false;
                    return(false);
                }
                #endregion

                //一次拍照计算偏差,目前用于和二次拍照进行对比
                BackLightLocation.Verify(new Point2D(resultBlob.X, resultBlob.Y),
                                         new Point2D(resultBlob.StdX, resultBlob.StdY), //不规则区域基准值,即旋转中心
                                         resultBlob.R_J,                                //不规则区域角度
                                         ParCalibWorld.V_I[g_NoCamera],                 //相机系数
                                         ModelParams.BLDisplayType,                     //背光在相机显示中的方向
                                         ModelParams.PreciseRobotAngle,                 //精定位机器人u轴角度
                                         ModelParams.BotWastageAngle,                   //机器人残材平台放片角度
                                         ModelParams.BotPlaceAngle,                     //机器人放置角度
                                         ModelParams.DisplayAngle,                      //相机显示角度
                                         ModelParams.BLPlaceAngle);                     //背光放置方向

                blResult = BackLightLocation.BlobAngleCalc(
                    resultBlob.R_J,                //不规则区域角度
                    ModelParams.PrecisePos,        //机器人精定位位置
                    ModelParams.cmd_PreciseAngle,  //精定位角度调整指令
                    ModelParams.cmd_PreciseFailed, //精定位失败指令
                    ModelParams.PreciseThreadR,    //精定位角度偏差阈值
                    ModelParams.BLDisplayType,     //背光在相机显示中的方向
                    RegeditMain.R_I.ID,            //UniqueID
                    ModelParams.IfRecordData,      //是否进行数据记录
                    out phi);                      //输出实际给机器人补偿的角度
                return(blResult);
            }
            catch (Exception ex)
            {
                Log.L_I.WriteError(NameClass, ex);
                return(false);
            }
            finally
            {
                string strResult = "OK";
                if (!blResult)
                {
                    strResult = "NG";
                }
                g_UCDisplayCamera.ShowResult("面积比例:" + dblResult[1].ToString(ReservDigits) +
                                             "\n角度补正:" + phi.ToString(ReservDigits) +
                                             "\n角度阈值:" + ModelParams.PreciseThreadR.ToString(ReservDigits) +
                                             "\n" + strResult, blResult);
            }
        }