From 2c7d546ddcd43669a433a99e1901339e491542d9 Mon Sep 17 00:00:00 2001
From: mrDarker <mr.darker@163.com>
Date: 星期四, 24 七月 2025 16:38:27 +0800
Subject: [PATCH] Merge branch 'clh' into liuyang
---
SourceCode/Bond/Servo/CMaster.cpp | 88 +++++++++++++++++++++++++++++++++++--------
1 files changed, 71 insertions(+), 17 deletions(-)
diff --git a/SourceCode/Bond/Servo/CMaster.cpp b/SourceCode/Bond/Servo/CMaster.cpp
index 6c9a004..5b6d6e9 100644
--- a/SourceCode/Bond/Servo/CMaster.cpp
+++ b/SourceCode/Bond/Servo/CMaster.cpp
@@ -660,8 +660,10 @@
// Fliper(G2) -> Bonder
// VacuumBake(G1) -> Bonder
+ SERVO::CRobotTask* tempTask[2] = {nullptr, nullptr};
if (!rmd.armState[1] && !pBonder1->hasBondClass()) {
- m_pActiveRobotTask = createTransferTask(pFliper, pBonder1, primaryType, secondaryType, 2);
+ tempTask[0] = createTransferTask(pFliper, pBonder1, primaryType, secondaryType, 2);
+ /*
if (m_pActiveRobotTask != nullptr) {
m_pActiveRobotTask->pick();
std::string strDescription = m_pActiveRobotTask->getDescription();
@@ -672,24 +674,12 @@
LOGI("创建新任务<%s>...", strDescription.c_str());
continue;
}
- }
-
- if (!rmd.armState[1] && !pBonder2->hasBondClass()) {
- m_pActiveRobotTask = createTransferTask(pFliper, pBonder2, primaryType, secondaryType, 2);
- if (m_pActiveRobotTask != nullptr) {
- m_pActiveRobotTask->pick();
- 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;
- }
+ */
}
if (!rmd.armState[0] && !pBonder1->hasBondClass()) {
- m_pActiveRobotTask = createTransferTask(pVacuumBake, pBonder1, primaryType, secondaryType);
+ tempTask[1] = createTransferTask(pVacuumBake, pBonder1, primaryType, secondaryType);
+ /*
if (m_pActiveRobotTask != nullptr) {
m_pActiveRobotTask->pick();
std::string strDescription = m_pActiveRobotTask->getDescription();
@@ -700,10 +690,51 @@
LOGI("创建新任务<%s>...", strDescription.c_str());
continue;
}
+ */
+ }
+
+ if (tempTask[1] != nullptr && pBonder1->hasG2Class()) {
+ m_pActiveRobotTask = tempTask[1];
+ if(tempTask[0] != nullptr) delete tempTask[0];
+ }
+ else if (tempTask[0] != nullptr && tempTask[1] != nullptr) {
+ m_pActiveRobotTask = tempTask[0];
+ delete tempTask[1];
+ }
+ if (m_pActiveRobotTask != nullptr) {
+ m_pActiveRobotTask->pick();
+ 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;
+ }
+
+ if (tempTask[0] != nullptr) delete tempTask[0];
+ if (tempTask[1] != nullptr) delete tempTask[1];
+ tempTask[0] = nullptr;
+ tempTask[1] = nullptr;
+ if (!rmd.armState[1] && !pBonder2->hasBondClass()) {
+ tempTask[0] = createTransferTask(pFliper, pBonder2, primaryType, secondaryType, 2);
+ /*
+ if (m_pActiveRobotTask != nullptr) {
+ m_pActiveRobotTask->pick();
+ 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;
+ }
+ */
}
if (!rmd.armState[0] && !pBonder2->hasBondClass()) {
- m_pActiveRobotTask = createTransferTask(pVacuumBake, pBonder2, primaryType, secondaryType);
+ tempTask[1] = createTransferTask(pVacuumBake, pBonder2, primaryType, secondaryType);
+ /*
if (m_pActiveRobotTask != nullptr) {
m_pActiveRobotTask->pick();
std::string strDescription = m_pActiveRobotTask->getDescription();
@@ -714,8 +745,31 @@
LOGI("创建新任务<%s>...", strDescription.c_str());
continue;
}
+ */
}
+ if (tempTask[1] != nullptr && pBonder1->hasG2Class()) {
+ m_pActiveRobotTask = tempTask[1];
+ if (tempTask[0] != nullptr) delete tempTask[0];
+ }
+ else if (tempTask[0] != nullptr && tempTask[1] != nullptr) {
+ m_pActiveRobotTask = tempTask[0];
+ delete tempTask[1];
+ }
+ if (m_pActiveRobotTask != nullptr) {
+ m_pActiveRobotTask->pick();
+ 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;
+ }
+ if (tempTask[0] != nullptr) delete tempTask[0];
+ if (tempTask[1] != nullptr) delete tempTask[1];
+ tempTask[0] = nullptr;
+ tempTask[1] = nullptr;
// Aligner -> Fliper(G2)
// Aligner -> VacuumBake(G1)
--
Gitblit v1.9.3