优化周转取放料报警流程

master
lhiven 2 years ago
parent 3c92553d26
commit f0d5189704

@ -562,5 +562,38 @@ namespace Rs.Framework
return SysConfigParam.GetValue<double>(nameof(TestFixtureForceNozzePressHeight)); return SysConfigParam.GetValue<double>(nameof(TestFixtureForceNozzePressHeight));
} }
} }
/// <summary>
/// 周转盘产品定位X范围
/// </summary>
public static double TurnoverTrayLocateXRange
{
get
{
return SysConfigParam.GetValue<double>(nameof(TurnoverTrayLocateXRange));
}
}
/// <summary>
/// 周转盘产品定位Y范围
/// </summary>
public static double TurnoverTrayLocateYRange
{
get
{
return SysConfigParam.GetValue<double>(nameof(TurnoverTrayLocateYRange));
}
}
/// <summary>
/// 周转盘产品定位R范围
/// </summary>
public static double TurnoverTrayLocateRRange
{
get
{
return SysConfigParam.GetValue<double>(nameof(TurnoverTrayLocateRRange));
}
}
} }
} }

@ -141,11 +141,8 @@ namespace Rs.MotionPlat.Commom
Task.Run(() => { Task.Run(() => {
if(MachineManage.Instance.MachineStatus== EMachineStatus.Homed || MachineManage.Instance.MachineStatus== EMachineStatus.Stop) if(MachineManage.Instance.MachineStatus== EMachineStatus.Homed || MachineManage.Instance.MachineStatus== EMachineStatus.Stop)
{ {
if(!WorkEnvironment.Instance.EnvironmentOk) WorkEnvironment.Instance.Ready();
{ WorkEnvironment.Instance.EnvReadyOkEvent.WaitOne();
WorkEnvironment.Instance.Ready();
WorkEnvironment.Instance.EnvReadyOkEvent.WaitOne();
}
DischargeFlow.Instance.Start(); DischargeFlow.Instance.Start();
TurnoverFlow.Instance.Start(); TurnoverFlow.Instance.Start();
MachineManage.Instance.SetCenterMachineStatus(ERunStatus.Started); MachineManage.Instance.SetCenterMachineStatus(ERunStatus.Started);

@ -110,23 +110,23 @@ namespace Rs.MotionPlat.Commom
{ {
if (eOperator == EVacOperator.Open) if (eOperator == EVacOperator.Open)
{ {
Ops.On($"周转盘{index}号吸嘴真空吸"); Ops.On($"周转盘{index}号穴位真空吸");
} }
else else
{ {
Ops.Off($"周转盘{index}号吸嘴真空吸"); Ops.Off($"周转盘{index}号穴位真空吸");
} }
} }
if (eOperator == EVacOperator.Open) if (eOperator == EVacOperator.Open)
{ {
Thread.Sleep(GlobalVar.TurnoverNozzleOpenVacBreakDelaytime); Thread.Sleep(GlobalVar.TurnoverNozzleOpenVacBreakDelaytime);
MessageQueue.Instance.Insert($"打开周转盘{string.Join(",", indexes)}号吸嘴真空吸"); MessageQueue.Instance.Insert($"打开周转盘{string.Join(",", indexes)}号穴位真空吸");
} }
else else
{ {
Thread.Sleep(GlobalVar.TurnoverNozzleCloseVacBreakDelaytime); Thread.Sleep(GlobalVar.TurnoverNozzleCloseVacBreakDelaytime);
MessageQueue.Instance.Insert($"关闭周转盘{string.Join(",", indexes)}号吸嘴真空吸"); MessageQueue.Instance.Insert($"关闭周转盘{string.Join(",", indexes)}号穴位真空吸");
} }
} }
} }
@ -144,23 +144,23 @@ namespace Rs.MotionPlat.Commom
{ {
if (eOperator == EVacOperator.Open) if (eOperator == EVacOperator.Open)
{ {
Ops.On($"周转盘{index}号吸嘴真空破"); Ops.On($"周转盘{index}号穴位真空破");
} }
else else
{ {
Ops.Off($"周转盘{index}号吸嘴真空破"); Ops.Off($"周转盘{index}号穴位真空破");
} }
} }
if (eOperator == EVacOperator.Open) if (eOperator == EVacOperator.Open)
{ {
Thread.Sleep(GlobalVar.TurnoverNozzleOpenVacBreakDelaytime); Thread.Sleep(GlobalVar.TurnoverNozzleOpenVacBreakDelaytime);
MessageQueue.Instance.Insert($"打开周转盘{indexes.ToJoinString()}号真空破"); MessageQueue.Instance.Insert($"打开周转盘{indexes.ToJoinString()}号穴位真空破");
} }
else else
{ {
Thread.Sleep(GlobalVar.TurnoverNozzleCloseVacBreakDelaytime); Thread.Sleep(GlobalVar.TurnoverNozzleCloseVacBreakDelaytime);
MessageQueue.Instance.Insert($"关闭周转盘{indexes.ToJoinString()}号真空破"); MessageQueue.Instance.Insert($"关闭周转盘{indexes.ToJoinString()}号穴位真空破");
} }
} }
} }

@ -127,20 +127,19 @@ namespace Rs.MotionPlat.Commom
/// <returns></returns> /// <returns></returns>
public bool HasVacSignal() public bool HasVacSignal()
{ {
if(Ops.IsOn("")) if(Ops.IsOn($"周转{NozzleIndex}号吸嘴真空吸检测"))
return true; return true;
return false; return false;
} }
public void CloseVac() public void CloseVac()
{ {
Ops.Off(""); VacManager.TransitNozzleVacSuction(EVacOperator.Close, NozzleIndex);
} }
public void OpenVac() public void OpenVac()
{ {
VacManager.TransitNozzleVacSuction(EVacOperator.Open, NozzleIndex);
Ops.On("");
} }
} }
} }

@ -176,7 +176,7 @@ namespace Rs.MotionPlat.Flow.Camera
HOperatorSet.Threshold(searchImg, out HObject whiteRegion, new HTuple(200), new HTuple(255)); HOperatorSet.Threshold(searchImg, out HObject whiteRegion, new HTuple(200), new HTuple(255));
//checkFinishedEvent?.Invoke(hImage); //checkFinishedEvent?.Invoke(hImage);
HOperatorSet.AreaCenter(whiteRegion, out HTuple area, out HTuple row1, out HTuple column1); HOperatorSet.AreaCenter(whiteRegion, out HTuple area, out HTuple row1, out HTuple column1);
if(area.D>30000) if(area.D>25000)
{ {
return 1; return 1;
} }
@ -220,7 +220,7 @@ namespace Rs.MotionPlat.Flow.Camera
if (score.Length > 0) if (score.Length > 0)
{ {
vr.OffsetX = (column.D-upCameraScanBarCodeModel.ModelMatchResult[1].D) * GlobalVar.UpCameraMmPerPixel; vr.OffsetX = (column.D-upCameraScanBarCodeModel.ModelMatchResult[1].D) * GlobalVar.UpCameraMmPerPixel;
vr.OffsetY = (row.D- upCameraScanBarCodeModel.ModelMatchResult[0].D) * GlobalVar.UpCameraMmPerPixel; vr.OffsetY =-1 * (row.D- upCameraScanBarCodeModel.ModelMatchResult[0].D) * GlobalVar.UpCameraMmPerPixel;
vr.OffsetR = AngleTool.Rad2Deg((angle.D - upCameraScanBarCodeModel.ModelMatchResult[2].D)); vr.OffsetR = AngleTool.Rad2Deg((angle.D - upCameraScanBarCodeModel.ModelMatchResult[2].D));
vr.SourceImage = image; vr.SourceImage = image;
vr.SearchModelOK = true; vr.SearchModelOK = true;

@ -464,7 +464,8 @@ namespace Rs.MotionPlat.Flow
break; break;
case ETipButton.Skip: case ETipButton.Skip:
bool haveProduct = false; bool haveProduct = false;
MessageQueue.Instance.Insert($"{nameof(DischargeFlow)}-选择了跳过"); logInfo = GetClassName() + "选择了跳过";
MessageQueue.Instance.Insert(logInfo);
if(curTask.FromType== TurnoverType.ToBeTested) if(curTask.FromType== TurnoverType.ToBeTested)
{ {
if(!StockManager.Instance.GetStock(ETrayType.Input).HasTray()) if(!StockManager.Instance.GetStock(ETrayType.Input).HasTray())
@ -500,7 +501,8 @@ namespace Rs.MotionPlat.Flow
} }
if(!haveProduct) if(!haveProduct)
{ {
MessageQueue.Instance.Insert($"{nameof(DischargeFlow)}-检测到产品已拿走,流程继续"); logInfo = GetClassName() + "检测到产品已拿走,流程继续";
MessageQueue.Instance.Insert(logInfo);
reFetchNum = 0; reFetchNum = 0;
//执行料仓Tray取料NG时的处理流程流程处理结束后流程继续 //执行料仓Tray取料NG时的处理流程流程处理结束后流程继续
if (curTask.FromType == TurnoverType.Turnover) if (curTask.FromType == TurnoverType.Turnover)

@ -3,6 +3,7 @@ using Rs.Controls;
using Rs.Framework; using Rs.Framework;
using Rs.MotionPlat.Commom; using Rs.MotionPlat.Commom;
using Rs.MotionPlat.Entitys.Trays; using Rs.MotionPlat.Entitys.Trays;
using Rs.MotionPlat.Flow.Camera;
using Rs.MotionPlat.Flow.SafePosFlow; using Rs.MotionPlat.Flow.SafePosFlow;
using Rs.MotionPlat.Flow.SubFlow; using Rs.MotionPlat.Flow.SubFlow;
using System; using System;
@ -731,7 +732,9 @@ namespace Rs.MotionPlat.Flow
case ETipButton.Retry: case ETipButton.Retry:
if (Ops.IsOn($"测试{nozzle.NozzleIndex}号穴位真空吸检测")) if (Ops.IsOn($"测试{nozzle.NozzleIndex}号穴位真空吸检测"))
{ {
GlobalTray.TestTray.ChangeStatus(nozzle.NozzleIndex, ESlotStatus.Have);
TestTrayManager.Instance.Slot(nozzle.NozzleIndex).AddProduct(nozzle); TestTrayManager.Instance.Slot(nozzle.NozzleIndex).AddProduct(nozzle);
nozzle.Clear();
exit = true; exit = true;
} }
break; break;
@ -1378,17 +1381,27 @@ namespace Rs.MotionPlat.Flow
{ {
TurnoverTraySlot slot = TurnoverTrayManager.Instance.Slot(nozzle.ToIndex+1); TurnoverTraySlot slot = TurnoverTrayManager.Instance.Slot(nozzle.ToIndex+1);
//GlobalTray.TurnoverTray.ChangeStatus(nozzle.ToIndex, ESlotStatus.Have); //GlobalTray.TurnoverTray.ChangeStatus(nozzle.ToIndex, ESlotStatus.Have);
slot.AddProduct(nozzle);
//TurnoverTrayManager.Instance.Slot(nozzle.ToIndex).AddProduct(nozzle.SN, nozzle.NozzleIndex, TurnoverType.Turnover, nozzle.NozzleIndex); //TurnoverTrayManager.Instance.Slot(nozzle.ToIndex).AddProduct(nozzle.SN, nozzle.NozzleIndex, TurnoverType.Turnover, nozzle.NozzleIndex);
nozzle.Clear();
if (slot.HasVac() || GlobalVar.VirtualAxis|| GlobalVar.RunSpace) if (slot.HasVac() || GlobalVar.VirtualAxis|| GlobalVar.RunSpace)
{ {
slot.AddProduct(nozzle);
GlobalTray.TurnoverTray.ChangeStatus(slot.Index, ESlotStatus.Have); GlobalTray.TurnoverTray.ChangeStatus(slot.Index, ESlotStatus.Have);
slot.VacException = false; slot.VacException = false;
nozzle.Clear();
} }
else else
{ {
slot.VacException = true; //slot.VacException = true;
//1 退到安全位
TransitModuleSafePosFlow.Instance.GoSafePostion();
//2 排料轴上相机过来检测
UpCameraScanBarCodeFlow.Instance.ScanSingle(slot.Index, true);
VisionResult vr = UpCameraScanBarCodeFlow.Instance.WaitSingle();
if(!UpCameraScanBarCodeFlow.Instance.CheckResult(vr))//如果不在穴位中,就弹框报警
{
}
} }
} }
if(TurnoverTrayManager.Instance.GetSlots(ETurnoverTraySlotType.Tested, ETurnoverTraySlotStatus.VacException).Count>0) if(TurnoverTrayManager.Instance.GetSlots(ETurnoverTraySlotType.Tested, ETurnoverTraySlotStatus.VacException).Count>0)

@ -32,40 +32,42 @@ namespace Rs.MotionPlat.Flow.SafePosFlow
/// </summary> /// </summary>
public override void GoSafePostion() public override void GoSafePostion()
{ {
double targetPos = 0.0;
step = EGoSafePosFlowStep.; step = EGoSafePosFlowStep.;
finished = false;
while (true && !finished) while (true && !finished)
{ {
switch (step) switch (step)
{ {
case EGoSafePosFlowStep.: case EGoSafePosFlowStep.:
targetPos = SysConfigParam.GetValue<double>("TurnoverTakeX");
errCode = AxisControl.LoadX.MovePos(SysConfigParam.GetValue<double>("LoadXStartPos"), GlobalVar.WholeSpeed); errCode = AxisControl.TurnoverX.MovePos(targetPos, GlobalVar.WholeSpeed);
if (errCode == ErrorCode.Ok || GlobalVar.VirtualAxis) if (errCode == ErrorCode.Ok || GlobalVar.VirtualAxis)
{ {
errCode = AxisControl.LoadY.MovePos(SysConfigParam.GetValue<double>("LoadYStartPos"), GlobalVar.WholeSpeed); targetPos = SysConfigParam.GetValue<double>("PressY");
errCode = AxisControl.TurnoverY.MovePos(targetPos, GlobalVar.WholeSpeed);
if (errCode == ErrorCode.Ok || GlobalVar.VirtualAxis) if (errCode == ErrorCode.Ok || GlobalVar.VirtualAxis)
{ {
logInfo = GetClassName() + $"到安全位";
MessageQueue.Instance.Insert(logInfo);
if (GlobalVar.VirtualAxis) if (GlobalVar.VirtualAxis)
{ {
Thread.Sleep(GlobalVar.VirtualAxisMoveTime); Thread.Sleep(GlobalVar.VirtualAxisMoveTime);
} }
logInfo = GetClassName() + $"到安全位";
MessageQueue.Instance.Insert(logInfo);
step = EGoSafePosFlowStep.; step = EGoSafePosFlowStep.;
} }
else else
{ {
//MoveFailAlarm(AxisAlias.LoadY, errCode); Msg.ShowError($"轴TurnoverY运动异常 ret:{errCode}");
} }
} }
else else
{ {
//MoveFailAlarm(AxisAlias.LoadX, errCode); Msg.ShowError($"轴TurnoverY运动异常 ret:{errCode}");
} }
break; break;
case EGoSafePosFlowStep.: case EGoSafePosFlowStep.:
if (Ops.IsStop("LoadX", "LoadY") || GlobalVar.VirtualAxis) if (Ops.IsStop("TurnoverX", "TurnoverY") || GlobalVar.VirtualAxis)
{ {
logInfo = GetClassName()+ $"已运动到安全位"; logInfo = GetClassName()+ $"已运动到安全位";
MessageQueue.Instance.Insert(logInfo); MessageQueue.Instance.Insert(logInfo);

@ -52,7 +52,15 @@ namespace Rs.MotionPlat.Flow.SubFlow
switch (step) switch (step)
{ {
case ELaserFlowStep.: case ELaserFlowStep.:
targetSlot = TrayPointManager.GetTurnoverTrayCheckHeighPoint(slotIndex); if(trayType== ETrayType.Turnover)
{
targetSlot = TrayPointManager.GetTurnoverTrayCheckHeighPoint(slotIndex);
}
else if(trayType== ETrayType.Test)
{
targetSlot = TrayPointManager.GetTestFixtureTrayCheckHeighPoint(slotIndex);
}
if (targetSlot != null) if (targetSlot != null)
{ {
if (Ops.Go(AxisAlias.TurnoverX, targetSlot.X) || GlobalVar.VirtualAxis) if (Ops.Go(AxisAlias.TurnoverX, targetSlot.X) || GlobalVar.VirtualAxis)
@ -95,7 +103,15 @@ namespace Rs.MotionPlat.Flow.SubFlow
double heightVal = DeviceFactory.checkHeightDev.Read(); double heightVal = DeviceFactory.checkHeightDev.Read();
logInfo = GetClassName() + $"开始测高:{heightVal}"; logInfo = GetClassName() + $"开始测高:{heightVal}";
MessageQueue.Instance.Insert(logInfo); MessageQueue.Instance.Insert(logInfo);
hasProduct = Math.Abs(heightVal - 0.5) < 0.5; if(trayType== ETrayType.Turnover)
{
hasProduct = !(Math.Abs(GlobalVar.TurnoverCheckBaseHeight-heightVal) < 0.1);
}
else if(trayType== ETrayType.Test)
{
hasProduct = !(Math.Abs(GlobalVar.TestFixtureCheckBaseHeight - heightVal) < 0.1);
}
finished = true; finished = true;
break; break;

@ -75,9 +75,10 @@ namespace Rs.MotionPlat.Flow.SubFlow
/// </summary> /// </summary>
/// <param name="slotIndex"></param> /// <param name="slotIndex"></param>
/// <returns></returns> /// <returns></returns>
public bool CheckTurnoverTrayHasProduct(Action<HObject> checkFinishedEvent,int slotIndex=1) public bool CheckTurnoverTrayHasProduct(Action<HObject> checkFinishedEvent,int slotIndex=1,bool needGo=true)
{ {
Go(ETrayType.Turnover, slotIndex); if (needGo)
Go(ETrayType.Turnover, slotIndex);
int result = VisionManager.TurnoverTrayHasProduct(checkFinishedEvent); int result = VisionManager.TurnoverTrayHasProduct(checkFinishedEvent);
if (result == 1) if (result == 1)
return true; return true;

@ -72,6 +72,7 @@ namespace Rs.MotionPlat.Flow.SubFlow
/// <param name="isReverse">是否反转拍照</param> /// <param name="isReverse">是否反转拍照</param>
public void ScanMulti(int startSlotIndex,bool isReverse) public void ScanMulti(int startSlotIndex,bool isReverse)
{ {
if(exit==false) return;
grabFinishedEvent.Reset(); grabFinishedEvent.Reset();
SlotPoint startPoint = TrayPointManager.GetSlotPoint(ETrayType.Turnover, startSlotIndex); SlotPoint startPoint = TrayPointManager.GetSlotPoint(ETrayType.Turnover, startSlotIndex);
SlotPoint endPoint = new SlotPoint(); SlotPoint endPoint = new SlotPoint();
@ -228,12 +229,25 @@ namespace Rs.MotionPlat.Flow.SubFlow
} }
public void ScanSingle(int SlotIndex) public void ScanSingle(int SlotIndex,bool needGo=true)
{ {
if (exit == false) return;
grabFinishedEvent.Reset(); grabFinishedEvent.Reset();
HObject imageSingle = new HObject(); HObject imageSingle = new HObject();
exit = false; exit = false;
fixedStep = EUpCameraFixedScanBarCodeFlowStep.; if(!needGo)
{
ImageProcess.ClearManualTrigger();
//HikCamera.Instance.SetExposure("upCamera", GlobalVar.FlyGrabExposureTime);
//HikCamera.Instance.SetGain("upCamera", 15);
HikCamera.Instance.SetTrigger("upCamera", ETriggerMode.Manual);
AxisControl.LoadX.ComparePulse(2, false);
fixedStep = EUpCameraFixedScanBarCodeFlowStep.;
}
else
{
fixedStep = EUpCameraFixedScanBarCodeFlowStep.;
}
Task.Run(() => { Task.Run(() => {
while (!exit) while (!exit)
{ {
@ -257,6 +271,10 @@ namespace Rs.MotionPlat.Flow.SubFlow
MessageQueue.Instance.Insert(logInfo); MessageQueue.Instance.Insert(logInfo);
fixedStep = EUpCameraFixedScanBarCodeFlowStep.; fixedStep = EUpCameraFixedScanBarCodeFlowStep.;
} }
}
else
{
} }
break; break;
case EUpCameraFixedScanBarCodeFlowStep.: case EUpCameraFixedScanBarCodeFlowStep.:
@ -270,6 +288,10 @@ namespace Rs.MotionPlat.Flow.SubFlow
logInfo = GetClassName() + $"已运动到扫码起始位"; logInfo = GetClassName() + $"已运动到扫码起始位";
MessageQueue.Instance.Insert(logInfo); MessageQueue.Instance.Insert(logInfo);
fixedStep = EUpCameraFixedScanBarCodeFlowStep.; fixedStep = EUpCameraFixedScanBarCodeFlowStep.;
}
else
{
} }
break; break;
case EUpCameraFixedScanBarCodeFlowStep.: case EUpCameraFixedScanBarCodeFlowStep.:
@ -282,8 +304,8 @@ namespace Rs.MotionPlat.Flow.SubFlow
} }
break; break;
case EUpCameraFixedScanBarCodeFlowStep.: case EUpCameraFixedScanBarCodeFlowStep.:
exit = true;
singleResult = VisionManager.TurnoverTrayDumpProductOK(imageSingle); singleResult = VisionManager.TurnoverTrayDumpProductOK(imageSingle);
exit = true;
grabFinishedEvent.Set(); grabFinishedEvent.Set();
break; break;
} }
@ -308,5 +330,10 @@ namespace Rs.MotionPlat.Flow.SubFlow
grabFinishedEvent.WaitOne(); grabFinishedEvent.WaitOne();
return singleResult; return singleResult;
} }
public bool CheckResult(VisionResult vr)
{
return ((Math.Abs(vr.OffsetX)-GlobalVar.TurnoverTrayLocateXRange<=0)&&(Math.Abs(vr.OffsetY) - GlobalVar.TurnoverTrayLocateYRange <= 0) &&(Math.Abs(vr.OffsetR) - GlobalVar.TurnoverTrayLocateRRange <= 0));
}
} }
} }

@ -11,6 +11,7 @@ using Rs.MotionPlat.Commom;
using Rs.MotionPlat.Entitys.Trays; using Rs.MotionPlat.Entitys.Trays;
using Rs.MotionPlat.Flow; using Rs.MotionPlat.Flow;
using Rs.MotionPlat.Flow.Camera; using Rs.MotionPlat.Flow.Camera;
using Rs.MotionPlat.Flow.SafePosFlow;
using Rs.MotionPlat.Flow.Space; using Rs.MotionPlat.Flow.Space;
using Rs.MotionPlat.Flow.SubFlow; using Rs.MotionPlat.Flow.SubFlow;
using Rs.MotionPlat.SysConfig; using Rs.MotionPlat.SysConfig;
@ -356,5 +357,10 @@ namespace Rs.MotionPlat
GlobalTray.GetTray(ETrayType.Empty2).Status = EStockTrayStatus.Empty.ToString(); GlobalTray.GetTray(ETrayType.Empty2).Status = EStockTrayStatus.Empty.ToString();
} }
} }
private void button1_Click(object sender, EventArgs e)
{
TransitModuleSafePosFlow.Instance.GoSafePostion();
}
} }
} }

@ -155,6 +155,7 @@
this.groupBox34 = new System.Windows.Forms.GroupBox(); this.groupBox34 = new System.Windows.Forms.GroupBox();
this.hwin_turnoverSlot32 = new ChoiceTech.Halcon.Control.HWindow_Final(); this.hwin_turnoverSlot32 = new ChoiceTech.Halcon.Control.HWindow_Final();
this.tableLayoutPanel4 = new System.Windows.Forms.TableLayoutPanel(); this.tableLayoutPanel4 = new System.Windows.Forms.TableLayoutPanel();
this.button1 = new System.Windows.Forms.Button();
this.panel1.SuspendLayout(); this.panel1.SuspendLayout();
this.tableLayoutPanel3.SuspendLayout(); this.tableLayoutPanel3.SuspendLayout();
this.panel3.SuspendLayout(); this.panel3.SuspendLayout();
@ -961,6 +962,7 @@
// //
// gboxNozzle6 // gboxNozzle6
// //
this.gboxNozzle6.Controls.Add(this.button1);
this.gboxNozzle6.Controls.Add(this.himgNozzle6); this.gboxNozzle6.Controls.Add(this.himgNozzle6);
this.gboxNozzle6.Dock = System.Windows.Forms.DockStyle.Fill; this.gboxNozzle6.Dock = System.Windows.Forms.DockStyle.Fill;
this.gboxNozzle6.ForeColor = System.Drawing.Color.White; this.gboxNozzle6.ForeColor = System.Drawing.Color.White;
@ -2058,6 +2060,16 @@
this.tableLayoutPanel4.Size = new System.Drawing.Size(777, 14); this.tableLayoutPanel4.Size = new System.Drawing.Size(777, 14);
this.tableLayoutPanel4.TabIndex = 0; this.tableLayoutPanel4.TabIndex = 0;
// //
// button1
//
this.button1.Location = new System.Drawing.Point(19, 76);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(75, 23);
this.button1.TabIndex = 13;
this.button1.Text = "button1";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// FormMain // FormMain
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
@ -2261,5 +2273,6 @@
private ChoiceTech.Halcon.Control.HWindow_Final hwin_turnoverSlot24; private ChoiceTech.Halcon.Control.HWindow_Final hwin_turnoverSlot24;
private ChoiceTech.Halcon.Control.HWindow_Final hwin_turnoverSlot32; private ChoiceTech.Halcon.Control.HWindow_Final hwin_turnoverSlot32;
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel4; private System.Windows.Forms.TableLayoutPanel tableLayoutPanel4;
private System.Windows.Forms.Button button1;
} }
} }

@ -42,16 +42,17 @@
this.groupBox1 = new System.Windows.Forms.GroupBox(); this.groupBox1 = new System.Windows.Forms.GroupBox();
this.groupBox3 = new System.Windows.Forms.GroupBox(); this.groupBox3 = new System.Windows.Forms.GroupBox();
this.himgNozzle8 = new ChoiceTech.Halcon.Control.HWindow_Final(); this.himgNozzle8 = new ChoiceTech.Halcon.Control.HWindow_Final();
this.textBox2 = new System.Windows.Forms.TextBox(); this.txtTurnoverTrayLocateRRange = new System.Windows.Forms.TextBox();
this.label2 = new System.Windows.Forms.Label(); this.label2 = new System.Windows.Forms.Label();
this.textBox1 = new System.Windows.Forms.TextBox(); this.txtTurnoverTrayLocateYRange = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label(); this.label1 = new System.Windows.Forms.Label();
this.txtFlyGrabExposureTime = new System.Windows.Forms.TextBox(); this.txtTurnoverTrayLocateXRange = new System.Windows.Forms.TextBox();
this.label5 = new System.Windows.Forms.Label(); this.label5 = new System.Windows.Forms.Label();
this.label4 = new System.Windows.Forms.Label(); this.label4 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label(); this.label3 = new System.Windows.Forms.Label();
this.label12 = new System.Windows.Forms.Label(); this.label12 = new System.Windows.Forms.Label();
this.lblResult = new System.Windows.Forms.Label(); this.lblResult = new System.Windows.Forms.Label();
this.btnLocateCheck = new System.Windows.Forms.Button();
this.btnCheck = new System.Windows.Forms.Button(); this.btnCheck = new System.Windows.Forms.Button();
this.gboxPoints = new System.Windows.Forms.GroupBox(); this.gboxPoints = new System.Windows.Forms.GroupBox();
this.dgvBasePoints = new System.Windows.Forms.DataGridView(); this.dgvBasePoints = new System.Windows.Forms.DataGridView();
@ -100,7 +101,6 @@
this.takeProductToolStripMenuItem8 = new System.Windows.Forms.ToolStripMenuItem(); this.takeProductToolStripMenuItem8 = new System.Windows.Forms.ToolStripMenuItem();
this.dumpProductToolStripMenuItem8 = new System.Windows.Forms.ToolStripMenuItem(); this.dumpProductToolStripMenuItem8 = new System.Windows.Forms.ToolStripMenuItem();
this.moveToolStripMenuItem8 = new System.Windows.Forms.ToolStripMenuItem(); this.moveToolStripMenuItem8 = new System.Windows.Forms.ToolStripMenuItem();
this.btnLocateCheck = new System.Windows.Forms.Button();
this.panelEx1.SuspendLayout(); this.panelEx1.SuspendLayout();
this.panel1.SuspendLayout(); this.panel1.SuspendLayout();
this.panel2.SuspendLayout(); this.panel2.SuspendLayout();
@ -169,11 +169,11 @@
// groupBox1 // groupBox1
// //
this.groupBox1.Controls.Add(this.groupBox3); this.groupBox1.Controls.Add(this.groupBox3);
this.groupBox1.Controls.Add(this.textBox2); this.groupBox1.Controls.Add(this.txtTurnoverTrayLocateRRange);
this.groupBox1.Controls.Add(this.label2); this.groupBox1.Controls.Add(this.label2);
this.groupBox1.Controls.Add(this.textBox1); this.groupBox1.Controls.Add(this.txtTurnoverTrayLocateYRange);
this.groupBox1.Controls.Add(this.label1); this.groupBox1.Controls.Add(this.label1);
this.groupBox1.Controls.Add(this.txtFlyGrabExposureTime); this.groupBox1.Controls.Add(this.txtTurnoverTrayLocateXRange);
this.groupBox1.Controls.Add(this.label5); this.groupBox1.Controls.Add(this.label5);
this.groupBox1.Controls.Add(this.label4); this.groupBox1.Controls.Add(this.label4);
this.groupBox1.Controls.Add(this.label3); this.groupBox1.Controls.Add(this.label3);
@ -216,18 +216,19 @@
this.himgNozzle8.Size = new System.Drawing.Size(437, 420); this.himgNozzle8.Size = new System.Drawing.Size(437, 420);
this.himgNozzle8.TabIndex = 13; this.himgNozzle8.TabIndex = 13;
// //
// textBox2 // txtTurnoverTrayLocateRRange
// //
this.textBox2.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(16)))), ((int)(((byte)(16)))), ((int)(((byte)(16))))); this.txtTurnoverTrayLocateRRange.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(16)))), ((int)(((byte)(16)))), ((int)(((byte)(16)))));
this.textBox2.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.txtTurnoverTrayLocateRRange.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.textBox2.Font = new System.Drawing.Font("宋体", 9F); this.txtTurnoverTrayLocateRRange.Font = new System.Drawing.Font("宋体", 9F);
this.textBox2.ForeColor = System.Drawing.Color.White; this.txtTurnoverTrayLocateRRange.ForeColor = System.Drawing.Color.White;
this.textBox2.Location = new System.Drawing.Point(356, 26); this.txtTurnoverTrayLocateRRange.Location = new System.Drawing.Point(356, 26);
this.textBox2.Name = "textBox2"; this.txtTurnoverTrayLocateRRange.Name = "txtTurnoverTrayLocateRRange";
this.textBox2.Size = new System.Drawing.Size(61, 21); this.txtTurnoverTrayLocateRRange.Size = new System.Drawing.Size(61, 21);
this.textBox2.TabIndex = 44; this.txtTurnoverTrayLocateRRange.TabIndex = 44;
this.textBox2.Text = "3"; this.txtTurnoverTrayLocateRRange.Text = "3";
this.textBox2.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; this.txtTurnoverTrayLocateRRange.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
this.txtTurnoverTrayLocateRRange.KeyUp += new System.Windows.Forms.KeyEventHandler(this.txtTurnoverTrayLocateRange_KeyUp);
// //
// label2 // label2
// //
@ -238,18 +239,19 @@
this.label2.TabIndex = 43; this.label2.TabIndex = 43;
this.label2.Text = "OffsetR:"; this.label2.Text = "OffsetR:";
// //
// textBox1 // txtTurnoverTrayLocateYRange
// //
this.textBox1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(16)))), ((int)(((byte)(16)))), ((int)(((byte)(16))))); this.txtTurnoverTrayLocateYRange.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(16)))), ((int)(((byte)(16)))), ((int)(((byte)(16)))));
this.textBox1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.txtTurnoverTrayLocateYRange.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.textBox1.Font = new System.Drawing.Font("宋体", 9F); this.txtTurnoverTrayLocateYRange.Font = new System.Drawing.Font("宋体", 9F);
this.textBox1.ForeColor = System.Drawing.Color.White; this.txtTurnoverTrayLocateYRange.ForeColor = System.Drawing.Color.White;
this.textBox1.Location = new System.Drawing.Point(214, 26); this.txtTurnoverTrayLocateYRange.Location = new System.Drawing.Point(214, 26);
this.textBox1.Name = "textBox1"; this.txtTurnoverTrayLocateYRange.Name = "txtTurnoverTrayLocateYRange";
this.textBox1.Size = new System.Drawing.Size(61, 21); this.txtTurnoverTrayLocateYRange.Size = new System.Drawing.Size(61, 21);
this.textBox1.TabIndex = 44; this.txtTurnoverTrayLocateYRange.TabIndex = 44;
this.textBox1.Text = "0.2"; this.txtTurnoverTrayLocateYRange.Text = "0.2";
this.textBox1.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; this.txtTurnoverTrayLocateYRange.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
this.txtTurnoverTrayLocateYRange.KeyUp += new System.Windows.Forms.KeyEventHandler(this.txtTurnoverTrayLocateRange_KeyUp);
// //
// label1 // label1
// //
@ -260,18 +262,19 @@
this.label1.TabIndex = 43; this.label1.TabIndex = 43;
this.label1.Text = "OffsetY:"; this.label1.Text = "OffsetY:";
// //
// txtFlyGrabExposureTime // txtTurnoverTrayLocateXRange
// //
this.txtFlyGrabExposureTime.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(16)))), ((int)(((byte)(16)))), ((int)(((byte)(16))))); this.txtTurnoverTrayLocateXRange.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(16)))), ((int)(((byte)(16)))), ((int)(((byte)(16)))));
this.txtFlyGrabExposureTime.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.txtTurnoverTrayLocateXRange.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.txtFlyGrabExposureTime.Font = new System.Drawing.Font("宋体", 9F); this.txtTurnoverTrayLocateXRange.Font = new System.Drawing.Font("宋体", 9F);
this.txtFlyGrabExposureTime.ForeColor = System.Drawing.Color.White; this.txtTurnoverTrayLocateXRange.ForeColor = System.Drawing.Color.White;
this.txtFlyGrabExposureTime.Location = new System.Drawing.Point(65, 26); this.txtTurnoverTrayLocateXRange.Location = new System.Drawing.Point(65, 26);
this.txtFlyGrabExposureTime.Name = "txtFlyGrabExposureTime"; this.txtTurnoverTrayLocateXRange.Name = "txtTurnoverTrayLocateXRange";
this.txtFlyGrabExposureTime.Size = new System.Drawing.Size(61, 21); this.txtTurnoverTrayLocateXRange.Size = new System.Drawing.Size(61, 21);
this.txtFlyGrabExposureTime.TabIndex = 44; this.txtTurnoverTrayLocateXRange.TabIndex = 44;
this.txtFlyGrabExposureTime.Text = "0.2"; this.txtTurnoverTrayLocateXRange.Text = "0.2";
this.txtFlyGrabExposureTime.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; this.txtTurnoverTrayLocateXRange.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
this.txtTurnoverTrayLocateXRange.KeyUp += new System.Windows.Forms.KeyEventHandler(this.txtTurnoverTrayLocateRange_KeyUp);
// //
// label5 // label5
// //
@ -321,6 +324,20 @@
this.lblResult.Text = "NG"; this.lblResult.Text = "NG";
this.lblResult.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; this.lblResult.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
// //
// btnLocateCheck
//
this.btnLocateCheck.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(56)))), ((int)(((byte)(56)))), ((int)(((byte)(56)))));
this.btnLocateCheck.FlatAppearance.BorderColor = System.Drawing.Color.White;
this.btnLocateCheck.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnLocateCheck.ForeColor = System.Drawing.Color.White;
this.btnLocateCheck.Location = new System.Drawing.Point(11, 66);
this.btnLocateCheck.Name = "btnLocateCheck";
this.btnLocateCheck.Size = new System.Drawing.Size(134, 52);
this.btnLocateCheck.TabIndex = 8;
this.btnLocateCheck.Text = "定位检测";
this.btnLocateCheck.UseVisualStyleBackColor = false;
this.btnLocateCheck.Click += new System.EventHandler(this.btnLocateCheck_Click);
//
// btnCheck // btnCheck
// //
this.btnCheck.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(56)))), ((int)(((byte)(56)))), ((int)(((byte)(56))))); this.btnCheck.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(56)))), ((int)(((byte)(56)))), ((int)(((byte)(56)))));
@ -758,20 +775,6 @@
this.moveToolStripMenuItem8.Size = new System.Drawing.Size(156, 22); this.moveToolStripMenuItem8.Size = new System.Drawing.Size(156, 22);
this.moveToolStripMenuItem8.Text = "Move"; this.moveToolStripMenuItem8.Text = "Move";
// //
// btnLocateCheck
//
this.btnLocateCheck.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(56)))), ((int)(((byte)(56)))), ((int)(((byte)(56)))));
this.btnLocateCheck.FlatAppearance.BorderColor = System.Drawing.Color.White;
this.btnLocateCheck.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnLocateCheck.ForeColor = System.Drawing.Color.White;
this.btnLocateCheck.Location = new System.Drawing.Point(11, 66);
this.btnLocateCheck.Name = "btnLocateCheck";
this.btnLocateCheck.Size = new System.Drawing.Size(134, 52);
this.btnLocateCheck.TabIndex = 8;
this.btnLocateCheck.Text = "定位检测";
this.btnLocateCheck.UseVisualStyleBackColor = false;
this.btnLocateCheck.Click += new System.EventHandler(this.btnLocateCheck_Click);
//
// TurnoverTrayProductLocate // TurnoverTrayProductLocate
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
@ -815,11 +818,11 @@
private System.Windows.Forms.GroupBox groupBox1; private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.Button btnCheck; private System.Windows.Forms.Button btnCheck;
private System.Windows.Forms.Label lblResult; private System.Windows.Forms.Label lblResult;
private System.Windows.Forms.TextBox textBox2; private System.Windows.Forms.TextBox txtTurnoverTrayLocateRRange;
private System.Windows.Forms.Label label2; private System.Windows.Forms.Label label2;
private System.Windows.Forms.TextBox textBox1; private System.Windows.Forms.TextBox txtTurnoverTrayLocateYRange;
private System.Windows.Forms.Label label1; private System.Windows.Forms.Label label1;
private System.Windows.Forms.TextBox txtFlyGrabExposureTime; private System.Windows.Forms.TextBox txtTurnoverTrayLocateXRange;
private System.Windows.Forms.Label label12; private System.Windows.Forms.Label label12;
private System.Windows.Forms.Label label5; private System.Windows.Forms.Label label5;
private System.Windows.Forms.Label label4; private System.Windows.Forms.Label label4;

@ -52,7 +52,7 @@ namespace Rs.MotionPlat.Recipe
btnCheck.Enabled = false; btnCheck.Enabled = false;
})); }));
if (UpCameraCheckFlow.Instance.CheckTurnoverTrayHasProduct((img) => { himgNozzle8.HobjectToHimage(img); })) if (UpCameraCheckFlow.Instance.CheckTurnoverTrayHasProduct((img) => { himgNozzle8.HobjectToHimage(img); },1,false))
{ {
Invoke(new Action(() => { Invoke(new Action(() => {
lblResult.BackColor = Color.Lime; lblResult.BackColor = Color.Lime;
@ -136,6 +136,9 @@ namespace Rs.MotionPlat.Recipe
{ {
dgvBasePoints.AutoGenerateColumns = false; dgvBasePoints.AutoGenerateColumns = false;
BindPoints(); BindPoints();
PositionHelper.BindSinglePosition(txtTurnoverTrayLocateXRange);
PositionHelper.BindSinglePosition(txtTurnoverTrayLocateYRange);
PositionHelper.BindSinglePosition(txtTurnoverTrayLocateRRange);
} }
private void btnLocateCheck_Click(object sender, EventArgs e) private void btnLocateCheck_Click(object sender, EventArgs e)
@ -143,34 +146,42 @@ namespace Rs.MotionPlat.Recipe
Task.Run(() => Task.Run(() =>
{ {
Invoke(new Action(() => { Invoke(new Action(() => {
btnCheck.Enabled = false; btnLocateCheck.Enabled = false;
})); }));
UpCameraScanBarCodeFlow.Instance.ScanSingle(2); UpCameraScanBarCodeFlow.Instance.ScanSingle(1,false);
VisionResult vr= UpCameraScanBarCodeFlow.Instance.WaitSingle(); VisionResult vr= UpCameraScanBarCodeFlow.Instance.WaitSingle();
if(vr != null) if(vr != null)
{ {
bool result = UpCameraScanBarCodeFlow.Instance.CheckResult(vr);
if(result) {
Invoke(new Action(() =>
{
lblResult.BackColor = Color.Lime;
lblResult.Text = "OK";
}));
}
else
{
Invoke(new Action(() =>
{
lblResult.BackColor = Color.Red;
lblResult.Text = "NG";
}));
}
} }
//if (UpCameraCheckFlow.Instance.CheckTurnoverTrayHasProduct((img) => { himgNozzle8.HobjectToHimage(img); })) Invoke(new Action(() =>
//{ {
// Invoke(new Action(() => { btnLocateCheck.Enabled = true;
// lblResult.BackColor = Color.Lime; }));
// lblResult.Text = "OK";
// }));
//}
//else
//{
// Invoke(new Action(() => {
// lblResult.BackColor = Color.Red;
// lblResult.Text = "NG";
// }));
//}
//Invoke(new Action(() => {
// btnCheck.Enabled = true;
//}));
}); });
} }
private void txtTurnoverTrayLocateRange_KeyUp(object sender, KeyEventArgs e)
{
TextBox txt = (TextBox)sender;
UpdateSysParam(txt);
}
} }
} }

Loading…
Cancel
Save