|
|
|
@ -61,9 +61,9 @@ namespace Rs.MotionPlat.Flow.SubFlow
|
|
|
|
|
Stopwatch timeout = new Stopwatch();
|
|
|
|
|
string logInfo = string.Empty;
|
|
|
|
|
|
|
|
|
|
VisionResult singleResult;
|
|
|
|
|
|
|
|
|
|
bool exit = true;
|
|
|
|
|
ManualResetEvent grabFinishedEvent = new ManualResetEvent(true);
|
|
|
|
|
//ManualResetEvent grabFinishedEvent = new ManualResetEvent(true);
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// /// 开始扫码,先把所有的穴位全部扫一遍,扫不到的最后再定点扫码,
|
|
|
|
|
/// 如果定位失败的穴位,即便没有扫到码,也不再扫码
|
|
|
|
@ -75,7 +75,7 @@ namespace Rs.MotionPlat.Flow.SubFlow
|
|
|
|
|
{
|
|
|
|
|
List<VisionResult> vReslutList = new List<VisionResult>();
|
|
|
|
|
if (exit == false) return null;
|
|
|
|
|
grabFinishedEvent.Reset();
|
|
|
|
|
//grabFinishedEvent.Reset();
|
|
|
|
|
SlotPoint startPoint = TrayPointManager.GetSlotPoint(ETrayType.Turnover, startSlotIndex);
|
|
|
|
|
SlotPoint endPoint = new SlotPoint();
|
|
|
|
|
|
|
|
|
@ -252,7 +252,7 @@ namespace Rs.MotionPlat.Flow.SubFlow
|
|
|
|
|
slotIndex++;
|
|
|
|
|
}
|
|
|
|
|
exit = true;
|
|
|
|
|
grabFinishedEvent.Set();
|
|
|
|
|
//grabFinishedEvent.Set();
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -262,10 +262,11 @@ namespace Rs.MotionPlat.Flow.SubFlow
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void ScanSingle(int SlotIndex,bool needGo=true,bool bNeedLocate=true,bool bNeedScanBarcode=true)
|
|
|
|
|
public VisionResult ScanSingle(int SlotIndex,bool needGo=true,bool bNeedLocate=true,bool bNeedScanBarcode=true)
|
|
|
|
|
{
|
|
|
|
|
if (exit == false) return;
|
|
|
|
|
grabFinishedEvent.Reset();
|
|
|
|
|
VisionResult singleResult = null;
|
|
|
|
|
if (exit == false) return null;
|
|
|
|
|
//grabFinishedEvent.Reset();
|
|
|
|
|
HObject imageSingle = new HObject();
|
|
|
|
|
exit = false;
|
|
|
|
|
if(!needGo)
|
|
|
|
@ -281,7 +282,7 @@ namespace Rs.MotionPlat.Flow.SubFlow
|
|
|
|
|
{
|
|
|
|
|
fixedStep = EUpCameraFixedScanBarCodeFlowStep.到扫码位上方;
|
|
|
|
|
}
|
|
|
|
|
Task.Run(() => {
|
|
|
|
|
//Task.Run(() => {
|
|
|
|
|
while (!exit)
|
|
|
|
|
{
|
|
|
|
|
if (MachineManage.Instance.MachineStatus == EMachineStatus.Stop)
|
|
|
|
@ -291,7 +292,6 @@ namespace Rs.MotionPlat.Flow.SubFlow
|
|
|
|
|
}
|
|
|
|
|
switch (fixedStep)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
case EUpCameraFixedScanBarCodeFlowStep.到扫码位上方:
|
|
|
|
|
SlotPoint targetPoint = TrayPointManager.GetSlotPoint(ETrayType.Turnover, SlotIndex);
|
|
|
|
|
errCode = AxisControl.LoadX.MovePos(targetPoint.X, GlobalVar.FlyCameraSpeed);
|
|
|
|
@ -340,13 +340,13 @@ namespace Rs.MotionPlat.Flow.SubFlow
|
|
|
|
|
singleResult = VisionManager.TurnoverTrayDumpProductOK(imageSingle, bNeedLocate, bNeedScanBarcode, SlotIndex);
|
|
|
|
|
singleResult.SlotIndex = SlotIndex;
|
|
|
|
|
exit = true;
|
|
|
|
|
grabFinishedEvent.Set();
|
|
|
|
|
//grabFinishedEvent.Set();
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
//});
|
|
|
|
|
|
|
|
|
|
return singleResult;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
public string GetClassName()
|
|
|
|
@ -359,11 +359,11 @@ namespace Rs.MotionPlat.Flow.SubFlow
|
|
|
|
|
// return vReslutList;
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
public VisionResult WaitSingle()
|
|
|
|
|
{
|
|
|
|
|
grabFinishedEvent.WaitOne();
|
|
|
|
|
return singleResult;
|
|
|
|
|
}
|
|
|
|
|
//public VisionResult WaitSingle()
|
|
|
|
|
//{
|
|
|
|
|
// grabFinishedEvent.WaitOne();
|
|
|
|
|
// return singleResult;
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
public bool CheckResult(VisionResult vr)
|
|
|
|
|
{
|
|
|
|
|