|
|
|
@ -4,6 +4,7 @@ using Rs.MotionPlat.Commom;
|
|
|
|
|
using Rs.MotionPlat.Entitys;
|
|
|
|
|
using Rs.MotionPlat.Flow.Common;
|
|
|
|
|
using Rs.MotionPlat.Flow.SafePosFlow;
|
|
|
|
|
using Rs.MotionPlat.Vision;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
@ -16,6 +17,9 @@ namespace Rs.MotionPlat.Flow.SubFlow
|
|
|
|
|
enum EStockPlaceFlowStep
|
|
|
|
|
{
|
|
|
|
|
待触发,
|
|
|
|
|
到料仓拍照位上方,
|
|
|
|
|
等待到料仓拍照位上方,
|
|
|
|
|
料仓学位拍照,
|
|
|
|
|
到料仓放料位上方,
|
|
|
|
|
等待到料仓放料位上方,
|
|
|
|
|
到料仓放料位下方,
|
|
|
|
@ -31,6 +35,8 @@ namespace Rs.MotionPlat.Flow.SubFlow
|
|
|
|
|
{
|
|
|
|
|
public event Action<TestProduct> PlaceFinishedEvent;
|
|
|
|
|
bool finished = true;
|
|
|
|
|
double slotOffsetX = 0.0;
|
|
|
|
|
double slotOffsetY = 0.0;
|
|
|
|
|
EStockPlaceFlowStep flowStep = EStockPlaceFlowStep.待触发;
|
|
|
|
|
public StockPlaceFlow()
|
|
|
|
|
{
|
|
|
|
@ -101,7 +107,67 @@ namespace Rs.MotionPlat.Flow.SubFlow
|
|
|
|
|
switch (flowStep)
|
|
|
|
|
{
|
|
|
|
|
case EStockPlaceFlowStep.待触发:
|
|
|
|
|
flowStep = EStockPlaceFlowStep.到料仓放料位上方;
|
|
|
|
|
slotOffsetX = 0;
|
|
|
|
|
slotOffsetY = 0;
|
|
|
|
|
if (GlobalVar.EnableBeforePlaceProductGrab)
|
|
|
|
|
{
|
|
|
|
|
flowStep = EStockPlaceFlowStep.到料仓拍照位上方;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
flowStep = EStockPlaceFlowStep.到料仓放料位上方;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case EStockPlaceFlowStep.到料仓拍照位上方:
|
|
|
|
|
curPlaceSlot = tray.GetSlot(slotIndex);
|
|
|
|
|
if(curPlaceSlot!=null)
|
|
|
|
|
{
|
|
|
|
|
SlotPoint sp = TrayPointManager.GetSlotPoint(trayType, curPlaceSlot.Index);
|
|
|
|
|
if(sp!=null)
|
|
|
|
|
{
|
|
|
|
|
targetPosition.X = sp.X;
|
|
|
|
|
targetPosition.Y1 = GlobalVar.StockSideY1;
|
|
|
|
|
targetPosition.Y2 = sp.Y;
|
|
|
|
|
double curLoadX = Ops.GetCurPosition(AxisControl.LoadX);
|
|
|
|
|
if (curLoadX - GlobalVar.FixtureSafePosX > 50)
|
|
|
|
|
{
|
|
|
|
|
DischargeModuleGoSafePosFlow.Instance.GoSafePostion(ESafePosSide.PlaceToStock);
|
|
|
|
|
}
|
|
|
|
|
if (GroupAxisMove.XY1Y2MovePos(targetPosition, GlobalVar.WholeSpeed))
|
|
|
|
|
{
|
|
|
|
|
AxisPosPrint.PrintXY1Y2TargetPos("到料仓拍照位上方,", targetPosition, GetClassName());
|
|
|
|
|
flowStep = EStockPlaceFlowStep.等待到料仓拍照位上方;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case EStockPlaceFlowStep.等待到料仓拍照位上方:
|
|
|
|
|
if (Ops.IsStop("LoadX", "LoadY1", "LoadY2"))
|
|
|
|
|
{
|
|
|
|
|
AxisPosPrint.PrintXY1Y2CurrentPos("轴loadx,loady1,loady2已停止运动,", GetClassName());
|
|
|
|
|
if (AxisArrived.LoadXY1Y2IsArrived(targetPosition.X, targetPosition.Y1, targetPosition.Y2))
|
|
|
|
|
{
|
|
|
|
|
AxisPosPrint.PrintXY1Y2CurrentPos("已运动到料仓拍照位上方,", GetClassName());
|
|
|
|
|
flowStep = EStockPlaceFlowStep.料仓学位拍照;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
flowStep = EStockPlaceFlowStep.到料仓拍照位上方;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case EStockPlaceFlowStep.料仓学位拍照:
|
|
|
|
|
UpCameraHelper.Grab();
|
|
|
|
|
VisionResult vr = VisionHelper.Grab(Vision.EVisionScene.TrayLocation);
|
|
|
|
|
if(vr!=null && vr.Result)
|
|
|
|
|
{
|
|
|
|
|
slotOffsetX = vr.OffsetX; slotOffsetY=vr.OffsetY;
|
|
|
|
|
flowStep = EStockPlaceFlowStep.到料仓放料位上方;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
Msgbox.ShowTipDialog(EButtonType.Retry, "料仓穴位定位失败", "", true);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case EStockPlaceFlowStep.到料仓放料位上方:
|
|
|
|
|
//curNozzle = NozzleManager.GetToUnloadNozzle();
|
|
|
|
@ -112,6 +178,8 @@ namespace Rs.MotionPlat.Flow.SubFlow
|
|
|
|
|
if (curPlaceSlot != null)
|
|
|
|
|
{
|
|
|
|
|
targetPosition = NozzleManager.GetToTraySlot(trayType, curPlaceSlot.Index, curNozzle.NozzleIndex);
|
|
|
|
|
targetPosition.X += slotOffsetX;
|
|
|
|
|
targetPosition.Y2+= slotOffsetY;
|
|
|
|
|
double curLoadX = Ops.GetCurPosition(AxisControl.LoadX);
|
|
|
|
|
if (curLoadX - GlobalVar.FixtureSafePosX > 50)
|
|
|
|
|
{
|
|
|
|
|