From fd1333fbf52e00ff8f0b0d51ec0d707a66cc9141 Mon Sep 17 00:00:00 2001
From: LAPTOP-SNT8I5JK\Boounion <Chenluhua@qq.com>
Date: 星期一, 16 六月 2025 11:20:16 +0800
Subject: [PATCH] 1.Robot状态和位置的监控,其中两个arm状态(是否有料),也作为调度的依据。

---
 SourceCode/Bond/Servo/CEFEM.cpp |   27 +++++++++++++++++++++++++++
 1 files changed, 27 insertions(+), 0 deletions(-)

diff --git a/SourceCode/Bond/Servo/CEFEM.cpp b/SourceCode/Bond/Servo/CEFEM.cpp
index c0cbf6d..3474d3e 100644
--- a/SourceCode/Bond/Servo/CEFEM.cpp
+++ b/SourceCode/Bond/Servo/CEFEM.cpp
@@ -331,6 +331,11 @@
 		return robotCmds(cmds, 2, onWritedBlock);
 	}
 
+	RMDATA& CEFEM::getRobotMonitoringData()
+	{
+		return m_robotData;
+	}
+
 	void CEFEM::init()
 	{
 		CEquipment::init();
@@ -692,6 +697,28 @@
 	{
 		__super::onReceiveLBData(pszData, size);
 
+		// 解释得到Robot状态
+		// 地址从(0x3500 - 0x3000)开始
+		int index = 0x500;
+		for (int i = 0; i < 6; i++) {
+			if (isBitOn(pszData, size, index + i)) {
+				m_robotData.status = (ROBOT_STATUS)i;
+				break;
+			}
+		}
+		index += 8;
+
+		for (int i = 0; i < 11; i++) {
+			if (isBitOn(pszData, size, index + i)) {
+				m_robotData.position = (ROBOT_POSITION)i;
+				break;
+			}
+		}
+		index += 16;
+		m_robotData.armState[0] = isBitOn(pszData, size, index);
+		m_robotData.armState[1] = isBitOn(pszData, size, index + 1);
+
+
 		for (unsigned int i = 0; i < 4; i++) {
 			if (m_pPort[i] != nullptr) {
 				m_pPort[i]->onReceiveLBData(pszData, size);

--
Gitblit v1.9.3