优化日志记录,和料仓下方取料延时

master
lhiven 12 months ago
parent 248847d446
commit a79838a581

@ -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.:
//先去第一个治具拍照位上方等待
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.;
}

@ -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-";

@ -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)

@ -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)

@ -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-";
}
}
}

@ -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;

@ -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;

Loading…
Cancel
Save