Machine.h 5.6 KB

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