HongHuVR.cs 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542
  1. using Aitex.Core.RT.Log;
  2. using Aitex.Core.RT.SCCore;
  3. using Aitex.Core.Util;
  4. using Aitex.Sorter.Common;
  5. using MECF.Framework.Common.CommonData;
  6. using MECF.Framework.Common.Equipment;
  7. using MECF.Framework.Common.SubstrateTrackings;
  8. using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.Robot;
  9. using System;
  10. using System.Collections.Concurrent;
  11. using System.Collections.Generic;
  12. using System.ComponentModel;
  13. using System.Diagnostics.Tracing;
  14. using System.Linq;
  15. using System.Runtime.InteropServices;
  16. using System.Text;
  17. using System.Text.RegularExpressions;
  18. using System.Threading.Tasks;
  19. using Venus_Core;
  20. using Venus_RT.Modules;
  21. namespace Venus_RT.Devices.VCE
  22. {
  23. //泓浒
  24. enum VRStep
  25. {
  26. Idle,
  27. Home,
  28. Move,
  29. Halt,
  30. Release,
  31. Goto,
  32. Pick,
  33. PickExtend,
  34. PickRetract,
  35. Place,
  36. PlaceExtend,
  37. PlaceRetract,
  38. Xfer,
  39. CheckLoad_ArmA,
  40. CheckLoad_ArmB,
  41. SetLoad,
  42. ReQueryLoadA,
  43. ReQueryLoadB,
  44. }
  45. public class HongHuVR : ITransferRobot
  46. {
  47. private readonly AsyncSocket _socket;
  48. private const string EOF = "\n";
  49. private RState _status;
  50. private bool _IsHomed;
  51. private VRStep _currentStep = VRStep.Idle;
  52. private Dictionary<string, int> _StationNumbers = new Dictionary<string, int>();
  53. public RState Status { get { return _status; } }
  54. public bool IsHomed { get { return _IsHomed; } }
  55. private string Hand2Arm(Hand hand) => hand == Hand.Blade2 ? "B" : "A";
  56. //private readonly Regex _rex_check_load = new Regex(@"LOAD\s+(A|B)\s+(\w+)\s*");
  57. private readonly Regex _rex_check_load = new Regex(@"CHECK LOAD\s*");
  58. private readonly Regex _rex_rq_load_A = new Regex(@"LOAD\sA\s.*");
  59. private readonly Regex _rex_rq_load_B = new Regex(@"LOAD\sB\s.*");
  60. private readonly Regex _rex_error_code = new Regex(@"_ERR\s+(\d+)\s*");
  61. private RobotMoveInfo _robotMoveInfo = new RobotMoveInfo();
  62. public RobotMoveInfo TMRobotMoveInfo { get { return _robotMoveInfo; } }
  63. public double Offset_X => 0;
  64. public double Offset_Y => 0;
  65. public double Offset_D => 0;
  66. public Dictionary<string, string> _error2msg = new Dictionary<string, string>()
  67. {
  68. {"221" , "手臂选择无效,检查指令中的对应参数" },
  69. {"222" , "无效的 Pan 参数"},
  70. {"305" , "无法识别的命令,检查指令" },
  71. {"309" , "不支持的指令,检查指令" },
  72. {"350" , "解析器错误,堆栈溢出,检查指令" },
  73. {"402" , "槽位参数异常,检查指令中的对应参数" },
  74. {"403" , "Slot编号错误,指令的参数中指定的 Slot 编号超过了有效范围" },
  75. {"407" , "旋转轴超过限位,检查指令中的对应参数" },
  76. {"408" , "伸展轴超过限位,检查指令中的对应参数" },
  77. {"409" , "升降轴超过限位,检查指令中的对应参数" },
  78. {"416" , "无法执行 CheckLoad 操作,检查指令中的对应参数" },
  79. {"417" , "Offset 参数参数超限,检查指令中指定的 offset 值是否在允许范围内" },
  80. {"418" , "AWC 功能检测到误差过大,检查晶圆是否过偏或检查AWC传感器标定参数" },
  81. {"420" , "副臂没有在HOME位置,请检查副臂的位置,可以使用HOME ALL使得所有关节姿态回到HOME位置" },
  82. {"451" , "取片后 AWC校验异常,机械臂取片后缩回时,检测到晶圆偏心过大,或者 AWC 校验失败" },
  83. {"550" , "Station参数超出范围,检查站点配置参数" },
  84. {"551" , "ARM 不在站点,检查当前手臂实际位置与逻辑位置" },
  85. {"560" , "机械臂处于 HALT 状态,拒绝接受新的指令" },
  86. {"561" , "当前机械臂状态机与指令不匹配,当前状态机不满足执行该指令的条件" },
  87. {"600" , "PAligner通讯异常,检查与 PA 的通讯电缆,上电情况等" },
  88. {"603" , "收到急停指令" },
  89. {"608" , "机械臂急停中" },
  90. {"610" , "手持示教器急停按钮按下" },
  91. {"692" , "检测左 PAN 上有片,与逻辑状态不匹配" },
  92. {"693" , "检测右 PAN 上有片,与逻辑状态不匹配" },
  93. {"694" , "检测左 PAN 上无片,与逻辑状态不匹配" },
  94. {"695" , "检测右 PAN 上有片,与逻辑状态不匹配" },
  95. {"700" , "当前手臂有晶圆 ,检查指令动作要求的晶圆状态,与手臂内部存储的晶圆状态是否匹配" },
  96. {"701" , "当前手臂无晶圆,检查指令动作要求的晶圆状态,与手臂内部存储的晶圆状态是否匹配"},
  97. {"711" , "站点互锁错误,检查站点的“允许机械臂进入信号”是否就绪"},
  98. {"721" , "取片失败,检查手臂晶圆状态,或者晶圆检测传感器状态"},
  99. {"722" , "放片失败,检查手臂晶圆状态,或者晶圆检测传感器状态"},
  100. {"771" , "取片时 AWC 传感器检测失败,检查 AWC 传感器状态,或者 AWC 配置相关是否正确"},
  101. {"791" , "查询 AWC 数据失败,未曾执行过 AWC 相关功能的操作"},
  102. {"792" , "AWC 传感器检测失败,检查AWC传感器状态,或者AWC配置相关是否正确"},
  103. {"799" , "放片失败,检查手臂晶圆状态,或者晶圆检测传感器状态"},
  104. {"802" , "伺服报错,伺服提示异常,目前暂时无法读取伺服错误。开机盖可以读到伺服信息。一般整机断电重启。"},
  105. {"803" , "机械臂上电失败,HOME ALL 指令,或者其他上电操作,驱动器未能正常响应上电"},
  106. {"805" , "第1个伺服收敛异常,伺服没有在规定时间内运动到位置,或者停稳。"},
  107. {"806" , "第2个伺服收敛异常,伺服没有在规定时间内运动到位置,或者停稳。"},
  108. {"807" , "第3个伺服收敛异常,伺服没有在规定时间内运动到位置,或者停稳。"},
  109. {"808" , "第4个伺服收敛异常,伺服没有在规定时间内运动到位置,或者停稳。"},
  110. {"1100" , "无法安全回 HOME 操作,检查机械臂是否在安全 HOME 半径内,常见于双臂机械臂,双臂同时伸出超过安全位"},
  111. {"1805" , "当前处于示教器模式,检查示教器档位,一般此时处于 Teach 档位"},
  112. {"13004" , "PA报错,检查 PA 运行状态,PA 扫片结果等"},
  113. };
  114. private BlockingCollection<RobotAnimationData> blockingCollection = new BlockingCollection<RobotAnimationData>();
  115. private ModuleName _module;
  116. public HongHuVR(ModuleName module)
  117. {
  118. _module = module;
  119. _socket = new AsyncSocket("", EOF);
  120. _socket.Connect(SC.GetStringValue($"{_module}.IPAddress"));
  121. _socket.OnDataChanged += OnReceiveMessage;
  122. _socket.OnErrorHappened += OnErrorHappen;
  123. _status = RState.Init;
  124. _IsHomed = false;
  125. _StationNumbers[ModuleName.VCE1.ToString()] = SC.GetValue<int>($"{_module}.VCE1StationNumber");
  126. _StationNumbers[ModuleName.VCEA.ToString()] = SC.GetValue<int>($"{_module}.VCEAStationNumber");
  127. _StationNumbers[ModuleName.VCEB.ToString()] = SC.GetValue<int>($"{_module}.VCEBStationNumber");
  128. _StationNumbers[ModuleName.Aligner1.ToString()] = SC.GetValue<int>($"{_module}.VPAStationNumber");
  129. _StationNumbers[ModuleName.PMA.ToString()] = SC.GetValue<int>($"{_module}.PMAStationNumber");
  130. _StationNumbers[ModuleName.PMB.ToString()] = SC.GetValue<int>($"{_module}.PMBStationNumber");
  131. _StationNumbers[ModuleName.PMC.ToString()] = SC.GetValue<int>($"{_module}.PMCStationNumber");
  132. _StationNumbers[ModuleName.PMD.ToString()] = SC.GetValue<int>($"{_module}.PMDStationNumber");
  133. _StationNumbers["CheckLoad"] = SC.GetValue<int>($"{_module}.CheckStationNumber");
  134. WaferManager.Instance.SubscribeLocation(ModuleName.TMRobot, 2);
  135. Task.Run(() =>
  136. {
  137. foreach (var data in blockingCollection.GetConsumingEnumerable())
  138. {
  139. _robotMoveInfo.Action = data.Action;
  140. _robotMoveInfo.ArmTarget = data.Hand == Hand.Blade1 ? RobotArm.ArmA : (data.Hand == Hand.Both ? RobotArm.Both : RobotArm.ArmB);
  141. _robotMoveInfo.BladeTarget = $"{_robotMoveInfo.ArmTarget}.{data.Target}";
  142. System.Threading.Thread.Sleep(300);
  143. }
  144. });
  145. }
  146. //初始化某个轴
  147. //1.清错
  148. //2.设备上电
  149. //3.各轴按顺序运动
  150. public bool Home()
  151. {
  152. _status = RState.Running;
  153. _currentStep = VRStep.Home;
  154. return _SendCommand("HOME ALL");
  155. }
  156. public bool Halt()
  157. {
  158. _status = RState.Running;
  159. _currentStep = VRStep.Halt;
  160. return _SendCommand("HALT");
  161. }
  162. public bool Release()
  163. {
  164. _status = RState.Running;
  165. _currentStep = VRStep.Release;
  166. return _SendCommand("RELEASE");
  167. }
  168. //public bool MOVE()
  169. //{
  170. //}
  171. public bool Pick(ModuleName station, int slot, Hand hand)
  172. {
  173. if (!CheckRobotStatus())
  174. return false;
  175. _currentStep = VRStep.Pick;
  176. _status = RState.Running;
  177. SetRobotMovingInfo(RobotAction.Picking, hand, station);
  178. return _SendCommand($"PICK {_StationNumbers[station.ToString()]} ARM {Hand2Arm(hand)}");
  179. }
  180. public bool PickExtend(ModuleName station, int slot, Hand hand)
  181. {
  182. if (!CheckRobotStatus())
  183. return false;
  184. _currentStep = VRStep.PickExtend;
  185. _status = RState.Running;
  186. SetRobotMovingInfo(RobotAction.Extending, hand, station);
  187. return _SendCommand($"PICK {_StationNumbers[station.ToString()]} ARM {Hand2Arm(hand)} ENRT NR");
  188. }
  189. public bool PickRetract(ModuleName station, int slot, Hand hand)
  190. {
  191. if (!CheckRobotStatus())
  192. return false;
  193. _currentStep = VRStep.PickRetract;
  194. _status = RState.Running;
  195. SetRobotMovingInfo(RobotAction.Retracting, hand, station);
  196. return _SendCommand($"PICK {_StationNumbers[station.ToString()]} ARM {Hand2Arm(hand)} STRT NR");
  197. }
  198. public bool Place(ModuleName station, int slot, Hand hand)
  199. {
  200. if (!CheckRobotStatus())
  201. return false;
  202. _currentStep = VRStep.Place;
  203. _status = RState.Running;
  204. SetRobotMovingInfo(RobotAction.Placing, hand, station);
  205. return _SendCommand($"PLACE {_StationNumbers[station.ToString()]} ARM {Hand2Arm(hand)}");
  206. }
  207. public bool PlaceExtend(ModuleName station, int slot, Hand hand)
  208. {
  209. if (!CheckRobotStatus())
  210. return false;
  211. _currentStep = VRStep.Place;
  212. _status = RState.Running;
  213. SetRobotMovingInfo(RobotAction.Extending, hand, station);
  214. return _SendCommand($"PLACE {_StationNumbers[station.ToString()]} ARM {Hand2Arm(hand)} ENRT NR");
  215. }
  216. public bool PlaceRetract(ModuleName station, int slot, Hand hand)
  217. {
  218. if (!CheckRobotStatus())
  219. return false;
  220. _currentStep = VRStep.Place;
  221. _status = RState.Running;
  222. SetRobotMovingInfo(RobotAction.Retracting, hand, station);
  223. return _SendCommand($"PLACE {_StationNumbers[station.ToString()]} ARM {Hand2Arm(hand)} STRT NR");
  224. }
  225. public bool Transfer(ModuleName fromstation, ModuleName tostation, Hand hand)
  226. {
  227. if (!CheckRobotStatus())
  228. return false;
  229. _currentStep = VRStep.Xfer;
  230. _status = RState.Running;
  231. return _SendCommand($"XFER ARM {Hand2Arm(hand)} {_StationNumbers[fromstation.ToString()]} {_StationNumbers[tostation.ToString()]}");
  232. }
  233. public bool CheckLoad(Hand hand = Hand.Blade1)
  234. {
  235. if (_currentStep != VRStep.Home && _currentStep != VRStep.CheckLoad_ArmA && !CheckRobotStatus())
  236. return false;
  237. _currentStep = hand == Hand.Blade2 ? VRStep.CheckLoad_ArmB : VRStep.CheckLoad_ArmA;
  238. _status = RState.Running;
  239. string arm = hand == Hand.Blade2 ? "B" : "A";
  240. return _SendCommand($"CHECK LOAD {_StationNumbers["CheckLoad"]} {arm}");
  241. }
  242. public bool QueryAwc()
  243. {
  244. return true;
  245. }
  246. public bool Goto(ModuleName station, int slot, Hand hand)
  247. {
  248. if (!CheckRobotStatus())
  249. return false;
  250. _currentStep = VRStep.Goto;
  251. _status = RState.Running;
  252. SetRobotMovingInfo(RobotAction.Rotating, hand, station);
  253. return _SendCommand($"Goto {_StationNumbers[station.ToString()]} ARM {Hand2Arm(hand)}");
  254. }
  255. public bool MoveTo(ModuleName stnFrom, ModuleName stnTo, Hand hand)
  256. {
  257. _currentStep = VRStep.Move;
  258. _status = RState.Running;
  259. return _SendCommand($"MOVE R ABS 100 ARM {Hand2Arm(hand)}"); ;
  260. }
  261. public bool PickWithOffset(ModuleName station, int slot, Hand hand, int Roffset, int Toffset)
  262. {
  263. _currentStep = VRStep.Pick;
  264. _status = RState.Running;
  265. return _SendCommand($"PICK {_StationNumbers[station.ToString()]} ARM {Hand2Arm(hand)} RO {Roffset} TO {Toffset}"); ;
  266. }
  267. public bool ReQueryLoadA()
  268. {
  269. _currentStep = VRStep.ReQueryLoadA;
  270. _status = RState.Running;
  271. return _SendCommand($"RQ LOAD ARM A");
  272. }
  273. public bool ReQueryLoadB()
  274. {
  275. _currentStep = VRStep.ReQueryLoadB;
  276. _status = RState.Running;
  277. return _SendCommand($"RQ LOAD ARM B");
  278. }
  279. private bool _SendCommand(string cmd)
  280. {
  281. LOG.WriteSingeLine(eEvent.INFO_TM_ROBOT, ModuleName.TMRobot, $"Send Command to TMRobot: {cmd},Connect:{_socket.IsConnected}");
  282. return _socket.Write(cmd + EOF);
  283. }
  284. private bool CheckRobotStatus()
  285. {
  286. if (Status == RState.Init)
  287. {
  288. LOG.Write(eEvent.ERR_DEVICE_INFO, ModuleName.TMRobot, "TMRobot is not homed, please home first.");
  289. return false;
  290. }
  291. else if (Status == RState.Running)
  292. {
  293. LOG.Write(eEvent.ERR_DEVICE_INFO, ModuleName.TMRobot, "TMRobot is busy, please wait a minute");
  294. return false;
  295. }
  296. else if (Status == RState.Failed || Status == RState.Timeout)
  297. {
  298. LOG.Write(eEvent.ERR_DEVICE_INFO, ModuleName.TMRobot, "TMRobot has a error, please check and fix the hardware issue and home it");
  299. return false;
  300. }
  301. return true;
  302. }
  303. private void OnReceiveMessage(string revMsg)
  304. {
  305. string[] ResMsgs = revMsg.Split('\n');
  306. foreach (string revRawMsg in ResMsgs)
  307. {
  308. if (string.IsNullOrWhiteSpace(revRawMsg)) continue;
  309. string RevMsg = revRawMsg.Trim();
  310. LOG.WriteSingeLine(eEvent.INFO_TM_ROBOT, ModuleName.TMRobot, $"Receive message from TMRobot: {RevMsg}, while {_currentStep}");
  311. if (_rex_error_code.IsMatch(RevMsg))
  312. {
  313. _IsHomed = false;
  314. _status = RState.Failed;
  315. var results = _rex_error_code.Match(RevMsg);
  316. ErrorMessageHandler(results.Groups[1].Value);
  317. return;
  318. }
  319. switch (_currentStep)
  320. {
  321. case VRStep.Goto:
  322. case VRStep.Halt:
  323. case VRStep.Move:
  324. case VRStep.Xfer:
  325. case VRStep.Pick:
  326. case VRStep.PickExtend:
  327. case VRStep.PickRetract:
  328. case VRStep.Place:
  329. case VRStep.PlaceExtend:
  330. case VRStep.PlaceRetract:
  331. {
  332. if (RevMsg.Trim() == "_RDY" || (RevMsg.Contains("_RDY") && !RevMsg.Contains("_ERR")))
  333. {
  334. _currentStep = VRStep.Idle;
  335. _status = RState.End;
  336. }
  337. else
  338. {
  339. ReportWrongMsg(RevMsg);
  340. }
  341. if (_currentStep != VRStep.PickExtend && _currentStep != VRStep.PlaceExtend)
  342. SetRobotMovingInfo(RobotAction.None, Hand.Both, ModuleName.TMRobot);
  343. }
  344. break;
  345. case VRStep.Home:
  346. {
  347. if (RevMsg.Trim() == "_RDY")
  348. {
  349. //CheckLoad(Hand.Blade1);
  350. _currentStep = VRStep.Idle;
  351. _status = RState.End;
  352. _IsHomed = true;
  353. SetRobotMovingInfo(RobotAction.Homing, Hand.Both, ModuleName.SETM);
  354. }
  355. else
  356. ReportWrongMsg(RevMsg);
  357. }
  358. break;
  359. case VRStep.CheckLoad_ArmA:
  360. {
  361. if (_rex_check_load.IsMatch(RevMsg))
  362. {
  363. GetCheckLoadResult(RevMsg);
  364. //CheckLoad(Hand.Blade2);
  365. }
  366. if (RevMsg.Trim() == "_RDY" || (RevMsg.Contains("_RDY") && !RevMsg.Contains("_ERR")))
  367. {
  368. _currentStep = VRStep.Idle;
  369. _status = RState.End;
  370. }
  371. }
  372. break;
  373. case VRStep.CheckLoad_ArmB:
  374. {
  375. if (_rex_check_load.IsMatch(RevMsg))
  376. {
  377. GetCheckLoadResult(RevMsg);
  378. //_currentStep = VRStep.Idle;
  379. //_status = RState.End;
  380. //_IsHomed = true;
  381. }
  382. if (RevMsg.Trim() == "_RDY" || (RevMsg.Contains("_RDY") && !RevMsg.Contains("_ERR")))
  383. {
  384. _currentStep = VRStep.Idle;
  385. _status = RState.End;
  386. }
  387. }
  388. break;
  389. case VRStep.ReQueryLoadA:
  390. if (_rex_rq_load_A.IsMatch(RevMsg))
  391. {
  392. string WaferStatus = RevMsg.Split(' ')[2];
  393. //LOG.Write(eEvent.WARN_DEFAULT_WARN, ModuleName.TMRobot, WaferStatus);
  394. if (WaferStatus.Contains("ON") && WaferManager.Instance.CheckNoWafer(ModuleName.TMRobot, 0))
  395. {
  396. WaferManager.Instance.CreateWafer(ModuleName.TMRobot, 0, Aitex.Core.Common.WaferStatus.Normal);
  397. }
  398. if (WaferStatus.Contains("OFF"))
  399. {
  400. //LOG.Write(eEvent.WARN_DEFAULT_WARN, ModuleName.TMRobot, "contains off");
  401. WaferManager.Instance.DeleteWafer(ModuleName.TMRobot, 0);
  402. }
  403. }
  404. else
  405. {
  406. if (RevMsg.Trim() == "_RDY" || (RevMsg.Contains("_RDY") && !RevMsg.Contains("_ERR")))
  407. {
  408. _currentStep = VRStep.Idle;
  409. _status = RState.End;
  410. }
  411. else
  412. {
  413. ReportWrongMsg(RevMsg);
  414. }
  415. }
  416. break;
  417. case VRStep.ReQueryLoadB:
  418. if (_rex_rq_load_B.IsMatch(RevMsg))
  419. {
  420. string WaferStatus = RevMsg.Split(' ')[2];
  421. //LOG.Write(eEvent.WARN_DEFAULT_WARN, ModuleName.TMRobot, WaferStatus);
  422. if (WaferStatus.Contains("ON") && WaferManager.Instance.CheckNoWafer(ModuleName.TMRobot, 1))
  423. {
  424. WaferManager.Instance.CreateWafer(ModuleName.TMRobot, 1, Aitex.Core.Common.WaferStatus.Normal);
  425. }
  426. if (WaferStatus.Contains("OFF"))
  427. {
  428. WaferManager.Instance.DeleteWafer(ModuleName.TMRobot, 1);
  429. }
  430. }
  431. else
  432. {
  433. if (RevMsg.Trim() == "_RDY" || (RevMsg.Contains("_RDY") && !RevMsg.Contains("_ERR")))
  434. {
  435. _currentStep = VRStep.Idle;
  436. _status = RState.End;
  437. }
  438. else
  439. {
  440. ReportWrongMsg(RevMsg);
  441. }
  442. }
  443. break;
  444. default:
  445. if (!RevMsg.Contains("_EVENT"))
  446. ReportWrongMsg(RevMsg);
  447. break;
  448. }
  449. }
  450. }
  451. private void GetCheckLoadResult(string revMsg)
  452. {
  453. Match result = _rex_check_load.Match(revMsg);
  454. string Arm = result.Groups[1].Value;
  455. string WaferStatus = result.Groups[2].Value;
  456. if (WaferStatus == "ON")
  457. {
  458. WaferManager.Instance.CreateWafer(ModuleName.TMRobot, Arm == "A" ? 0 : 1, Aitex.Core.Common.WaferStatus.Unknown);
  459. }
  460. }
  461. private void ErrorMessageHandler(string errorcode)
  462. {
  463. string ErrorInfo;
  464. if (_error2msg.ContainsKey(errorcode))
  465. {
  466. ErrorInfo = _error2msg[errorcode];
  467. LOG.Write(eEvent.ERR_DEVICE_INFO, ModuleName.TMRobot, ErrorInfo);
  468. }
  469. else
  470. {
  471. LOG.Write(eEvent.ERR_DEVICE_INFO, ModuleName.TMRobot, $"Dictionary Not Contains error code:{errorcode}");
  472. }
  473. _IsHomed = false;
  474. }
  475. private void OnErrorHappen(ErrorEventArgs args)
  476. {
  477. //Singleton<RouteManager>.Instance.SETM.PostMsg(SETMEntity.MSG.Error);
  478. LOG.Write(eEvent.ERR_DEVICE_INFO, ModuleName.TMRobot, $"HongHu TMRobot Error: {args.Reason} while {_currentStep}");
  479. }
  480. private void ReportWrongMsg(string revMsg)
  481. {
  482. LOG.Write(eEvent.WARN_DEVICE_INFO, ModuleName.TMRobot, $"Receive wrong message:{revMsg} while {_currentStep}");
  483. }
  484. public void SetRobotMovingInfo(RobotAction action, Hand hand, ModuleName target)
  485. {
  486. _robotMoveInfo.Action = action;
  487. _robotMoveInfo.ArmTarget = hand == Hand.Blade1 ? RobotArm.ArmA : (hand == Hand.Both ? RobotArm.Both : RobotArm.ArmB);
  488. _robotMoveInfo.BladeTarget = $"{_robotMoveInfo.ArmTarget}.{target}";
  489. }
  490. }
  491. }