From 690bbf01bc579aff0ca31b2f326c7a6b5d83604d Mon Sep 17 00:00:00 2001
From: LAPTOP-SNT8I5JK\Boounion <Chenluhua@qq.com>
Date: 星期四, 05 六月 2025 10:51:13 +0800
Subject: [PATCH] 1.Slot的部分数据不需要存储,否则影响代码修改Slot布局等信息; 2.Bonder Porcess完成后,合成两片一起搬送的逻辑问题;
---
SourceCode/Bond/Servo/CMaster.cpp | 165 +++++++++++++++++++++++++++++++++++++++++++++----------
1 files changed, 135 insertions(+), 30 deletions(-)
diff --git a/SourceCode/Bond/Servo/CMaster.cpp b/SourceCode/Bond/Servo/CMaster.cpp
index 7a30bfa..41b9205 100644
--- a/SourceCode/Bond/Servo/CMaster.cpp
+++ b/SourceCode/Bond/Servo/CMaster.cpp
@@ -279,18 +279,31 @@
unsigned CMaster::DispatchProc()
{
+ // 优先考虑的类型和次要类型
+ // 一种情况,如果不分主次,一直搬G1, 等到Bonder1和Bonder2都放了G1, Aligner也放了G1,
+ // Bonder1和Bonder2需要的G2就过不来了
+ // 最基本的实现,可以G2和G2轮流搬送,但最好根据Bonder的需求来决定
+ MaterialsType primaryType, secondaryType;
+
+
// 各种机器
CLoadPort* pLoadPort1 = (CLoadPort*)getEquipment(EQ_ID_LOADPORT1);
CLoadPort* pLoadPort2 = (CLoadPort*)getEquipment(EQ_ID_LOADPORT2);
CFliper* pFliper = (CFliper*)getEquipment(EQ_ID_FLIPER);
CVacuumBake* pVacuumBack = (CVacuumBake*)getEquipment(EQ_ID_VACUUMBAKE);
CAligner* pAligner = (CAligner*)getEquipment(EQ_ID_ALIGNER);
+ CBonder* pBonder1 = (CBonder*)getEquipment(EQ_ID_Bonder1);
+ CBonder* pBonder2 = (CBonder*)getEquipment(EQ_ID_Bonder2);
+ CBakeCooling* pBakeCooling = (CBakeCooling*)getEquipment(EQ_ID_BAKE_COOLING);
ASSERT(pLoadPort1);
ASSERT(pLoadPort2);
ASSERT(pFliper);
ASSERT(pVacuumBack);
ASSERT(pAligner);
+ ASSERT(pBonder1);
+ ASSERT(pBonder2);
+ ASSERT(pBakeCooling);
while (1) {
// 待退出信号或时间到
@@ -333,49 +346,68 @@
continue;
}
- // LoadPort -> Fliper(G2)
- m_pActiveRobotTask = createTransferTask(pLoadPort1, pFliper);
+
+ // 此处检测优先类型和次要类型(G1或G2)
+ // 如果其中一Bonder有单个玻璃,优先取它的配对类型,否则无所谓了
+ primaryType = MaterialsType::G1;
+ secondaryType = MaterialsType::G2;
+ if ((!pBonder1->canPlaceGlassInSlot(0) && !pBonder1->canPlaceGlassInSlot(1))
+ && (!pBonder2->canPlaceGlassInSlot(0) && !pBonder2->canPlaceGlassInSlot(1))) {
+ // 如果G1和G2都满了,那就看Aligner, 如果Aligner有玻璃为G1, 则取G2
+ CGlass* pGlass = pAligner->getGlassFromSlot(1);
+ if (pGlass != nullptr && pGlass->getType() == MaterialsType::G1) {
+ primaryType = MaterialsType::G2;
+ secondaryType = MaterialsType::G1;
+ }
+ }
+ else if ((pBonder1->canPlaceGlassInSlot(0) && !pBonder1->canPlaceGlassInSlot(1))
+ || (pBonder2->canPlaceGlassInSlot(0) && !pBonder2->canPlaceGlassInSlot(1))) {
+ primaryType = MaterialsType::G2;
+ secondaryType = MaterialsType::G1;
+ }
+
+
+ // Bonder -> BakeCooling
+ m_pActiveRobotTask = createTransferTask_bonder_to_bakecooling(pBonder1, pBakeCooling, primaryType, secondaryType);
if (m_pActiveRobotTask != nullptr) {
std::string strDescription = m_pActiveRobotTask->getDescription();
unlock();
if (m_listener.onRobotTaskEvent != nullptr) {
- m_listener.onRobotTaskEvent(this, m_pActiveRobotTask, 0);
+ m_listener.onRobotTaskEvent(this, m_pActiveRobotTask, ROBOT_EVENT_CREATE);
}
LOGI("创建新任务<%s>...", strDescription.c_str());
continue;
}
- m_pActiveRobotTask = createTransferTask(pLoadPort2, pFliper);
+ m_pActiveRobotTask = createTransferTask_bonder_to_bakecooling(pBonder2, pBakeCooling, primaryType, secondaryType);
if (m_pActiveRobotTask != nullptr) {
std::string strDescription = m_pActiveRobotTask->getDescription();
unlock();
if (m_listener.onRobotTaskEvent != nullptr) {
- m_listener.onRobotTaskEvent(this, m_pActiveRobotTask, 0);
+ m_listener.onRobotTaskEvent(this, m_pActiveRobotTask, ROBOT_EVENT_CREATE);
}
LOGI("创建新任务<%s>...", strDescription.c_str());
continue;
}
-
-
- // LoadPort -> VacuumBake(G1)
- m_pActiveRobotTask = createTransferTask(pLoadPort1, pVacuumBack);
+ // Aligner -> Bonder
+ m_pActiveRobotTask = createTransferTask(pAligner, pBonder1, primaryType, secondaryType);
if (m_pActiveRobotTask != nullptr) {
std::string strDescription = m_pActiveRobotTask->getDescription();
unlock();
if (m_listener.onRobotTaskEvent != nullptr) {
- m_listener.onRobotTaskEvent(this, m_pActiveRobotTask, 0);
+ m_listener.onRobotTaskEvent(this, m_pActiveRobotTask, ROBOT_EVENT_CREATE);
}
LOGI("创建新任务<%s>...", strDescription.c_str());
continue;
}
- m_pActiveRobotTask = createTransferTask(pLoadPort2, pVacuumBack);
+ m_pActiveRobotTask = createTransferTask(pAligner, pBonder2, primaryType, secondaryType);
if (m_pActiveRobotTask != nullptr) {
std::string strDescription = m_pActiveRobotTask->getDescription();
unlock();
if (m_listener.onRobotTaskEvent != nullptr) {
- m_listener.onRobotTaskEvent(this, m_pActiveRobotTask, 0);
+ m_listener.onRobotTaskEvent(this, m_pActiveRobotTask, ROBOT_EVENT_CREATE);
}
LOGI("创建新任务<%s>...", strDescription.c_str());
continue;
@@ -384,23 +416,54 @@
// Fliper(G2) -> Aligner
// VacuumBake(G1) -> Aligner
- m_pActiveRobotTask = createTransferTask(pFliper, pAligner);
+ m_pActiveRobotTask = createTransferTask(pFliper, pAligner, primaryType, secondaryType);
if (m_pActiveRobotTask != nullptr) {
std::string strDescription = m_pActiveRobotTask->getDescription();
unlock();
if (m_listener.onRobotTaskEvent != nullptr) {
- m_listener.onRobotTaskEvent(this, m_pActiveRobotTask, 0);
+ m_listener.onRobotTaskEvent(this, m_pActiveRobotTask, ROBOT_EVENT_CREATE);
}
LOGI("创建新任务<%s>...", strDescription.c_str());
continue;
}
- m_pActiveRobotTask = createTransferTask(pVacuumBack, pAligner);
+ m_pActiveRobotTask = createTransferTask(pVacuumBack, pAligner, primaryType, secondaryType);
if (m_pActiveRobotTask != nullptr) {
std::string strDescription = m_pActiveRobotTask->getDescription();
unlock();
if (m_listener.onRobotTaskEvent != nullptr) {
- m_listener.onRobotTaskEvent(this, m_pActiveRobotTask, 0);
+ m_listener.onRobotTaskEvent(this, m_pActiveRobotTask, ROBOT_EVENT_CREATE);
+ }
+ LOGI("创建新任务<%s>...", strDescription.c_str());
+ continue;
+ }
+
+
+ // LoadPort -> Fliper(G2)
+ // LoadPort -> VacuumBake(G1)
+ CEquipment* pEqTar1 = pVacuumBack;
+ CEquipment* pEqTar2 = pFliper;
+ if (primaryType == MaterialsType::G2) {
+ pEqTar1 = pFliper;
+ pEqTar2 = pVacuumBack;
+ }
+ m_pActiveRobotTask = createTransferTask(pLoadPort1, pEqTar1, primaryType, secondaryType);
+ if (m_pActiveRobotTask != nullptr) {
+ std::string strDescription = m_pActiveRobotTask->getDescription();
+ unlock();
+ if (m_listener.onRobotTaskEvent != nullptr) {
+ m_listener.onRobotTaskEvent(this, m_pActiveRobotTask, ROBOT_EVENT_CREATE);
+ }
+ LOGI("创建新任务<%s>...", strDescription.c_str());
+ continue;
+ }
+
+ m_pActiveRobotTask = createTransferTask(pLoadPort2, pEqTar1, primaryType, secondaryType);
+ if (m_pActiveRobotTask != nullptr) {
+ std::string strDescription = m_pActiveRobotTask->getDescription();
+ unlock();
+ if (m_listener.onRobotTaskEvent != nullptr) {
+ m_listener.onRobotTaskEvent(this, m_pActiveRobotTask, ROBOT_EVENT_CREATE);
}
LOGI("创建新任务<%s>...", strDescription.c_str());
continue;
@@ -408,12 +471,28 @@
+ // LoadPort -> VacuumBake(G1)
+ m_pActiveRobotTask = createTransferTask(pLoadPort1, pEqTar2, primaryType, secondaryType);
+ if (m_pActiveRobotTask != nullptr) {
+ std::string strDescription = m_pActiveRobotTask->getDescription();
+ unlock();
+ if (m_listener.onRobotTaskEvent != nullptr) {
+ m_listener.onRobotTaskEvent(this, m_pActiveRobotTask, ROBOT_EVENT_CREATE);
+ }
+ LOGI("创建新任务<%s>...", strDescription.c_str());
+ continue;
+ }
-
- // Aligner -> Bonder
-
-
- // Bonder -> BakeCooling
+ m_pActiveRobotTask = createTransferTask(pLoadPort2, pEqTar2, primaryType, secondaryType);
+ if (m_pActiveRobotTask != nullptr) {
+ std::string strDescription = m_pActiveRobotTask->getDescription();
+ unlock();
+ if (m_listener.onRobotTaskEvent != nullptr) {
+ m_listener.onRobotTaskEvent(this, m_pActiveRobotTask, ROBOT_EVENT_CREATE);
+ }
+ LOGI("创建新任务<%s>...", strDescription.c_str());
+ continue;
+ }
// BakeCooling ->Measurement
@@ -589,12 +668,11 @@
lock();
+ if (m_listener.onRobotTaskEvent != nullptr) {
+ m_listener.onRobotTaskEvent(this, m_pActiveRobotTask, ROBOT_EVENT_FINISH);
+ }
delete m_pActiveRobotTask;
m_pActiveRobotTask = nullptr;
-
- if (m_listener.onRobotTaskEvent != nullptr) {
- m_listener.onRobotTaskEvent(this, m_pActiveRobotTask, 0);
- }
}
unlock();
}
@@ -1010,15 +1088,42 @@
}
static int taskSeqNo = 0;
- CRobotTask* CMaster::createTransferTask(CEquipment* pSrcEq, CEquipment* pTarEq)
+ CRobotTask* CMaster::createTransferTask(CEquipment* pSrcEq, CEquipment* pTarEq,
+ MaterialsType primaryType/* = MaterialsType::G1*/, MaterialsType secondaryType/* = MaterialsType::G2*/)
{
CRobotTask* pTask = nullptr;
CSlot* pSrcSlot, * pTarSlot;
- pTarSlot = pTarEq->getAvailableSlotForGlass(MaterialsType::G1);
- pSrcSlot = pSrcEq->getNonEmptySlot(MaterialsType::G1);
+ pTarSlot = pTarEq->getAvailableSlotForGlass(primaryType);
+ pSrcSlot = pSrcEq->getProcessedSlot(primaryType);
if (pSrcSlot == nullptr || nullptr == pTarSlot) {
- pTarSlot = pTarEq->getAvailableSlotForGlass(MaterialsType::G2);
- pSrcSlot = pSrcEq->getNonEmptySlot(MaterialsType::G2);
+ pTarSlot = pTarEq->getAvailableSlotForGlass(secondaryType);
+ pSrcSlot = pSrcEq->getProcessedSlot(secondaryType);
+ }
+
+
+ if (pSrcSlot != nullptr && nullptr != pTarSlot) {
+ pTask = new CRobotTask();
+ pTask->setContext(pSrcSlot->getContext());
+ pTask->setRobotTransferParam(++taskSeqNo, 1, pSrcSlot->getPosition(),
+ pTarSlot->getPosition(), pSrcSlot->getNo(), pTarSlot->getNo());
+ }
+
+
+ return pTask;
+ }
+
+ CRobotTask* CMaster::createTransferTask_bonder_to_bakecooling(CEquipment* pSrcEq, CEquipment* pTarEq,
+ MaterialsType primaryType/* = MaterialsType::G1*/, MaterialsType secondaryType/* = MaterialsType::G2*/)
+ {
+ std::vector<int> slots = {1, 2};
+
+ CRobotTask* pTask = nullptr;
+ CSlot* pSrcSlot, * pTarSlot;
+ pTarSlot = pTarEq->getAvailableSlotForGlass2(primaryType, slots);
+ pSrcSlot = pSrcEq->getProcessedSlot(primaryType);
+ if (pSrcSlot == nullptr || nullptr == pTarSlot) {
+ pTarSlot = pTarEq->getAvailableSlotForGlass(secondaryType);
+ pSrcSlot = pSrcEq->getProcessedSlot(secondaryType);
}
--
Gitblit v1.9.3