Просмотр исходного кода

1 revise efem pick/place
2 revise srd lift up
3 revise robot cycle bug

chenzk дней назад: 4
Родитель
Сommit
0b0f2baef6

+ 3 - 3
PunkHPX8_MainPages/ViewModels/RobotCycleViewModel.cs

@@ -249,9 +249,9 @@ namespace PunkHPX8_MainPages.ViewModels
                     break;
             }
             SelectedSelection = AvailableSelections.FirstOrDefault();
-            RobotHand = Hand.Blade1;
-            PickRobotFlip = Flip.Upper;
-            PlaceRobotFlip = Flip.Upper;
+            //RobotHand = Hand.Blade1;
+            //PickRobotFlip = Flip.Upper;
+            //PlaceRobotFlip = Flip.Upper;
         }
 
         private void AddPosition(object obj)

+ 5 - 5
PunkHPX8_RT/Modules/EFEM/EfemPickRoutine.cs

@@ -146,11 +146,6 @@ namespace PunkHPX8_RT.Modules.EFEM
             if (ModuleHelper.IsSRD(_targetModule) && ModuleHelper.IsInstalled(_targetModule))
             {
                 _srdModule = Singleton<RouteManager>.Instance.GetModule<SRDEntity>(_targetModule.ToString());
-                if (!_srdModule.IsHomed)
-                {
-                    NotifyError(eEvent.ERR_EFEM_ROBOT,  $"{_targetModule} is not homed, please home it first",-1);
-                    return false;
-                }
                 //判断arm是否在home位置上
                 //JetAxisBase jetAxisBase = DEVICE.GetDevice<JetAxisBase>($"{_targetModule}.Arm");
                 //double position = jetAxisBase.MotionData.MotorPosition;
@@ -165,6 +160,11 @@ namespace PunkHPX8_RT.Modules.EFEM
                     NotifyError(eEvent.ERR_EFEM_ROBOT,  $"{_targetModule} door closed, can not pick",-1);
                     return false;
                 }
+                if (!_srdModule.IsLiftUp)
+                {
+                    NotifyError(eEvent.ERR_EFEM_ROBOT, $"{_targetModule} lift is not up, can not pick", -1);
+                    return false;
+                }
                 if (_srdModule.IsSrdChuckVacuum)
                 {
                     NotifyError(eEvent.ERR_EFEM_ROBOT,  $"{_targetModule} Vacuum on, can not pick",-1);

+ 2 - 2
PunkHPX8_RT/Modules/EFEM/EfemPlaceRoutine.cs

@@ -144,9 +144,9 @@ namespace PunkHPX8_RT.Modules.EFEM
             if (ModuleHelper.IsSRD(_targetModule) && ModuleHelper.IsInstalled(_targetModule))
             {
                 _srdModule = Singleton<RouteManager>.Instance.GetModule<SRDEntity>(_targetModule.ToString());
-                if (!_srdModule.IsHomed)
+                if (!_srdModule.IsLiftUp)
                 {
-                    NotifyError(eEvent.ERR_EFEM_ROBOT,  $"{_targetModule} is not homed, please home it first",-1);
+                    NotifyError(eEvent.ERR_EFEM_ROBOT, $"{_targetModule} lift is not up, can not pick", -1);
                     return false;
                 }
                 if (_srdModule.IsSrdDoorClosed)

+ 24 - 2
PunkHPX8_RT/Modules/PlatingCell/PlatingCellEntity.cs

@@ -271,7 +271,7 @@ namespace PunkHPX8_RT.Modules.PlatingCell
             DATA.Subscribe($"{Module}.FsmState", () => ((PlatingCellState)fsm.State).ToString(), SubscriptionAttribute.FLAG.IgnoreSaveDB);
             DATA.Subscribe($"{Module}.CurrentRecipe", () => _currentRecipe != null ? _currentRecipe.Ppid : "", SubscriptionAttribute.FLAG.IgnoreSaveDB);
             DATA.Subscribe($"{Module}.TotalTime", () => _recipeTime, SubscriptionAttribute.FLAG.IgnoreSaveDB);
-            DATA.Subscribe($"{Module}.TimeRemain", () => _recipeTime != 0 && _runRecipeRoutine != null ? (_recipeTime - Math.Round((double)_runRecipeRoutine.ElapsedMilliseconds / 1000, 0)) : 0, SubscriptionAttribute.FLAG.IgnoreSaveDB);
+            DATA.Subscribe($"{Module}.TimeRemain", () => CalculateRecipeTimeRemain(), SubscriptionAttribute.FLAG.IgnoreSaveDB);
             DATA.Subscribe($"{Module}.Chemistry", () => Chemistry, SubscriptionAttribute.FLAG.IgnoreSaveDB);
             DATA.Subscribe($"{Module}.AchievedCycle", () => AchievedCycle, SubscriptionAttribute.FLAG.IgnoreSaveDB);
 
@@ -360,6 +360,28 @@ namespace PunkHPX8_RT.Modules.PlatingCell
             EnumLoop<PlatingCellState>.ForEach((item) => { fsm.MapMessage((int)item, item.ToString()); });
         }
         /// <summary>
+        /// 计算recipe的剩余时间
+        /// </summary>
+        /// <returns></returns>
+        private int CalculateRecipeTimeRemain()
+        {
+            if (!IsInRecipe)
+            {
+                return 0;
+            }
+            int remainTime = 0;
+            if(_recipeTime != 0 && !_isCurrentRunDummyRecipe)
+            {
+                remainTime = (int)(_recipeTime - Math.Round((double)_runRecipeRoutine.ElapsedMilliseconds / 1000));
+            }
+            if (_recipeTime != 0 &&  _isCurrentRunDummyRecipe)
+            {
+                remainTime = (int)(_recipeTime - Math.Round((double)_dummyRinseRunRecipeRoutine.ElapsedMilliseconds / 1000));
+            }
+            return remainTime;
+
+        }
+        /// <summary>
         /// Abort Recipe
         /// </summary>
         /// <param name="param"></param>
@@ -569,7 +591,7 @@ namespace PunkHPX8_RT.Modules.PlatingCell
                 if (result)
                 {
                     _recipeTime = recipe.CalculateRecipeTotalTime() * _cycle;
-                    //run dummy recipe不需要纪律当前recipe
+                    //run dummy recipe不需要记录当前recipe
                 }
                 return result;
             }

+ 1 - 3
PunkHPX8_RT/Modules/PlatingCell/PlatingCellRunRecipeRoutine.cs

@@ -32,7 +32,6 @@ namespace PunkHPX8_RT.Modules.PlatingCell
     {
         private enum RunRecipeStep
         {
-            WaitMatchPlatingCellStart,
             LoopStart,
             InterRinse,
             CheckInterRinse,
@@ -196,8 +195,7 @@ namespace PunkHPX8_RT.Modules.PlatingCell
         public RState Monitor()
         {         
                 
-            Runner.WaitWithStopCondition(RunRecipeStep.WaitMatchPlatingCellStart,() => { return _matchPlatingCellEntity.IsInRecipe; },() => { return false; }, false,ALL_DAY_MILLOSECONDS)
-                 .LoopStart(RunRecipeStep.LoopStart, "Loop Start Cycle Run Platingcell Recipe Routine", _cycle, NullFun, _delay_1ms)
+            Runner.LoopStart(RunRecipeStep.LoopStart, "Loop Start Cycle Run Platingcell Recipe Routine", _cycle, NullFun, _delay_1ms)
                 //interval rinse
                 .LoopRunIf(RunRecipeStep.InterRinse, _recipe.RinseBeforeEntryEnable, () => { return _interRinseRoutine.Start(_recipe, LARGETARGETPOSITION) == RState.Running; })
                 .LoopRunIfWithStopStatus(RunRecipeStep.CheckInterRinse, _recipe.RinseBeforeEntryEnable, CheckInterRinseEndStatus,

+ 8 - 0
PunkHPX8_RT/Modules/SRD/SRDEntity.cs

@@ -205,6 +205,14 @@ namespace PunkHPX8_RT.Modules.SRD
         {
             get { return !_srdCommon.CommonData.DoorOpened && _srdCommon.CommonData.DoorClosed; }
         }
+
+        /// <summary>
+        /// SRD Lift Up
+        /// </summary>
+        public bool IsLiftUp
+        {
+            get { return _srdCommon.CommonData.LiftUp; }
+        }
         /// <summary>
         /// SRD真空是否开启
         /// </summary>