Machine.h 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. #pragma once
  2. #include <vector>
  3. #define HIKVISION_CAMERA_EXPORTS
  4. #include "CCameraManage.h"
  5. #include "CModule.h"
  6. #include "CCalib.h"
  7. #include "CBondHead.h"
  8. #include "CXYCalib.h"
  9. #include "CHIKVisionCamera.h"
  10. #include "CWafflePackHead.h"
  11. #include "CWaferTable.h"
  12. #include "JMotion.h"
  13. #include "CTransferTable.h"
  14. #include "CBondTable.h"
  15. #include "CNozzleTable.h"
  16. #include "CForceControl.h"
  17. #include "VerticalMeasure.h"
  18. #include "HorizMeasure.h"
  19. #include "CAxis.h"
  20. #include "CWafflePackHead.h"
  21. #include "CWaferHead.h"
  22. #include "CUltraHead.h"
  23. #include "CEutecticHead.h"
  24. #ifdef C_MACHINE_EXPORTS
  25. #define C_MACHINE_DLL_API __declspec(dllexport)
  26. #else
  27. #define C_MACHINE_DLL_API //__declspec(dllimport)
  28. #endif
  29. /*
  30. 初始化过程:
  31. 1、调用运控库对象,创建卡、轴、IO
  32. 2、调用资源大类,加载资源大类中的所有资源
  33. 3、创建模组对象,创建完对象后将轴、IO对象设置到模组中
  34. 4、创建测量对象,力控标定和使用对象(根据力控轴数量创建)、垂直测量对象、水平测量对象
  35. 注:由于水平测量也需要使用和垂直测量均使用了测高,需要使用力控标定对象,所以力控标定对象在Machine中创建,再将对象指针给各个模组
  36. 注:测量对象模组中并不会再次使用,认为属于机台,不属于模组
  37. 5、初始化模组:
  38. (1)初始化资源:创建该模组需要的功能对象,包括插补对象、标定对象(需要轴、相机,无法在构造函数创建)、PR策略(需要轴、相机)、矩阵数据等
  39. (2)从数据库拷贝一份数据保存到对象中,包括该模组中其他对象的数据加载
  40. Machine类认为是机台大类,属于机台不属于模组的轴、IO、对象也在Machine类中创建和控制。(是否应该继承Module)
  41. */
  42. class C_MACHINE_DLL_API Machine
  43. {
  44. public:
  45. enum HeadType
  46. {
  47. UltralHead, //超声头
  48. EutecticHead, //共晶头
  49. };
  50. static Machine* GetInstance();
  51. static void releaseInstance();
  52. JMotion* GetMotion() {return m_pMotion;}
  53. LONG ToHome();
  54. vector<CAxis*> GetMachineAllAxis() {return m_vetAxis;};
  55. CBondHead* GetBondHead() {return m_pBondHead;}
  56. //CUltraHead* GetUltraHead() { return m_pBondHead; };
  57. CBondTable* GetBondTable() { return m_pBondTable; }
  58. //CEutecticHead* GetEutecticHead() { return m_pEutecticHead; }
  59. CTransferTable* GetWaferCalibTable() { return m_pWaferTransferTable; }
  60. CTransferTable* GetWaffleCalibTable() { return m_pWaffleTransferTable; }
  61. CNozzleTable* GetNozzleTable() { return m_pNozzleTable; }
  62. //CForceControl* GetBHForce() { return m_pBondHeadForce; }
  63. //CForceControl* GetWaferForce() { return m_pWaferHeadForce; }
  64. CVerticalMeasure* GetVerticalMeasure() { return m_pVerMeasure; }
  65. CHorizMeasure* GetHorizMeasure() { return m_pHorizMeasure; }
  66. CWafflePackHead* GetWafflePackHead() { return m_pWaffleHead; }
  67. CWaferHead* GetWaferHead() { return m_pWaferHead; };
  68. CWaferTable* GetWaferTable() { return m_pWaferTable; }
  69. CEjector* GetEjector() { return m_pEjector; }
  70. CResources* GetResources() { return m_pResource; };
  71. //AxesMapPage* GetMotionAxesMapPage(){
  72. // return m_pMotion->getMapPage();
  73. //}
  74. JMotion* GetJMotion() {
  75. return m_pMotion;
  76. }
  77. CXYCalib* GetBondHeadHighCameraCalib() {
  78. switch (Machine::m_eHeadType)
  79. {
  80. case Machine::HeadType::UltralHead:
  81. return nullptr;
  82. case Machine::HeadType::EutecticHead:
  83. return m_pBondHead->GetHighCameraCalib();
  84. default:
  85. return nullptr;
  86. break;
  87. }
  88. }
  89. CXYCalib* GetBondHeadLowCameraCalib() { return m_pBondHead->GetLowCameraCalib(); }
  90. CXYCalib* GetLookUpCameraCalib() { return m_pBondHead->GetLookUpCameraCalib(); }
  91. CXYCalib* GetWaferCameraCalib() { return m_pWaferTable->GetWaferXYCalib(); }
  92. CXYCalib* GetWafflePackCameraCalib() { return m_pWaffleHead->GetCameraCalib(); }
  93. CCTDCalib* GetWafflePackCTDCalib() { return m_pWaffleHead->GetCTDCalib(); }
  94. CRCalib* GetBondHeadRCalib() { return m_pBondHead->GetHeadRCalib(); }
  95. bool GetInitSuccess() { return m_bIsInitSuccess; }
  96. HeadType GetHeadType() { return m_eHeadType; }
  97. void SetHeadType(HeadType type) { m_eHeadType = type; }
  98. LONG MoveToSafePosition() { return OK; };
  99. LONG load();
  100. LONG save();
  101. private:
  102. Machine();
  103. ~Machine();
  104. LONG CreateModules();
  105. void CreateMeasures();
  106. LONG InitModules();
  107. void AllocModule();//所有模组都创建完成后调用,将模组指针分配给其他模组
  108. void ReleaseAxisAndIo();
  109. LONG CreatAllAxis();
  110. LONG CreatAllIo();
  111. LONG CreatAllCoord();
  112. bool GetAxisByMotion(string name, CAxis * *pAxis);
  113. bool GetIoByMotion(IO_LIST name, CIO * *pIo);
  114. bool GetCoordByMotion(COORD_LIST type, CCoord * *pCoord);
  115. private:
  116. static Machine* m_instance;
  117. vector<CAxis*> m_vetAxis;
  118. vector<CIO*> m_vetIO;
  119. vector<CCoord*> m_vetCoord;
  120. vector<CModule*> m_vetModules;
  121. CBondHead* m_pBondHead = nullptr;
  122. //CEutecticHead* m_pEutecticHead = nullptr;
  123. //CUltraHead* m_pUltraHead = nullptr;
  124. CWafflePackHead* m_pWaffleHead = nullptr;
  125. CWaferTable* m_pWaferTable = nullptr;
  126. CWaferHead* m_pWaferHead = nullptr;
  127. CEjector* m_pEjector = nullptr;
  128. CTransferTable* m_pWaferTransferTable = nullptr;
  129. CTransferTable* m_pWaffleTransferTable = nullptr;
  130. CBondTable* m_pBondTable = nullptr;
  131. CNozzleTable* m_pNozzleTable = nullptr;
  132. CForceControl* m_pBondHeadForce = nullptr;
  133. CForceControl* m_pWaferHeadForce = nullptr;
  134. //仅用于测量
  135. CVerticalMeasure* m_pVerMeasure = nullptr;
  136. CHorizMeasure* m_pHorizMeasure = nullptr;
  137. //运控接口
  138. JMotion* m_pMotion = nullptr;
  139. //相机管理接口
  140. CCameraManage* m_pCameraManage = nullptr;
  141. CResources* m_pResource = nullptr;
  142. CManageDB* pCManageDB = nullptr;
  143. bool m_bIsInitSuccess = false;
  144. bool m_bMotionEnable = true; //运控卡禁止/启用
  145. HeadType m_eHeadType = HeadType::UltralHead;
  146. CHardware* m_pCHardware = nullptr;
  147. };