|
@@ -13,6 +13,7 @@ using MECF.Framework.Common.CommonData;
|
|
|
using MECF.Framework.Common.DBCore;
|
|
|
using MECF.Framework.Common.Equipment;
|
|
|
using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.Robots.HongHu;
|
|
|
+using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.SerialPortSensor;
|
|
|
using MECF.Framework.RT.EquipmentLibrary.LogicUnits;
|
|
|
using MECF.Framework.RT.ModuleLibrary.Commons;
|
|
|
using MECF.Framework.RT.ModuleLibrary.SystemModules;
|
|
@@ -86,6 +87,7 @@ namespace JetMainframe.TMs.TM
|
|
|
#region 私有变量
|
|
|
private readonly HongHuTM _tm;
|
|
|
private readonly ITransferRobot _robot;
|
|
|
+ private readonly ShenPuHeightSensor _HeightSensor;
|
|
|
|
|
|
private readonly MFHomeRoutine _homeRoutine;
|
|
|
private readonly MFPickRoutine _pickRoutine;
|
|
@@ -99,6 +101,7 @@ namespace JetMainframe.TMs.TM
|
|
|
private readonly MFRetractRoutine _retractRoutine;
|
|
|
private readonly MFExtendRoutine _extendRoutine;
|
|
|
private readonly MFLeakCheckRoutine _LeakCheckRoutine;
|
|
|
+ private readonly CheckArmHeightRoutine _CheckArmHeightRoutine;
|
|
|
|
|
|
|
|
|
//private readonly
|
|
@@ -119,6 +122,12 @@ namespace JetMainframe.TMs.TM
|
|
|
_robotWatch = new Stopwatch();
|
|
|
_robot.AWCErrorHandler += NeedAWC;
|
|
|
|
|
|
+ if (SC.GetValue<bool>("TM.HasHeightSensor"))
|
|
|
+ {
|
|
|
+ _HeightSensor = new ShenPuHeightSensor(ModuleName.TM);
|
|
|
+ _CheckArmHeightRoutine = new CheckArmHeightRoutine(module, _robot, _HeightSensor);
|
|
|
+ }
|
|
|
+
|
|
|
_homeRoutine = new MFHomeRoutine(module, _tm, _robot);
|
|
|
_pickRoutine = new MFPickRoutine(module, _tm, _robot);
|
|
|
_placeRoutine = new MFPlaceRoutine(module, _tm, _robot);
|
|
@@ -132,7 +141,6 @@ namespace JetMainframe.TMs.TM
|
|
|
_retractRoutine = new MFRetractRoutine(module, _tm, _robot);
|
|
|
_LeakCheckRoutine = new MFLeakCheckRoutine(module, _tm);
|
|
|
|
|
|
-
|
|
|
IsOnline = false;
|
|
|
|
|
|
InitFsmMap();
|
|
@@ -203,6 +211,7 @@ namespace JetMainframe.TMs.TM
|
|
|
OP.Subscribe("VTM.SetSpeed", (cmd, args) => { PostMsg(MSG.SetSpeed, args); return true; });
|
|
|
OP.Subscribe("VTM.QuerySpeed", (cmd, args) => { PostMsg(MSG.QuerySpeed, args); return true; });
|
|
|
OP.Subscribe("VTM.SaveSpeed", (cmd, args) => { PostMsg(MSG.SaveSpeed, args); return true; });
|
|
|
+ OP.Subscribe("VTM.CheckHeight", (cmd, args) => { PostMsg(MSG.CheckHeight, args); return true; });
|
|
|
return true;
|
|
|
}
|
|
|
|
|
@@ -297,6 +306,11 @@ namespace JetMainframe.TMs.TM
|
|
|
Transition(STATE.SaveSpeeding, FSM_MSG.TIMER, fnSaveSpeedTimeout, STATE.Idle);
|
|
|
Transition(STATE.SaveSpeeding, MSG.Abort, fnAbortSaveSpeed, STATE.Idle);
|
|
|
|
|
|
+ //Check Blade Height
|
|
|
+ Transition(STATE.Idle, MSG.CheckHeight, fnStartCheckHeight, STATE.QueryHeight);
|
|
|
+ Transition(STATE.QueryHeight, FSM_MSG.TIMER, fnCheckHeightTimeout, STATE.Idle);
|
|
|
+ Transition(STATE.QueryHeight, MSG.Abort, fnAbortCheckHeight, STATE.Idle);
|
|
|
+
|
|
|
//Control
|
|
|
AnyStateTransition(FSM_MSG.TIMER, fnControlPressure, FSM_STATE.SAME);
|
|
|
|
|
@@ -668,6 +682,33 @@ namespace JetMainframe.TMs.TM
|
|
|
return _robot.QuerySpeed(param[0].ToString());
|
|
|
}
|
|
|
|
|
|
+ private bool fnStartCheckHeight(object[] param)
|
|
|
+ {
|
|
|
+ if (_CheckArmHeightRoutine == null)
|
|
|
+ return false;
|
|
|
+ else
|
|
|
+ return _CheckArmHeightRoutine.Start() == RState.Running;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ private bool fnCheckHeightTimeout(object[] param)
|
|
|
+ {
|
|
|
+ RState ret = _CheckArmHeightRoutine.Monitor();
|
|
|
+ if (ret == RState.Failed || ret == RState.Timeout)
|
|
|
+ {
|
|
|
+ PostMsg(MSG.Error);
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ return ret == RState.End;
|
|
|
+ }
|
|
|
+
|
|
|
+ private bool fnAbortCheckHeight(object[] param)
|
|
|
+ {
|
|
|
+ _CheckArmHeightRoutine.Abort();
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
private bool fnSetSpeedTimeout(object[] param)
|
|
|
{
|
|
|
RState ret = _robot.Status;
|