增加料仓放料时是否放料前拍照

master
lhiven 10 months ago
parent d3053e5fde
commit 349dcea5bf

@ -17,6 +17,18 @@ namespace Rs.Framework
{ {
#region newpro #region newpro
/// <summary>
/// 允许料仓放料前拍照
/// </summary>
[ParameterInit("bool", "true", "system", "允许料仓放料前拍照")]
public static bool EnableBeforePlaceProductGrab
{
get
{
return SysConfigParam.GetValue<bool>(nameof(EnableBeforePlaceProductGrab));
}
}
/// <summary> /// <summary>
/// 允许Ok tray 满料检查 /// 允许Ok tray 满料检查
/// </summary> /// </summary>

@ -74,11 +74,11 @@ namespace Rs.MotionPlat.Flow.SafePosFlow
step = EDischargeModuleGoSafePosFlowStep.; step = EDischargeModuleGoSafePosFlowStep.;
while (true && !finished) while (true && !finished)
{ {
if (MachineManage.Instance.MachineStatus == EMachineStatus.Stop) //if (MachineManage.Instance.MachineStatus == EMachineStatus.Stop)
{ //{
Thread.Sleep(10); // Thread.Sleep(10);
continue; // continue;
} //}
switch (step) switch (step)
{ {
case EDischargeModuleGoSafePosFlowStep.: case EDischargeModuleGoSafePosFlowStep.:

@ -79,7 +79,7 @@ namespace Rs.MotionPlat.Flow.SubFlow
break; break;
case EStockGrabFlowStep.: case EStockGrabFlowStep.:
vr = VisionHelper.Grab(Vision.EVisionScene.HaveOrNot); vr = VisionHelper.Grab(Vision.EVisionScene.HaveOrNot);
if (vr.Result) if (vr!=null && vr.Result)
{ {
flowStep = EStockGrabFlowStep.; flowStep = EStockGrabFlowStep.;
} }

@ -4,6 +4,7 @@ using Rs.MotionPlat.Commom;
using Rs.MotionPlat.Entitys; using Rs.MotionPlat.Entitys;
using Rs.MotionPlat.Flow.Common; using Rs.MotionPlat.Flow.Common;
using Rs.MotionPlat.Flow.SafePosFlow; using Rs.MotionPlat.Flow.SafePosFlow;
using Rs.MotionPlat.Vision;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
@ -16,6 +17,9 @@ namespace Rs.MotionPlat.Flow.SubFlow
enum EStockPlaceFlowStep enum EStockPlaceFlowStep
{ {
, ,
,
,
,
, ,
, ,
, ,
@ -31,6 +35,8 @@ namespace Rs.MotionPlat.Flow.SubFlow
{ {
public event Action<TestProduct> PlaceFinishedEvent; public event Action<TestProduct> PlaceFinishedEvent;
bool finished = true; bool finished = true;
double slotOffsetX = 0.0;
double slotOffsetY = 0.0;
EStockPlaceFlowStep flowStep = EStockPlaceFlowStep.; EStockPlaceFlowStep flowStep = EStockPlaceFlowStep.;
public StockPlaceFlow() public StockPlaceFlow()
{ {
@ -101,7 +107,67 @@ namespace Rs.MotionPlat.Flow.SubFlow
switch (flowStep) switch (flowStep)
{ {
case EStockPlaceFlowStep.: 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; break;
case EStockPlaceFlowStep.: case EStockPlaceFlowStep.:
//curNozzle = NozzleManager.GetToUnloadNozzle(); //curNozzle = NozzleManager.GetToUnloadNozzle();
@ -112,6 +178,8 @@ namespace Rs.MotionPlat.Flow.SubFlow
if (curPlaceSlot != null) if (curPlaceSlot != null)
{ {
targetPosition = NozzleManager.GetToTraySlot(trayType, curPlaceSlot.Index, curNozzle.NozzleIndex); targetPosition = NozzleManager.GetToTraySlot(trayType, curPlaceSlot.Index, curNozzle.NozzleIndex);
targetPosition.X += slotOffsetX;
targetPosition.Y2+= slotOffsetY;
double curLoadX = Ops.GetCurPosition(AxisControl.LoadX); double curLoadX = Ops.GetCurPosition(AxisControl.LoadX);
if (curLoadX - GlobalVar.FixtureSafePosX > 50) if (curLoadX - GlobalVar.FixtureSafePosX > 50)
{ {

@ -510,13 +510,20 @@ namespace Rs.MotionPlat.Commom
{ {
TargetPosition targetPosition=new TargetPosition(); TargetPosition targetPosition=new TargetPosition();
SlotPoint curTakeSlotPoint = null; SlotPoint curTakeSlotPoint = null;
if(trayType== ETrayType.Input) if(GlobalVar.EnableBeforePlaceProductGrab)
{ {
curTakeSlotPoint = TrayPointManager.GetSlotPoint(trayType, slotIndex); curTakeSlotPoint = TrayPointManager.GetSlotPoint(trayType, slotIndex);
} }
else else
{ {
curTakeSlotPoint = TrayRunPointManager.GetSlotPoint(trayType, slotIndex); if (trayType == ETrayType.Input)
{
curTakeSlotPoint = TrayPointManager.GetSlotPoint(trayType, slotIndex);
}
else
{
curTakeSlotPoint = TrayRunPointManager.GetSlotPoint(trayType, slotIndex);
}
} }
MessageQueue.Instance.Insert($"基础loadx:{curTakeSlotPoint.X},loady2:{curTakeSlotPoint.Y}"); MessageQueue.Instance.Insert($"基础loadx:{curTakeSlotPoint.X},loady2:{curTakeSlotPoint.Y}");
if (curTakeSlotPoint != null) if (curTakeSlotPoint != null)

Loading…
Cancel
Save