Machine.h 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  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. CResources* GetResources() { return m_pResource; };
  70. //AxesMapPage* GetMotionAxesMapPage(){
  71. // return m_pMotion->getMapPage();
  72. //}
  73. JMotion* GetJMotion() {
  74. return m_pMotion;
  75. }
  76. CXYCalib* GetBondHeadHighCameraCalib() {
  77. switch (Machine::m_eHeadType)
  78. {
  79. case Machine::HeadType::UltralHead:
  80. return nullptr;
  81. case Machine::HeadType::EutecticHead:
  82. return m_pBondHead->GetHighCameraCalib();
  83. default:
  84. return nullptr;
  85. break;
  86. }
  87. }
  88. CXYCalib* GetBondHeadLowCameraCalib() { return m_pBondHead->GetLowCameraCalib(); }
  89. CXYCalib* GetLookUpCameraCalib() { return m_pBondHead->GetLookUpCameraCalib(); }
  90. CXYCalib* GetWaferCameraCalib() { return m_pWaferTable->GetWaferXYCalib(); }
  91. CXYCalib* GetWafflePackCameraCalib() { return m_pWaffleHead->GetCameraCalib(); }
  92. CCTDCalib* GetWafflePackCTDCalib() { return m_pWaffleHead->GetCTDCalib(); }
  93. CRCalib* GetBondHeadRCalib() { return m_pBondHead->GetHeadRCalib(); }
  94. bool GetInitSuccess() { return m_bIsInitSuccess; }
  95. HeadType GetHeadType() { return m_eHeadType; }
  96. void SetHeadType(HeadType type) { m_eHeadType = type; }
  97. LONG MoveToSafePosition() { return OK; };
  98. LONG load();
  99. LONG save();
  100. private:
  101. Machine();
  102. ~Machine();
  103. LONG CreateModules();
  104. void CreateMeasures();
  105. LONG InitModules();
  106. void AllocModule();//所有模组都创建完成后调用,将模组指针分配给其他模组
  107. void ReleaseAxisAndIo();
  108. LONG CreatAllAxis();
  109. LONG CreatAllIo();
  110. LONG CreatAllCoord();
  111. bool GetAxisByMotion(string name, CAxis * *pAxis);
  112. bool GetIoByMotion(IO_LIST name, CIO * *pIo);
  113. bool GetCoordByMotion(COORD_LIST type, CCoord * *pCoord);
  114. private:
  115. static Machine* m_instance;
  116. vector<CAxis*> m_vetAxis;
  117. vector<CIO*> m_vetIO;
  118. vector<CCoord*> m_vetCoord;
  119. vector<CModule*> m_vetModules;
  120. CBondHead* m_pBondHead = nullptr;
  121. //CEutecticHead* m_pEutecticHead = nullptr;
  122. //CUltraHead* m_pUltraHead = nullptr;
  123. CWafflePackHead* m_pWaffleHead = nullptr;
  124. CWaferTable* m_pWaferTable = nullptr;
  125. CWaferHead* m_pWaferHead = nullptr;
  126. CEjector* m_pEjector = nullptr;
  127. CTransferTable* m_pWaferTransferTable = nullptr;
  128. CTransferTable* m_pWaffleTransferTable = nullptr;
  129. CBondTable* m_pBondTable = nullptr;
  130. CNozzleTable* m_pNozzleTable = nullptr;
  131. CForceControl* m_pBondHeadForce = nullptr;
  132. CForceControl* m_pWaferHeadForce = nullptr;
  133. //仅用于测量
  134. CVerticalMeasure* m_pVerMeasure = nullptr;
  135. CHorizMeasure* m_pHorizMeasure = nullptr;
  136. //运控接口
  137. JMotion* m_pMotion = nullptr;
  138. //相机管理接口
  139. CCameraManage* m_pCameraManage = nullptr;
  140. CResources* m_pResource = nullptr;
  141. CManageDB* pCManageDB = nullptr;
  142. bool m_bIsInitSuccess = false;
  143. bool m_bMotionEnable = true; //运控卡禁止/启用
  144. HeadType m_eHeadType = HeadType::UltralHead;
  145. CHardware* m_pCHardware = nullptr;
  146. };