/// <summary> /// 去皮带线取片,采用基准值+像素偏差*系数进行计算 /// </summary> /// <param name="htResult"></param> /// <returns></returns> public StateComprehensive_enum BeltPick(out Hashtable htResult) { htResult = null; try { StateComprehensive_enum stateComprehensive_e = g_BaseDealComprehensive.DealComprehensivePosNoDisplay( g_UCDisplayCamera, g_HtUCDisplay, Pos_enum.Pos1, out htResult); BaseResult result = (BaseResult)htResult[strCamera8Match1]; ResultTemplate temp = (ResultTemplate)htResult[strCamera8Template1]; if (result.X * result.Y == 0) { FinishPhotoPLC(2); ShowState("皮带线定位失败"); return(StateComprehensive_enum.False); } Point4D dst = ModelParams.BeltPickPos; dst.DblValue1 += result.DeltaY * ParCalibWorld.V_I[g_NoCamera]; dst.DblValue2 += result.DeltaX * ParCalibWorld.V_I[g_NoCamera]; LogicRobot.L_I.WriteRobotCMD(dst, ModelParams.cmd_BeltPick); FinishPhotoPLC(1); ShowState(string.Format("皮带线机器人取片位置:{0}", dst.ToString())); return(StateComprehensive_enum.True); } catch (Exception ex) { Log.L_I.WriteError(NameClass, ex); return(StateComprehensive_enum.False); } }
/// <summary> /// 粗定位 /// </summary> /// <param name="cellName"></param> /// <param name="htResult"></param> /// <returns></returns> public StateComprehensive_enum CalcPickPos(string cellName, out Hashtable htResult) { htResult = null; try { #region 空跑 if (ParStateSoft.StateMachine_e == StateMachine_enum.NullRun) { WriteTPick(0); WritePickDelta(new Point2D(1, -1)); WriteQrCodeDelta(new Point2D(1, -1)); FinishPhotoPLC(CameraResult.OK); SendTData(DataRegister1.TAngle_pickPlat1, DataRegister1.TAngleConfirm_pickPlat1, ModelParams.T_Roller, "机器人去平台取片"); return(StateComprehensive_enum.True); } #endregion StateComprehensive_enum stateComprehensive_e = g_BaseDealComprehensive.DealComprehensivePosNoDisplay( g_UCDisplayCamera, g_HtUCDisplay, Pos_enum.Pos1, out htResult); ResultScaledShape result = (ResultScaledShape)htResult[cellName]; ResultTemplate template = (ResultTemplate)htResult[cellName + @"T"]; if (result.X * result.Y == 0) { g_UCDisplayCamera.ShowResult("未识别到产品", "red"); FinishPhotoPLC(CameraResult.NG); } else { CalcPickDelta(new Point2D(result.X, result.Y), ModelParams.stdPxlCamera1, ParCalibWorld.V_I[1]); CalcQrCodeDelta(result.R_J + template.RCenterProfile / Math.PI * 180); WriteTPick(-(result.R_J + template.RCenterProfile / Math.PI * 180) + ModelParams.adjTPickPlat); //直接给确认信号 SendTData(DataRegister1.TAngle_pickPlat1, DataRegister1.TAngleConfirm_pickPlat1, ModelParams.T_Roller, "机器人去平台取片"); FinishPhotoPLC(CameraResult.OK); } return(StateComprehensive_enum.True); } catch (Exception ex) { Log.L_I.WriteError(NameClass, ex); FinishPhotoPLC(CameraResult.NG); return(StateComprehensive_enum.False); } }
internal StaticFunction() : base( (KeyValuePair <string, ParameterType>[])ArgumentsTemplate.Clone(), (KeyValuePair <string, ParameterType>[])ResultTemplate.Clone()) { }