SrdArmAxisInterLock.cs 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. using Aitex.Core.RT.Device;
  2. using Aitex.Core.RT.Log;
  3. using CyberX8_RT.Devices.AXIS;
  4. using CyberX8_RT.Devices.AXIS.CANOpen;
  5. using CyberX8_RT.Devices.Facilities;
  6. using System;
  7. using System.Collections.Generic;
  8. using System.Linq;
  9. using System.Text;
  10. using System.Threading.Tasks;
  11. namespace CyberX8_RT.Devices.SRD
  12. {
  13. public class SrdArmAxisInterLock : IAxisInterLock
  14. {
  15. #region 内部变量
  16. private JetAxisBase _axis;
  17. #endregion
  18. #region 属性
  19. /// <summary>
  20. /// 模块名称
  21. /// </summary>
  22. public string Module { get { return _axis.Module; } }
  23. /// <summary>
  24. /// 子模块名称
  25. /// </summary>
  26. public string Name { get { return _axis.Name; } }
  27. #endregion
  28. /// <summary>
  29. /// 构造函数
  30. /// </summary>
  31. /// <param name="Module"></param>
  32. /// <param name="name"></param>
  33. public SrdArmAxisInterLock(JetAxisBase axis)
  34. {
  35. _axis = axis;
  36. }
  37. /// <summary>
  38. /// GotoPosition判定前置条件
  39. /// </summary>
  40. /// <param name="station"></param>
  41. /// <returns></returns>
  42. public bool CheckGotoPosition(string station)
  43. {
  44. if (!_axis.IsHomed)
  45. {
  46. LOG.WriteLog(eEvent.ERR_PUF, Module, "axis is not home, Cannot execute GotoSavedPosition");
  47. return false;
  48. }
  49. if (!_axis.IsSwitchOn)
  50. {
  51. LOG.WriteLog(eEvent.ERR_PUF, Module, "axis is switch off, Cannot execute GotoSavedPosition");
  52. return false;
  53. }
  54. SystemFacilities systemFacilities = DEVICE.GetDevice<SystemFacilities>("System.Facilities");
  55. var result= systemFacilities.CheckCDAN2();
  56. if(!result.result)
  57. {
  58. LOG.WriteLog(eEvent.ERR_SRD, Module, $"{result.reason},Arm can not position");
  59. return false;
  60. }
  61. return true;
  62. }
  63. }
  64. }