diff --git a/Rs.DeweyTester/Flow/NormalFlow/DischargeFlow.cs b/Rs.DeweyTester/Flow/NormalFlow/DischargeFlow.cs index 6eadc97..2c695d4 100644 --- a/Rs.DeweyTester/Flow/NormalFlow/DischargeFlow.cs +++ b/Rs.DeweyTester/Flow/NormalFlow/DischargeFlow.cs @@ -222,13 +222,13 @@ namespace Rs.MotionPlat.Flow } break; case EDischargeFlowStep.进料盘产品定位: - ProductLocationFlow.Instance.Grab(takeSlotIndex, GetClassName()); + ProductLocationFlow.Instance.Grab(takeSlotIndex); ProductLocationResult[] results = OneGrabSixteenManager.Instance.GetResults(); if(results!=null) { foreach (ProductLocationResult item in results) { - if(item.Result!= EOneGrabSixteenResult.Ok) + if(item.Result== EOneGrabSixteenResult.Slant) { //凡是定位失败的,需要定位重拍 ProductLocationResult vr = FixedGrabProductFlow.Instance.Grab(ETrayType.Grr, item.SlotIndex); @@ -269,7 +269,18 @@ namespace Rs.MotionPlat.Flow //治具换料 case EDischargeFlowStep.到治具取料等待位: //先去第一个治具拍照位上方等待 - targetPosition =FixtureManager.GetFixtureGrabPos(lastFixtureIndex + 1); + if(TestFixtureManager.Instance.GetTestFixture(lastFixtureIndex+1).Product==null) + { + targetPosition = FixtureManager.GetFixtureGrabPos(lastFixtureIndex + 1); + + } + else + { + targetPosition = NozzleManager.GetNozzleToFixturePos(lastFixtureIndex + 1, NozzleManager.GetIdelNozzle().NozzleIndex); + targetPosition.X += TestFixtureManager.Instance.GetTestFixture(lastFixtureIndex + 1).PlaceProductOffsetX; + targetPosition.Y2 += TestFixtureManager.Instance.GetTestFixture(lastFixtureIndex + 1).PlaceProductOffsetY; + } + if(GroupAxisMove.XY1Y2MovePos(targetPosition, GlobalVar.WholeSpeed)) { AxisPosPrint.PrintXY1Y2TargetPos("到治具放料缓冲位,", targetPosition, GetClassName()); @@ -351,7 +362,7 @@ namespace Rs.MotionPlat.Flow else { int num = TestFixtureManager.Instance.GetHaveProductFixtureList().Count(); - if(GlobalVar.Clear && ((num==0) ||(NozzleManager.GetIdelNozzle() == null))) + if(GlobalVar.Clear && NozzleManager.GetToTestNozzle()==null && ((num==0) ||(NozzleManager.GetIdelNozzle() == null))) { flowStep = EDischargeFlowStep.判断是否需要放料到料仓; } diff --git a/Rs.DeweyTester/Flow/NormalFlow/ThreePointLocationFlow.cs b/Rs.DeweyTester/Flow/NormalFlow/ThreePointLocationFlow.cs index c354df1..69046de 100644 --- a/Rs.DeweyTester/Flow/NormalFlow/ThreePointLocationFlow.cs +++ b/Rs.DeweyTester/Flow/NormalFlow/ThreePointLocationFlow.cs @@ -83,8 +83,7 @@ namespace Rs.MotionPlat.Flow.NormalFlow targetPos.Y2 = sp.Y; if (GroupAxisMove.XY1Y2MovePos(targetPos, GlobalVar.WholeSpeed)) { - logInfo = $"到拍照位,tloadx:{targetPos.X},tloady1:{targetPos.Y1},tloady2:{targetPos.Y2}"; - MessageQueue.Instance.Insert(logInfo); + AxisPosPrint.PrintXY1Y2TargetPos("到拍照位,", targetPos, GetClassName()); step = EThreePointLocationFlowStep.等待到拍照位; } } @@ -93,11 +92,10 @@ namespace Rs.MotionPlat.Flow.NormalFlow case EThreePointLocationFlowStep.等待到拍照位: if (Ops.IsStop("LoadX", "LoadY1", "LoadY2") || GlobalVar.VirtualAxis) { - PrintXY1Y2CurrentPos("轴XY1Y2已停止运动,"); + AxisPosPrint.PrintXY1Y2CurrentPos("轴XY1Y2已停止运动,", GetClassName()); if (AxisArrived.LoadXY1Y2IsArrived(targetPos.X, targetPos.Y1, targetPos.Y2)) { - logInfo = $"已运动到拍照位,cloadx:{Ops.GetCurPosition(AxisControl.LoadX)},cloady1:{Ops.GetCurPosition(AxisControl.LoadY1)},cloady2:{Ops.GetCurPosition(AxisControl.LoadY2)}"; - MessageQueue.Instance.Insert(logInfo); + AxisPosPrint.PrintXY1Y2CurrentPos("已运动到拍照位,", GetClassName()); step = EThreePointLocationFlowStep.相机拍照处理; } else @@ -127,7 +125,7 @@ namespace Rs.MotionPlat.Flow.NormalFlow { vResult.Add(vr); //在这里先打印拍照结果 - logInfo = JsonConvert.SerializeObject(vr); + logInfo = GetClassName()+ JsonConvert.SerializeObject(vr); MessageQueue.Instance.Insert(logInfo); points.RemoveAt(0); if (points.Count > 0) @@ -158,11 +156,6 @@ namespace Rs.MotionPlat.Flow.NormalFlow //}); } - private void PrintXY1Y2CurrentPos(string prefixLog) - { - LogHelper.Debug(GetClassName() + $"{prefixLog}当前位置:cx:{Ops.GetCurPosition(AxisControl.LoadX)},cy1:{Ops.GetCurPosition(AxisControl.LoadY1)},cy2:{Ops.GetCurPosition(AxisControl.LoadY2)}"); - } - private string GetClassName() { return "ThreePointLocation-"; diff --git a/Rs.DeweyTester/Flow/SubFlow/FixturePlaceFlow.cs b/Rs.DeweyTester/Flow/SubFlow/FixturePlaceFlow.cs index 533f02c..81c5590 100644 --- a/Rs.DeweyTester/Flow/SubFlow/FixturePlaceFlow.cs +++ b/Rs.DeweyTester/Flow/SubFlow/FixturePlaceFlow.cs @@ -193,6 +193,7 @@ namespace Rs.MotionPlat.Flow.SubFlow case EFixturePlaceFlowStep.等待到治具放料位下方2: if (Ops.IsStop($"NozzleZ{curNozzle.NozzleIndex}")) { + Thread.Sleep(100); logInfo = GetClassName() + $"已运动到治具{curFixture.Index}放料位下方2"; MessageQueue.Instance.Insert(logInfo); if (GlobalVar.RunSpace) diff --git a/Rs.DeweyTester/Flow/SubFlow/FixtureTakeFlow.cs b/Rs.DeweyTester/Flow/SubFlow/FixtureTakeFlow.cs index 5897c6a..fc932a8 100644 --- a/Rs.DeweyTester/Flow/SubFlow/FixtureTakeFlow.cs +++ b/Rs.DeweyTester/Flow/SubFlow/FixtureTakeFlow.cs @@ -145,6 +145,7 @@ namespace Rs.MotionPlat.Flow.SubFlow case EFixtureTakeFlowStep.等待到治具取料位下方2: if (Ops.IsStop($"NozzleZ{curNozzle.NozzleIndex}")) { + Thread.Sleep(100); logInfo = GetClassName() + $"已运动到治具{curFixture.Index}取料位下方2"; MessageQueue.Instance.Insert(logInfo); if (GlobalVar.RunSpace) diff --git a/Rs.DeweyTester/Flow/SubFlow/ProductLocationFlow.cs b/Rs.DeweyTester/Flow/SubFlow/ProductLocationFlow.cs index f5dc02f..c9b61ef 100644 --- a/Rs.DeweyTester/Flow/SubFlow/ProductLocationFlow.cs +++ b/Rs.DeweyTester/Flow/SubFlow/ProductLocationFlow.cs @@ -43,7 +43,7 @@ namespace Rs.MotionPlat.Flow.SubFlow } } - public void Grab(int slotIndex,string className) + public void Grab(int slotIndex) { if (finished) finished = false; @@ -70,9 +70,9 @@ namespace Rs.MotionPlat.Flow.SubFlow targetPosition.X = sp.X; targetPosition.Y1 = GlobalVar.StockSideY1; targetPosition.Y2 = sp.Y - 30; - if (GroupAxisMove.XY1Y2MovePos(targetPosition,GlobalVar.FlyCameraSpeed)) + if (GroupAxisMove.XY1Y2MovePos(targetPosition,GlobalVar.WholeSpeed)) { - AxisPosPrint.PrintXY1Y2TargetPos("到料仓拍照位上方", targetPosition, className); + AxisPosPrint.PrintXY1Y2TargetPos("到料仓拍照位上方", targetPosition, GetClassName()); flowStep = EProductLocationFlowStep.等待到料仓拍照起始位; } } @@ -81,7 +81,7 @@ namespace Rs.MotionPlat.Flow.SubFlow case EProductLocationFlowStep.等待到料仓拍照起始位: if (Ops.IsStop("LoadX", "LoadY1", "LoadY2")) { - AxisPosPrint.PrintXY1Y2CurrentPos("轴loadx,loady1,loady2已停止运动,",className); + AxisPosPrint.PrintXY1Y2CurrentPos("轴loadx,loady1,loady2已停止运动,", GetClassName()); if (AxisArrived.LoadXY1Y2IsArrived(targetPosition.X, targetPosition.Y1, targetPosition.Y2)) { SlotPoint sp = TrayPointManager.GetSlotPoint(ETrayType.Input, grabStartSlot.Index); @@ -92,12 +92,12 @@ namespace Rs.MotionPlat.Flow.SubFlow triggerPos[i] = sp.Y + (i * 5); } AxisControl.LoadY2.SetPosCompare(1, triggerPos); - AxisPosPrint.PrintXY1Y2CurrentPos("已运动到料仓拍照位上方", className); + AxisPosPrint.PrintXY1Y2CurrentPos("已运动到料仓拍照位上方", GetClassName()); flowStep = EProductLocationFlowStep.到料仓拍照结束位; } else { - logInfo = $"{className} 轴不在目标位置,重新运动一次"; + logInfo = $"{GetClassName()} 轴不在目标位置,重新运动一次"; MessageQueue.Instance.Warn(logInfo); flowStep = EProductLocationFlowStep.到料仓拍照起始位; } @@ -115,7 +115,7 @@ namespace Rs.MotionPlat.Flow.SubFlow targetPosition.Y2 = sp.Y + 2; if (GroupAxisMove.XY1Y2MovePos(targetPosition,GlobalVar.FlyCameraSpeed)) { - AxisPosPrint.PrintXY1Y2TargetPos("到料仓拍照结束位,", targetPosition, className); + AxisPosPrint.PrintXY1Y2TargetPos("到料仓拍照结束位,", targetPosition, GetClassName()); flowStep = EProductLocationFlowStep.等待到料仓拍照结束位; } } @@ -124,15 +124,15 @@ namespace Rs.MotionPlat.Flow.SubFlow case EProductLocationFlowStep.等待到料仓拍照结束位: if (Ops.IsStop("LoadX", "LoadY1", "LoadY2")) { - AxisPosPrint.PrintXY1Y2CurrentPos("轴loadx,loady1,loady2已停止运动,",className); + AxisPosPrint.PrintXY1Y2CurrentPos("轴loadx,loady1,loady2已停止运动,", GetClassName()); if (AxisArrived.LoadXY1Y2IsArrived(targetPosition.X, targetPosition.Y1, targetPosition.Y2)) { - AxisPosPrint.PrintXY1Y2CurrentPos("已运动到料仓拍照结束位,", className); + AxisPosPrint.PrintXY1Y2CurrentPos("已运动到料仓拍照结束位,", GetClassName()); flowStep = EProductLocationFlowStep.拍照结果处理; } else { - logInfo = $"{className} 轴不在目标位置,重新运动一次"; + logInfo = $"{GetClassName()} 轴不在目标位置,重新运动一次"; MessageQueue.Instance.Warn(logInfo); flowStep = EProductLocationFlowStep.到料仓拍照结束位; } @@ -154,5 +154,10 @@ namespace Rs.MotionPlat.Flow.SubFlow } } } + + private string GetClassName() + { + return "ProductLocationFlow-"; + } } } diff --git a/Rs.DeweyTester/Flow/SubFlow/StockTakeFlow.cs b/Rs.DeweyTester/Flow/SubFlow/StockTakeFlow.cs index 5ba138b..05e5056 100644 --- a/Rs.DeweyTester/Flow/SubFlow/StockTakeFlow.cs +++ b/Rs.DeweyTester/Flow/SubFlow/StockTakeFlow.cs @@ -129,7 +129,7 @@ namespace Rs.MotionPlat.Flow.SubFlow case EStockTakeFlowStep.等待到料仓取料位下方: if (Ops.IsStop($"NozzleZ{curNozzle.NozzleIndex}")) { - //Thread.Sleep(5000); + Thread.Sleep(200); logInfo = $"{GetClassName()} 已运动到料仓取料位下方"; MessageQueue.Instance.Insert(logInfo); if (!GlobalVar.RunSpace) @@ -164,7 +164,7 @@ namespace Rs.MotionPlat.Flow.SubFlow //curNozzle.Status = ENozzleStatus.ToUnload; GlobalTray.NozzleTray.ChangeStatus(curNozzle.NozzleIndex, ESlotStatus.Have); GlobalTray.InputTray.ChangeStatus(waitTakeProductSlot.Index, ESlotStatus.NotHave); - logInfo = $"{GetClassName()} from r{waitTakeProductSlot.Row}c{waitTakeProductSlot.Column} 产品:{curNozzle.Product.SN}被吸嘴{curNozzle.NozzleIndex}取料完成,"; + logInfo = $"{GetClassName()} from r{waitTakeProductSlot.Row+1}c{waitTakeProductSlot.Column+1} 穴位索引:{waitTakeProductSlot.Index} 产品:{curNozzle.Product.SN}被吸嘴{curNozzle.NozzleIndex}取料完成,"; MessageQueue.Instance.Insert(logInfo); //flowStep = EStockTakeFlowStep.判断是否需要从料仓取料; finished = true; diff --git a/Rs.DeweyTester/Vision/LoadTakeProductVision.cs b/Rs.DeweyTester/Vision/LoadTakeProductVision.cs index 052bcab..b2cc686 100644 --- a/Rs.DeweyTester/Vision/LoadTakeProductVision.cs +++ b/Rs.DeweyTester/Vision/LoadTakeProductVision.cs @@ -36,10 +36,10 @@ namespace Rs.MotionPlat.Vision else { data = Encoding.ASCII.GetString(reciveBuffer.ToArray()); - MessageQueue.Instance.Insert(data); + //MessageQueue.Instance.Insert(data); if (data == "M,0") { - MessageQueue.Instance.Insert("视觉收到拍照指令"); + //MessageQueue.Instance.Insert("视觉收到拍照指令"); } else if(data=="C,0") { @@ -176,6 +176,7 @@ namespace Rs.MotionPlat.Vision reciveData = true; if (len > 0) { + MessageQueue.Instance.Insert($" <<< M;"); if (visionGrabEvent.WaitOne(timeout)) { reciveData = false;