优化单个扫码和单个定位

master
lhiven 1 year ago
parent 6ddbaaf621
commit 8a4601f073

@ -138,7 +138,7 @@ namespace Rs.MotionPlat.Flow.Camera
/// 检测周转盘放料是否OK
/// </summary>
/// <returns></returns>
public static VisionResult TurnoverTrayDumpProductOK(HObject image,bool bNeedLocation=true,bool bNeedScanBarcode=true)
public static VisionResult TurnoverTrayDumpProductOK(HObject image,bool bNeedLocation=true,bool bNeedScanBarcode=true,int slotIndex=0)
{
upCameraScanBarCodeModel = new ModelParameter("周转盘产品定位");
VisionResult vr = new VisionResult();
@ -201,7 +201,7 @@ namespace Rs.MotionPlat.Flow.Camera
{
Directory.CreateDirectory($"d://images/{DateTime.Now.ToString("yyyyMMdd")}");
}
HOperatorSet.WriteImage(image, "bmp", 0, $"d://images/{DateTime.Now.ToString("yyyyMMdd")}//{sn}");
HOperatorSet.WriteImage(image, "bmp", 0, $"d://images/{DateTime.Now.ToString("yyyyMMdd")}//{sn}_{slotIndex}");
vr.ScanBarCodeOK = true;
vr.SN = sn;
}

@ -1467,7 +1467,7 @@ namespace Rs.MotionPlat.Flow
else
{
//如果没有粘料,说明产品放下去了,这个时候用相机检测产品是否在穴位种
UpCameraScanBarCodeFlow.Instance.ScanSingle(curNozzle.ToIndex + 1, true);
UpCameraScanBarCodeFlow.Instance.ScanSingle(curNozzle.ToIndex + 1, true,true,true);
VisionResult vr = UpCameraScanBarCodeFlow.Instance.WaitSingle();
if (UpCameraScanBarCodeFlow.Instance.CheckResult(vr))
{
@ -1500,7 +1500,7 @@ namespace Rs.MotionPlat.Flow
case ETipButton.Retry://重拍
logInfo = GetClassName() + $"选择了重拍";
MessageQueue.Instance.Insert(logInfo);
UpCameraScanBarCodeFlow.Instance.ScanSingle(curNozzle.ToIndex + 1, true);
UpCameraScanBarCodeFlow.Instance.ScanSingle(curNozzle.ToIndex + 1, true,true,true);
vr = UpCameraScanBarCodeFlow.Instance.WaitSingle();
if (UpCameraScanBarCodeFlow.Instance.CheckResult(vr))
{
@ -1875,7 +1875,7 @@ namespace Rs.MotionPlat.Flow
if (failNum < 4)
{
//如果扫码失败再重扫一次
UpCameraScanBarCodeFlow.Instance.ScanSingle(vr.SlotIndex, true);
UpCameraScanBarCodeFlow.Instance.ScanSingle(vr.SlotIndex, true,false,true);
VisionResult vrsigle = UpCameraScanBarCodeFlow.Instance.WaitSingle();
if (vrsigle.ScanBarCodeOK)
{
@ -1966,7 +1966,7 @@ namespace Rs.MotionPlat.Flow
{
//如果扫码失败再重扫一次
UpCameraScanBarCodeFlow.Instance.ScanSingle(vr.SlotIndex, true);
UpCameraScanBarCodeFlow.Instance.ScanSingle(vr.SlotIndex, true,false,true);
VisionResult vrsigle = UpCameraScanBarCodeFlow.Instance.WaitSingle();
if (vrsigle.ScanBarCodeOK)
{

@ -1919,7 +1919,7 @@ namespace Rs.MotionPlat.Flow
TransitModuleSafePosFlow.Instance.GoSafePostion( EExceptionSafePos.Socket);
//2 排料轴上相机过来检测
DischargeFlow.Instance.WaitCanMove();
UpCameraScanBarCodeFlow.Instance.ScanSingle(slot.Index, true);
UpCameraScanBarCodeFlow.Instance.ScanSingle(slot.Index, true,true,false);
VisionResult vr = UpCameraScanBarCodeFlow.Instance.WaitSingle();
needGoSafePos = true;
if (!UpCameraScanBarCodeFlow.Instance.CheckResult(vr))//如果不在穴位中,就弹框报警
@ -1935,7 +1935,7 @@ namespace Rs.MotionPlat.Flow
case ETipButton.Retry:
logInfo = GetClassName() + "选择了重试";
MessageQueue.Instance.Insert(logInfo);
UpCameraScanBarCodeFlow.Instance.ScanSingle(slot.Index, true);
UpCameraScanBarCodeFlow.Instance.ScanSingle(slot.Index, true,true,false);
vr = UpCameraScanBarCodeFlow.Instance.WaitSingle();
if(UpCameraScanBarCodeFlow.Instance.CheckResult(vr))
{

@ -243,7 +243,7 @@ namespace Rs.MotionPlat.Flow.SubFlow
VisionResult vr = new VisionResult();
if (TurnoverTrayManager.Instance.Slot(sIndex).IsHasProduct)
{
vr = VisionManager.TurnoverTrayDumpProductOK(img,GlobalVar.EnableTurnoverTrayRecheck);
vr = VisionManager.TurnoverTrayDumpProductOK(img,GlobalVar.EnableTurnoverTrayRecheck,true,sIndex);
}
vr.SlotIndex = sIndex;
vReslutList.Add(vr);
@ -260,7 +260,7 @@ namespace Rs.MotionPlat.Flow.SubFlow
}
public void ScanSingle(int SlotIndex,bool needGo=true)
public void ScanSingle(int SlotIndex,bool needGo=true,bool bNeedLocate=true,bool bNeedScanBarcode=true)
{
if (exit == false) return;
grabFinishedEvent.Reset();
@ -335,7 +335,7 @@ namespace Rs.MotionPlat.Flow.SubFlow
}
break;
case EUpCameraFixedScanBarCodeFlowStep.:
singleResult = VisionManager.TurnoverTrayDumpProductOK(imageSingle,true,false);
singleResult = VisionManager.TurnoverTrayDumpProductOK(imageSingle, bNeedLocate, bNeedScanBarcode, SlotIndex);
singleResult.SlotIndex = SlotIndex;
exit = true;
grabFinishedEvent.Set();

@ -40,6 +40,12 @@
this.btnSystem = new Rs.Controls.ButtonEx();
this.btnRecipe = new Rs.Controls.ButtonEx();
this.panel1 = new System.Windows.Forms.Panel();
this.panel5 = new System.Windows.Forms.Panel();
this.lblMemory = new System.Windows.Forms.Label();
this.panel4 = new System.Windows.Forms.Panel();
this.lblTurnoverFlow = new System.Windows.Forms.Label();
this.panel3 = new System.Windows.Forms.Panel();
this.lblDischargeFlow = new System.Windows.Forms.Label();
this.panelEx2 = new Rs.Controls.PanelEx();
this.lblRunState = new System.Windows.Forms.Label();
this.tableLayoutPanel3 = new System.Windows.Forms.TableLayoutPanel();
@ -49,18 +55,15 @@
this.panel2 = new System.Windows.Forms.Panel();
this.lblVersion = new System.Windows.Forms.Label();
this.timer1 = new System.Windows.Forms.Timer(this.components);
this.panel3 = new System.Windows.Forms.Panel();
this.lblDischargeFlow = new System.Windows.Forms.Label();
this.panel4 = new System.Windows.Forms.Panel();
this.lblTurnoverFlow = new System.Windows.Forms.Label();
this.tableLayoutPanel2.SuspendLayout();
this.panel1.SuspendLayout();
this.panel5.SuspendLayout();
this.panel4.SuspendLayout();
this.panel3.SuspendLayout();
this.panelEx2.SuspendLayout();
this.tableLayoutPanel3.SuspendLayout();
this.panelEx1.SuspendLayout();
this.panel2.SuspendLayout();
this.panel3.SuspendLayout();
this.panel4.SuspendLayout();
this.SuspendLayout();
//
// panel_main
@ -287,6 +290,7 @@
// panel1
//
this.panel1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(46)))), ((int)(((byte)(46)))), ((int)(((byte)(46)))));
this.panel1.Controls.Add(this.panel5);
this.panel1.Controls.Add(this.panel4);
this.panel1.Controls.Add(this.panel3);
this.panel1.Controls.Add(this.panelEx2);
@ -298,6 +302,65 @@
this.panel1.Size = new System.Drawing.Size(1594, 33);
this.panel1.TabIndex = 7;
//
// panel5
//
this.panel5.Controls.Add(this.lblMemory);
this.panel5.Dock = System.Windows.Forms.DockStyle.Right;
this.panel5.Location = new System.Drawing.Point(1231, 0);
this.panel5.Name = "panel5";
this.panel5.Size = new System.Drawing.Size(126, 33);
this.panel5.TabIndex = 5;
//
// lblMemory
//
this.lblMemory.Dock = System.Windows.Forms.DockStyle.Fill;
this.lblMemory.ForeColor = System.Drawing.Color.White;
this.lblMemory.Location = new System.Drawing.Point(0, 0);
this.lblMemory.Name = "lblMemory";
this.lblMemory.Size = new System.Drawing.Size(126, 33);
this.lblMemory.TabIndex = 0;
this.lblMemory.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// panel4
//
this.panel4.Controls.Add(this.lblTurnoverFlow);
this.panel4.Dock = System.Windows.Forms.DockStyle.Left;
this.panel4.Location = new System.Drawing.Point(546, 0);
this.panel4.Name = "panel4";
this.panel4.Size = new System.Drawing.Size(215, 33);
this.panel4.TabIndex = 4;
//
// lblTurnoverFlow
//
this.lblTurnoverFlow.Dock = System.Windows.Forms.DockStyle.Fill;
this.lblTurnoverFlow.ForeColor = System.Drawing.Color.White;
this.lblTurnoverFlow.Location = new System.Drawing.Point(0, 0);
this.lblTurnoverFlow.Name = "lblTurnoverFlow";
this.lblTurnoverFlow.Size = new System.Drawing.Size(215, 33);
this.lblTurnoverFlow.TabIndex = 3;
this.lblTurnoverFlow.Text = "Turnover:";
this.lblTurnoverFlow.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// panel3
//
this.panel3.Controls.Add(this.lblDischargeFlow);
this.panel3.Dock = System.Windows.Forms.DockStyle.Left;
this.panel3.Location = new System.Drawing.Point(331, 0);
this.panel3.Name = "panel3";
this.panel3.Size = new System.Drawing.Size(215, 33);
this.panel3.TabIndex = 3;
//
// lblDischargeFlow
//
this.lblDischargeFlow.Dock = System.Windows.Forms.DockStyle.Fill;
this.lblDischargeFlow.ForeColor = System.Drawing.Color.White;
this.lblDischargeFlow.Location = new System.Drawing.Point(0, 0);
this.lblDischargeFlow.Name = "lblDischargeFlow";
this.lblDischargeFlow.Size = new System.Drawing.Size(215, 33);
this.lblDischargeFlow.TabIndex = 3;
this.lblDischargeFlow.Text = "Discharge:";
this.lblDischargeFlow.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// panelEx2
//
this.panelEx2.Controls.Add(this.lblRunState);
@ -388,46 +451,6 @@
this.timer1.Interval = 300;
this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
//
// panel3
//
this.panel3.Controls.Add(this.lblDischargeFlow);
this.panel3.Dock = System.Windows.Forms.DockStyle.Left;
this.panel3.Location = new System.Drawing.Point(331, 0);
this.panel3.Name = "panel3";
this.panel3.Size = new System.Drawing.Size(215, 33);
this.panel3.TabIndex = 3;
//
// lblDischargeFlow
//
this.lblDischargeFlow.Dock = System.Windows.Forms.DockStyle.Fill;
this.lblDischargeFlow.ForeColor = System.Drawing.Color.White;
this.lblDischargeFlow.Location = new System.Drawing.Point(0, 0);
this.lblDischargeFlow.Name = "lblDischargeFlow";
this.lblDischargeFlow.Size = new System.Drawing.Size(215, 33);
this.lblDischargeFlow.TabIndex = 3;
this.lblDischargeFlow.Text = "Discharge:";
this.lblDischargeFlow.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// panel4
//
this.panel4.Controls.Add(this.lblTurnoverFlow);
this.panel4.Dock = System.Windows.Forms.DockStyle.Left;
this.panel4.Location = new System.Drawing.Point(546, 0);
this.panel4.Name = "panel4";
this.panel4.Size = new System.Drawing.Size(215, 33);
this.panel4.TabIndex = 4;
//
// lblTurnoverFlow
//
this.lblTurnoverFlow.Dock = System.Windows.Forms.DockStyle.Fill;
this.lblTurnoverFlow.ForeColor = System.Drawing.Color.White;
this.lblTurnoverFlow.Location = new System.Drawing.Point(0, 0);
this.lblTurnoverFlow.Name = "lblTurnoverFlow";
this.lblTurnoverFlow.Size = new System.Drawing.Size(215, 33);
this.lblTurnoverFlow.TabIndex = 3;
this.lblTurnoverFlow.Text = "Turnover:";
this.lblTurnoverFlow.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// Home
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
@ -446,12 +469,13 @@
this.Controls.SetChildIndex(this.panel_main, 0);
this.tableLayoutPanel2.ResumeLayout(false);
this.panel1.ResumeLayout(false);
this.panel5.ResumeLayout(false);
this.panel4.ResumeLayout(false);
this.panel3.ResumeLayout(false);
this.panelEx2.ResumeLayout(false);
this.tableLayoutPanel3.ResumeLayout(false);
this.panelEx1.ResumeLayout(false);
this.panel2.ResumeLayout(false);
this.panel3.ResumeLayout(false);
this.panel4.ResumeLayout(false);
this.ResumeLayout(false);
}
@ -482,5 +506,7 @@
private System.Windows.Forms.Label lblTurnoverFlow;
private System.Windows.Forms.Panel panel3;
private System.Windows.Forms.Label lblDischargeFlow;
private System.Windows.Forms.Panel panel5;
private System.Windows.Forms.Label lblMemory;
}
}

@ -118,7 +118,7 @@ namespace Rs.MotionPlat.Recipe
btnLocateCheck.Enabled = false;
}));
UpCameraScanBarCodeFlow.Instance.ScanSingle(1,false);
UpCameraScanBarCodeFlow.Instance.ScanSingle(1,false,true,false);
VisionResult vr= UpCameraScanBarCodeFlow.Instance.WaitSingle();
if(vr != null)
{

Loading…
Cancel
Save