|
@@ -26,6 +26,7 @@ using CyberX8_RT.Modules.Transporter;
|
|
|
using MECF.Framework.Common.Alarm;
|
|
|
using MECF.Framework.Common.CommonData;
|
|
|
using CyberX8_RT.Modules.Loader;
|
|
|
+using Aitex.Core.RT.Routine;
|
|
|
|
|
|
namespace CyberX8_RT.Modules
|
|
|
{
|
|
@@ -219,7 +220,7 @@ namespace CyberX8_RT.Modules
|
|
|
private bool _isHomed = false;
|
|
|
private EfemAutoMessageProcessor _autoMessageProcessor;
|
|
|
private STATE _errorPreState;
|
|
|
-
|
|
|
+ private IRoutine _currentRoutine;
|
|
|
private int _currentCycleTimes;
|
|
|
// Constructor
|
|
|
public EfemEntity()
|
|
@@ -470,9 +471,11 @@ namespace CyberX8_RT.Modules
|
|
|
|
|
|
private bool fnHomingTimeout(object[] param)
|
|
|
{
|
|
|
+ _currentRoutine = _homeRoutine;
|
|
|
RState ret = _homeRoutine.Monitor();
|
|
|
if (ret == RState.Failed || ret == RState.Timeout)
|
|
|
{
|
|
|
+ _currentRoutine = null;
|
|
|
PostMsg(MSG.Error);
|
|
|
return false;
|
|
|
}
|
|
@@ -482,7 +485,7 @@ namespace CyberX8_RT.Modules
|
|
|
{
|
|
|
_isHomed= true;
|
|
|
RecoverLPStatus();
|
|
|
-
|
|
|
+ _currentRoutine = null;
|
|
|
}
|
|
|
return result;
|
|
|
}
|
|
@@ -496,27 +499,23 @@ namespace CyberX8_RT.Modules
|
|
|
|
|
|
private bool fnHomeRobot(object[] param)
|
|
|
{
|
|
|
- if (_isHomed)
|
|
|
- {
|
|
|
- return _homeRoutine.Start(ModuleName.EfemRobot) == RState.Running;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- return false;
|
|
|
- }
|
|
|
+ return _homeRoutine.Start(ModuleName.EfemRobot) == RState.Running;
|
|
|
}
|
|
|
private bool fnHomingRobotTimeout(object[] param)
|
|
|
{
|
|
|
+ _currentRoutine = _homeRoutine;
|
|
|
RState ret = _homeRoutine.Monitor();
|
|
|
if (ret == RState.Failed || ret == RState.Timeout)
|
|
|
{
|
|
|
PostMsg(MSG.Error);
|
|
|
+ _currentRoutine = _homeRoutine;
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
bool result = ret == RState.End;
|
|
|
if (result)
|
|
|
{
|
|
|
+ _currentRoutine = null;
|
|
|
AlarmListManager.Instance.CheckModuleAlamAndRemove(Module.ToString(), STATE.Idle.ToString());
|
|
|
}
|
|
|
return result;
|
|
@@ -538,9 +537,11 @@ namespace CyberX8_RT.Modules
|
|
|
|
|
|
private bool fnHomingAlignTimeout(object[] param)
|
|
|
{
|
|
|
+ _currentRoutine = _homeRoutine;
|
|
|
RState ret = _homeRoutine.Monitor();
|
|
|
if (ret == RState.Failed || ret == RState.Timeout)
|
|
|
{
|
|
|
+ _currentRoutine = null;
|
|
|
PostMsg(MSG.Error);
|
|
|
return false;
|
|
|
}
|
|
@@ -548,6 +549,7 @@ namespace CyberX8_RT.Modules
|
|
|
bool result = ret == RState.End;
|
|
|
if (result)
|
|
|
{
|
|
|
+ _currentRoutine = null;
|
|
|
AlarmListManager.Instance.CheckModuleAlamAndRemove(Module.ToString(), STATE.Idle.ToString());
|
|
|
}
|
|
|
return result;
|
|
@@ -663,6 +665,10 @@ namespace CyberX8_RT.Modules
|
|
|
private bool fnAbortRobot(object[] param)
|
|
|
{
|
|
|
//_efem.ExecuteAction();
|
|
|
+ if (_currentRoutine != null)
|
|
|
+ {
|
|
|
+ _currentRoutine.Abort();
|
|
|
+ }
|
|
|
_efem.Halt();
|
|
|
return true;
|
|
|
}
|
|
@@ -726,15 +732,18 @@ namespace CyberX8_RT.Modules
|
|
|
|
|
|
private bool FnPickTimeout(object[] param)
|
|
|
{
|
|
|
+ _currentRoutine = _pickRoutine;
|
|
|
RState ret = _pickRoutine.Monitor();
|
|
|
if (ret == RState.Failed || ret == RState.Timeout)
|
|
|
{
|
|
|
PostMsg(MSG.Error,_pickRoutine.ErrorMsg);
|
|
|
+ _currentRoutine = null;
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
if (ret == RState.End)
|
|
|
{
|
|
|
+ _currentRoutine = null;
|
|
|
AlarmListManager.Instance.CheckModuleAlamAndRemove(Module.ToString(), STATE.Picking.ToString());
|
|
|
}
|
|
|
|
|
@@ -830,14 +839,17 @@ namespace CyberX8_RT.Modules
|
|
|
|
|
|
private bool FnPlaceTimeout(object[] param)
|
|
|
{
|
|
|
+ _currentRoutine = _placeRoutine;
|
|
|
RState ret = _placeRoutine.Monitor();
|
|
|
if (ret == RState.Failed || ret == RState.Timeout)
|
|
|
{
|
|
|
+ _currentRoutine = null;
|
|
|
PostMsg(MSG.Error,_placeRoutine.ErrorMsg);
|
|
|
return false;
|
|
|
}
|
|
|
if (ret == RState.End)
|
|
|
{
|
|
|
+ _currentRoutine = null;
|
|
|
AlarmListManager.Instance.CheckModuleAlamAndRemove(Module.ToString(), STATE.Placing.ToString());
|
|
|
}
|
|
|
return ret == RState.End;
|
|
@@ -974,15 +986,18 @@ namespace CyberX8_RT.Modules
|
|
|
}
|
|
|
private bool fnAlignTimeout(object[] param)
|
|
|
{
|
|
|
+ _currentRoutine = _alignRoutine;
|
|
|
RState ret = _alignRoutine.Monitor();
|
|
|
if (ret == RState.Failed || ret == RState.Timeout)
|
|
|
{
|
|
|
+ _currentRoutine = null;
|
|
|
PostMsg(MSG.Error,_alignRoutine.ErrorMsg);
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
if (ret == RState.End)
|
|
|
{
|
|
|
+ _currentRoutine = null;
|
|
|
AlarmListManager.Instance.CheckModuleAlamAndRemove(Module.ToString(), STATE.Aligning.ToString());
|
|
|
}
|
|
|
|