From 31cbfc905fe81dd840d6f8a85cef0fa73d10f7e6 Mon Sep 17 00:00:00 2001 From: lhiven Date: Thu, 1 Aug 2024 08:56:14 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E4=B8=80=E4=B8=AA=E6=96=B9?= =?UTF-8?q?=E6=B3=95=E7=9B=B4=E6=8E=A5=E7=A7=BB=E5=8A=A8X=E5=88=B0?= =?UTF-8?q?=E5=AE=89=E5=85=A8=E4=BD=8D=EF=BC=8C=E4=B8=80=E4=B8=AA=E6=96=B9?= =?UTF-8?q?=E6=B3=95=E7=9B=B4=E6=8E=A5=E7=A7=BB=E5=8A=A8Y1=E5=88=B0?= =?UTF-8?q?=E6=B2=BB=E5=85=B7=E4=BE=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DischargeModuleGoSafePosFlow.cs | 90 +++++++++++++++++++ 1 file changed, 90 insertions(+) diff --git a/Rs.DeweyTester/Flow/SafePosFlow/DischargeModuleGoSafePosFlow.cs b/Rs.DeweyTester/Flow/SafePosFlow/DischargeModuleGoSafePosFlow.cs index 62a4ad4..615fc5f 100644 --- a/Rs.DeweyTester/Flow/SafePosFlow/DischargeModuleGoSafePosFlow.cs +++ b/Rs.DeweyTester/Flow/SafePosFlow/DischargeModuleGoSafePosFlow.cs @@ -130,6 +130,96 @@ namespace Rs.MotionPlat.Flow.SafePosFlow //taskFinishedEvent.WaitOne(); } + /// + /// 移动X到安全位 + /// + public void MoveXToSafe() + { + bool arrivedSafePos = false; + EDischargeModuleGoSafePosFlowStep moveXStep = EDischargeModuleGoSafePosFlowStep.到安全位; + //判断Y1当前在治具还是在料仓,只有在治具侧才需要把X先移动到安全位 + double curLoadY1 = Ops.GetCurPosition(AxisControl.LoadY1); + double curLoadX = Ops.GetCurPosition(AxisControl.LoadX); + if(Math.Abs(curLoadY1-GlobalVar.FixtureSideY1)>1 && (curLoadX-GlobalVar.FixtureSafePosX>50)) + { + while (true && !arrivedSafePos) + { + switch (moveXStep) + { + case EDischargeModuleGoSafePosFlowStep.到安全位: + targetPos.X = GlobalVar.FixtureSafePosX; + targetPos.Y1 = Ops.GetCurPosition(AxisControl.LoadY1); + targetPos.Y2 = Ops.GetCurPosition(AxisControl.LoadY2); + if (GroupAxisMove.XY1Y2MovePos(targetPos, GlobalVar.WholeSpeed)) + { + AxisPosPrint.PrintXY1Y2TargetPos("到安全位,", targetPos, GetClassName()); + if (GlobalVar.VirtualAxis) + { + Thread.Sleep(GlobalVar.VirtualAxisMoveTime); + } + moveXStep = EDischargeModuleGoSafePosFlowStep.等待运动到安全位; + } + break; + case EDischargeModuleGoSafePosFlowStep.等待运动到安全位: + if (Ops.IsStop("LoadX", "LoadY1", "LoadY2") || GlobalVar.VirtualAxis) + { + AxisPosPrint.PrintXY1Y2CurrentPos("已运动到安全位,", GetClassName()); + arrivedSafePos = true; + } + break; + default: + break; + } + Thread.Sleep(10); + } + } + } + + /// + /// 移动Y1到治具侧 + /// + public void MoveY1ToFixtureSide(double targetLoadX) + { + bool arrivedSafePos = false; + EDischargeModuleGoSafePosFlowStep moveY1Step = EDischargeModuleGoSafePosFlowStep.到安全位; + //判断Y1当前在治具还是在料仓,只有在料仓侧才需要把Y1先移动治具那边 + double curLoadY1 = Ops.GetCurPosition(AxisControl.LoadY1); + double curLoadX = Ops.GetCurPosition(AxisControl.LoadX); + if (Math.Abs(curLoadY1 - GlobalVar.StockSideY1) > 1 && (targetLoadX - GlobalVar.FixtureSafePosX > 50)) + { + while (true && !arrivedSafePos) + { + switch (moveY1Step) + { + case EDischargeModuleGoSafePosFlowStep.到安全位: + targetPos.X = Ops.GetCurPosition(AxisControl.LoadX); + targetPos.Y1 = GlobalVar.FixtureSideY1; + targetPos.Y2 = Ops.GetCurPosition(AxisControl.LoadY2); + if (GroupAxisMove.XY1Y2MovePos(targetPos, GlobalVar.WholeSpeed)) + { + AxisPosPrint.PrintXY1Y2TargetPos("到安全位,", targetPos, GetClassName()); + if (GlobalVar.VirtualAxis) + { + Thread.Sleep(GlobalVar.VirtualAxisMoveTime); + } + moveY1Step = EDischargeModuleGoSafePosFlowStep.等待运动到安全位; + } + break; + case EDischargeModuleGoSafePosFlowStep.等待运动到安全位: + if (Ops.IsStop("LoadX", "LoadY1", "LoadY2") || GlobalVar.VirtualAxis) + { + AxisPosPrint.PrintXY1Y2CurrentPos("已运动到安全位,", GetClassName()); + arrivedSafePos = true; + } + break; + default: + break; + } + Thread.Sleep(10); + } + } + } + /// /// 判断是否在安全位 ///