diff --git a/App/GrabBag/GrabBagApp/Presenter/Src/DetectPresenter.cpp b/App/GrabBag/GrabBagApp/Presenter/Src/DetectPresenter.cpp index f790340..40741cf 100644 --- a/App/GrabBag/GrabBagApp/Presenter/Src/DetectPresenter.cpp +++ b/App/GrabBag/GrabBagApp/Presenter/Src/DetectPresenter.cpp @@ -224,6 +224,7 @@ int DetectPresenter::DetectBag( // 1. 使用成员变量算法参数(已在初始化时从XML读取) LOG_INFO("[Algo Thread] Using algorithm parameters from XML configuration\n"); LOG_INFO(" Bag: L=%.1f, W=%.1f, H=%.1f\n",algoParam.bagParam.bagL, algoParam.bagParam.bagW, algoParam.bagParam.bagH); + LOG_INFO(" supportRotate=%d, outputMode=%d\n",algoParam.supportRotate, algoParam.outputMode); LOG_INFO(" Filter: continuityTh=%.1f, outlierTh=%.1f\n", algoParam.filterParam.continuityTh, algoParam.filterParam.outlierTh); LOG_INFO(" Corner: minEndingGap=%.1f, minEndingGap_z=%.1f, scale=%.1f, cornerTh=%.1f, jumpCornerTh_1=%.1f, jumpCornerTh_2=%.1f\n", diff --git a/App/GrabBag/GrabBagApp/Presenter/Src/GrabBagPresenter.cpp b/App/GrabBag/GrabBagApp/Presenter/Src/GrabBagPresenter.cpp index 97d7f41..5cdd072 100644 --- a/App/GrabBag/GrabBagApp/Presenter/Src/GrabBagPresenter.cpp +++ b/App/GrabBag/GrabBagApp/Presenter/Src/GrabBagPresenter.cpp @@ -894,6 +894,8 @@ int GrabBagPresenter::InitAlgorithmParams() LOG_INFO("projectType: %s\n", ProjectTypeToString(m_projectType).c_str()); LOG_INFO("Algorithm parameters initialized successfully via ParameterManager\n"); + _UpdateCurrentExecutionParams(); + return SUCCESS; } diff --git a/App/GrabBag/GrabBagApp/Version.h b/App/GrabBag/GrabBagApp/Version.h index b5f10ca..a81c2bb 100644 --- a/App/GrabBag/GrabBagApp/Version.h +++ b/App/GrabBag/GrabBagApp/Version.h @@ -2,7 +2,7 @@ #define VERSION_H #define GRABBAG_VERSION_STRING "1.3.6" -#define GRABBAG_BUILD_STRING "1" +#define GRABBAG_BUILD_STRING "2" #define GRABBAG_FULL_VERSION_STRING "V" GRABBAG_VERSION_STRING "_" GRABBAG_BUILD_STRING // 获取版本信息的便捷函数 diff --git a/App/GrabBag/GrabBagApp/Version.md b/App/GrabBag/GrabBagApp/Version.md index b4807a0..92e34f8 100644 --- a/App/GrabBag/GrabBagApp/Version.md +++ b/App/GrabBag/GrabBagApp/Version.md @@ -1,4 +1,7 @@ # 1.3.6 +## build_2 20260205 +1. 更新算法 + ## build_1 20260129 1. 增加授权判断 diff --git a/App/GrabBag/GrabBagConfig/Inc/IVrConfig.h b/App/GrabBag/GrabBagConfig/Inc/IVrConfig.h index e66be3d..6d1e3c9 100644 --- a/App/GrabBag/GrabBagConfig/Inc/IVrConfig.h +++ b/App/GrabBag/GrabBagConfig/Inc/IVrConfig.h @@ -301,7 +301,7 @@ struct VrAlgorithmParams VrHsvCmpParam hsvCmpParam; VrRgbColorPattern rgbColorPattern; VrColorTemplateParam colorTemplateParam; - int supportRotate = 1; + int supportRotate = 0; int outputMode = 0; // 输出模式:0 - 从大到小, 1 - 从小到大 }; diff --git a/App/WorkpieceHole/Doc/workpiecehole_plc.mthings b/App/WorkpieceHole/Doc/workpiecehole_plc.mthings index 37221e4..fb18595 100644 --- a/App/WorkpieceHole/Doc/workpiecehole_plc.mthings +++ b/App/WorkpieceHole/Doc/workpiecehole_plc.mthings @@ -19,32 +19,32 @@ - + - + - + - + - + - + diff --git a/AppAlgo/bagPosition/Arm/aarch64/libbagPositioning.so b/AppAlgo/bagPosition/Arm/aarch64/libbagPositioning.so index 43d29ff..633cf2a 100644 Binary files a/AppAlgo/bagPosition/Arm/aarch64/libbagPositioning.so and b/AppAlgo/bagPosition/Arm/aarch64/libbagPositioning.so differ diff --git a/AppAlgo/bagPosition/Arm/aarch64/libbaseAlgorithm.so b/AppAlgo/bagPosition/Arm/aarch64/libbaseAlgorithm.so index e799cda..ca3a532 100644 Binary files a/AppAlgo/bagPosition/Arm/aarch64/libbaseAlgorithm.so and b/AppAlgo/bagPosition/Arm/aarch64/libbaseAlgorithm.so differ diff --git a/AppAlgo/bagPosition/Inc/SG_baseDataType.h b/AppAlgo/bagPosition/Inc/SG_baseDataType.h index 24b6550..7eb207b 100644 --- a/AppAlgo/bagPosition/Inc/SG_baseDataType.h +++ b/AppAlgo/bagPosition/Inc/SG_baseDataType.h @@ -25,6 +25,20 @@ typedef struct double yawAngle; //ƫתǣZƫת, }SSG_6AxisAttitude; +typedef struct +{ + double x; + double y; + double z; +}SWD3DPoint; + +typedef struct +{ + int lineIdx; + int ptIdx; + SWD3DPoint point; +}SWDIndexing3DPoint; + typedef struct { bool validFlag; //ָʾǷЧ @@ -48,6 +62,17 @@ typedef struct int idx; }SSG_intPair; +typedef struct +{ + int featurType; + int featureIdx_v; + int featureIdx_h; + int clusterID; + int flag; + int lineIdx; + int ptIdx; +}SSG_featureClusteringInfo; + typedef struct { double left; @@ -56,6 +81,12 @@ typedef struct double bottom; }SSG_ROIRectD; +typedef struct +{ + SVzNL3DPoint center; + double radius; +}SWD_HoleInfo; + struct HSV { double h; // ɫ (0-360) double s; // Ͷ (0-1) @@ -157,6 +188,20 @@ typedef struct double jumpCornerTh_2; }SSG_cornerParam; +typedef struct +{ + double segGapTh_y; //yޡڴޣΪ + double segGapTh_z; //zޡڴޣΪ + double distScale; //㷽ǵĴڱ +}SSG_lineSegParam; + +typedef struct +{ + double minJumpZ; //z + double minK; //Сб + SVzNLRangeD widthRange; //zޡڴޣΪ +}SSG_raisedFeatureParam; + typedef struct { double scale_angle; //㷽ǵĴڱ @@ -184,6 +229,7 @@ typedef struct int endPtIdx; SVzNL3DPoint startPt; SVzNL3DPoint endPt; + double featureValue; }SWD_segFeature; typedef struct @@ -247,6 +293,18 @@ typedef struct int angleChkScalePos; //ڼangleCheckٶ }SSG_featureTree; +typedef struct +{ + int treeState; + int treeType; + int sLineIdx; + int eLineIdx; + double tree_value; + SSG_ROIRectD roi; + std::vector< SSG_basicFeatureGap> treeNodes; + int angleChkScalePos; //ڼangleCheckٶ +}SSG_gapFeatureTree; + typedef struct { int treeState; @@ -483,4 +541,35 @@ typedef struct { SVzNL3DPoint pt1; SVzNL3DPoint pt2; -}SWD_3DPointPair; \ No newline at end of file +}SWD_3DPointPair; + +typedef struct +{ + int pkId; + int lineIdx; + int ptIdx; + int cptIndex; //Բɨϵĵ + //double cornerAngle; //ԵΪĵҵļн + double R; + double angle; + double x; + double y; + double z; +}SWD_polarPt; + +typedef struct +{ + int cptIndex; + int L1_ptIndex; + int L2_ptIndex; + double cornerAngle; + int cornerDir; +}SWD_polarPeakInfo; + +typedef struct +{ + int clusterIdx; + int ptSize; + SVzNL3DRangeD roi3D; + SVzNLRect roi2D; +}SWD_clustersInfo; diff --git a/AppAlgo/bagPosition/Inc/SG_errCode.h b/AppAlgo/bagPosition/Inc/SG_errCode.h index 5deb68a..a664041 100644 --- a/AppAlgo/bagPosition/Inc/SG_errCode.h +++ b/AppAlgo/bagPosition/Inc/SG_errCode.h @@ -7,6 +7,7 @@ #define SG_ERR_LABEL_INFO_ERROR -1004 #define SG_ERR_INVLD_SORTING_MODE -1005 #define SG_ERR_INVLD_Q_SCALE -1006 +#define SG_ERR_ZERO_OBJECTS -1007 //BQ_workpiece #define SX_ERR_INVLD_VTREE_NUM -2001 @@ -16,6 +17,7 @@ #define SX_ERR_ZERO_CONTOUR_PT -2005 #define SX_ERR_INVLID_RPEAK_NUM -2006 #define SX_ERR_INVLID_RPEAK_PAIR -2007 +#define SX_ERR_INVLID_MARK_NUM -2008 //ץȡ #define SX_ERR_INVLID_CUTTING_Z -2101 @@ -23,3 +25,7 @@ // #define SX_BAG_TRAY_EMPTY -2201 + +//ü߶Ȳ +#define SX_ERR_INVALID_ARC -2301 + diff --git a/AppAlgo/bagPosition/Windows/x64/Debug/bagPositioning.dll b/AppAlgo/bagPosition/Windows/x64/Debug/bagPositioning.dll index 8099112..4c84be0 100644 Binary files a/AppAlgo/bagPosition/Windows/x64/Debug/bagPositioning.dll and b/AppAlgo/bagPosition/Windows/x64/Debug/bagPositioning.dll differ diff --git a/AppAlgo/bagPosition/Windows/x64/Debug/bagPositioning.lib b/AppAlgo/bagPosition/Windows/x64/Debug/bagPositioning.lib index 673202a..b57beb5 100644 Binary files a/AppAlgo/bagPosition/Windows/x64/Debug/bagPositioning.lib and b/AppAlgo/bagPosition/Windows/x64/Debug/bagPositioning.lib differ diff --git a/AppAlgo/bagPosition/Windows/x64/Debug/bagPositioning.pdb b/AppAlgo/bagPosition/Windows/x64/Debug/bagPositioning.pdb index a33abe6..09295b9 100644 Binary files a/AppAlgo/bagPosition/Windows/x64/Debug/bagPositioning.pdb and b/AppAlgo/bagPosition/Windows/x64/Debug/bagPositioning.pdb differ diff --git a/AppAlgo/bagPosition/Windows/x64/Debug/baseAlgorithm.dll b/AppAlgo/bagPosition/Windows/x64/Debug/baseAlgorithm.dll index 2921f8c..213a4b5 100644 Binary files a/AppAlgo/bagPosition/Windows/x64/Debug/baseAlgorithm.dll and b/AppAlgo/bagPosition/Windows/x64/Debug/baseAlgorithm.dll differ diff --git a/AppAlgo/bagPosition/Windows/x64/Debug/baseAlgorithm.lib b/AppAlgo/bagPosition/Windows/x64/Debug/baseAlgorithm.lib index a15a33c..0149c7d 100644 Binary files a/AppAlgo/bagPosition/Windows/x64/Debug/baseAlgorithm.lib and b/AppAlgo/bagPosition/Windows/x64/Debug/baseAlgorithm.lib differ diff --git a/AppAlgo/bagPosition/Windows/x64/Debug/baseAlgorithm.pdb b/AppAlgo/bagPosition/Windows/x64/Debug/baseAlgorithm.pdb index a3b4ef7..3a9ffc2 100644 Binary files a/AppAlgo/bagPosition/Windows/x64/Debug/baseAlgorithm.pdb and b/AppAlgo/bagPosition/Windows/x64/Debug/baseAlgorithm.pdb differ diff --git a/AppAlgo/bagPosition/Windows/x64/Release/bagPositioning.dll b/AppAlgo/bagPosition/Windows/x64/Release/bagPositioning.dll index 1c527d2..c010f3f 100644 Binary files a/AppAlgo/bagPosition/Windows/x64/Release/bagPositioning.dll and b/AppAlgo/bagPosition/Windows/x64/Release/bagPositioning.dll differ diff --git a/AppAlgo/bagPosition/Windows/x64/Release/bagPositioning.lib b/AppAlgo/bagPosition/Windows/x64/Release/bagPositioning.lib index c97e2c3..8889909 100644 Binary files a/AppAlgo/bagPosition/Windows/x64/Release/bagPositioning.lib and b/AppAlgo/bagPosition/Windows/x64/Release/bagPositioning.lib differ diff --git a/AppAlgo/bagPosition/Windows/x64/Release/bagPositioning.pdb b/AppAlgo/bagPosition/Windows/x64/Release/bagPositioning.pdb index c3fa0bc..a4f5665 100644 Binary files a/AppAlgo/bagPosition/Windows/x64/Release/bagPositioning.pdb and b/AppAlgo/bagPosition/Windows/x64/Release/bagPositioning.pdb differ diff --git a/AppAlgo/bagPosition/Windows/x64/Release/baseAlgorithm.dll b/AppAlgo/bagPosition/Windows/x64/Release/baseAlgorithm.dll index 5a97fec..a8239c7 100644 Binary files a/AppAlgo/bagPosition/Windows/x64/Release/baseAlgorithm.dll and b/AppAlgo/bagPosition/Windows/x64/Release/baseAlgorithm.dll differ diff --git a/AppAlgo/bagPosition/Windows/x64/Release/baseAlgorithm.lib b/AppAlgo/bagPosition/Windows/x64/Release/baseAlgorithm.lib index 7d4e5e7..2b5745a 100644 Binary files a/AppAlgo/bagPosition/Windows/x64/Release/baseAlgorithm.lib and b/AppAlgo/bagPosition/Windows/x64/Release/baseAlgorithm.lib differ diff --git a/AppAlgo/bagPosition/Windows/x64/Release/baseAlgorithm.pdb b/AppAlgo/bagPosition/Windows/x64/Release/baseAlgorithm.pdb index e66d2d8..34376ff 100644 Binary files a/AppAlgo/bagPosition/Windows/x64/Release/baseAlgorithm.pdb and b/AppAlgo/bagPosition/Windows/x64/Release/baseAlgorithm.pdb differ diff --git a/AppUtils/CloudUtils/Src/LaserDataLoader.cpp b/AppUtils/CloudUtils/Src/LaserDataLoader.cpp index bb1683e..1acd5f5 100644 --- a/AppUtils/CloudUtils/Src/LaserDataLoader.cpp +++ b/AppUtils/CloudUtils/Src/LaserDataLoader.cpp @@ -9,6 +9,14 @@ #include "VrLog.h" #include +// 辅助函数:去除字符串末尾的 \r 字符(处理 Windows 格式的 CR LF 换行符) +static inline void TrimCarriageReturn(std::string& str) +{ + if (!str.empty() && str.back() == '\r') { + str.pop_back(); + } +} + LaserDataLoader::LaserDataLoader() { m_lastError.clear(); @@ -57,12 +65,15 @@ int LaserDataLoader::LoadLaserScanData(const std::string& fileName, bool bFindLineNum = true; int nLaserPointIdx = 0; - + while (std::getline(inputFile, line)) { + // 去除行末的 \r 字符(处理 Windows 格式的 CR LF 换行符) + TrimCarriageReturn(line); + if (line.find("LineNum:") == 0) { sscanf(line.c_str(), "LineNum:%d", &lineNum); } else if (line.find("DataType:") == 0) { - + } else if (line.find("Line_") == 0) { if(false == bFindLineNum) { @@ -513,6 +524,9 @@ int LaserDataLoader::_GetLaserType(const std::string& fileName, EVzResultDataTyp bool bFind = false; while (std::getline(inputFile, linedata)) { + // 去除行末的 \r 字符(处理 Windows 格式的 CR LF 换行符) + TrimCarriageReturn(linedata); + if (linedata.find("{") == 0) { // 修复正则表达式以匹配实际数据格式 // XYZ格式: {x,y,z}-{leftX,leftY}-{rightX,rightY} diff --git a/Device/GlLineLaserDevice/Src/GlLineLaserDevice.cpp b/Device/GlLineLaserDevice/Src/GlLineLaserDevice.cpp index 4d6bc1c..7244c02 100644 --- a/Device/GlLineLaserDevice/Src/GlLineLaserDevice.cpp +++ b/Device/GlLineLaserDevice/Src/GlLineLaserDevice.cpp @@ -6,9 +6,6 @@ #include #include -// 静态成员初始化 -CGlLineLaserDevice* CGlLineLaserDevice::s_pInstance = nullptr; - CGlLineLaserDevice::CGlLineLaserDevice() : m_nDeviceId(0) , m_bDeviceOpen(false) @@ -65,7 +62,7 @@ int CGlLineLaserDevice::OpenDevice(const char* sIP, bool bRGBD, bool bSwing, boo memset(ðConfig, 0, sizeof(ethConfig)); if (sIP && strlen(sIP) > 0) { - LOG_ERROR("open IP address format: %s\n", sIP); + LOG_DEBUG("open IP address format: %s\n", sIP); // 解析IP字符串 "x.x.x.x" int ip[4]; if (sscanf(sIP, "%d.%d.%d.%d", &ip[0], &ip[1], &ip[2], &ip[3]) == 4) { @@ -197,24 +194,10 @@ int CGlLineLaserDevice::StartDetect(VzNL_AutoOutputLaserLineExCB fCallFunc, EVzR m_bStopDetect = false; m_ullFrameIndex = 0; - // 设置回调实例指针 - s_pInstance = this; - - // 设置批处理回调 - int ret = GLX8_2_SetBatchOneTimeDataHandler(m_nDeviceId, BatchDataCallback); - if (ret != 0) { - LOG_ERROR("GLX8_2_SetBatchOneTimeDataHandler failed: %d\n", ret); - return ERR_CODE(DEV_CTRL_ERR); - } - - // 开始批处理采集(立即开始) - ret = GLX8_2_StartMeasureWithCallback(m_nDeviceId, 0); - if (ret != 0) { - LOG_ERROR("GLX8_2_StartMeasureWithCallback failed: %d\n", ret); - return ERR_CODE(DEV_CTRL_ERR); - } - + // 启动数据采集线程(主动轮询模式) m_bDetecting = true; + m_detectThread = std::thread(&CGlLineLaserDevice::DetectThreadFunc, this); + LOG_DEBUG("Detection started\n"); return SUCCESS; @@ -239,8 +222,12 @@ int CGlLineLaserDevice::StopDetect() LOG_ERROR("GLX8_2_StopMeasure failed: %d\n", ret); } + // 等待线程结束 + if (m_detectThread.joinable()) { + m_detectThread.join(); + } + m_bDetecting = false; - s_pInstance = nullptr; // 通知状态变化 if (m_pStatusCallback) { @@ -253,48 +240,89 @@ int CGlLineLaserDevice::StopDetect() return SUCCESS; } -// 批处理数据回调(静态函数) -void CGlLineLaserDevice::BatchDataCallback(const GLX8_2_STR_CALLBACK_INFO* info, const GLX8_2_Data DataObj) +// 数据采集线程函数(主动轮询模式,参考 test_deal_atch_datas) +void CGlLineLaserDevice::DetectThreadFunc() { - if (s_pInstance) { - s_pInstance->ProcessBatchData(info, DataObj); + LOG_DEBUG("Detect thread started\n"); + + while (!m_bStopDetect) { + // 启动批处理(参考 test_deal_atch_datas) + int ret = GLX8_2_StartMeasure(m_nDeviceId, 5000); // 5秒超时 + if (ret != 0) { + LOG_ERROR("GLX8_2_StartMeasure failed: %d\n", ret); + std::this_thread::sleep_for(std::chrono::milliseconds(100)); + continue; + } + + // 等待一小段时间让设备准备好 + std::this_thread::sleep_for(std::chrono::milliseconds(50)); + + // 获取批处理数据(参考 test_batch_datas) + GetBatchData(); + + // 批处理完成后等待一段时间再开始下一次 + std::this_thread::sleep_for(std::chrono::milliseconds(100)); } + + LOG_DEBUG("Detect thread stopped\n"); } -// 处理批处理数据 -void CGlLineLaserDevice::ProcessBatchData(const GLX8_2_STR_CALLBACK_INFO* info, const GLX8_2_Data DataObj) +// 获取批处理数据(参考 test_batch_datas 的流程) +void CGlLineLaserDevice::GetBatchData() { - if (!m_pDetectCallback || m_bStopDetect) { - return; - } + GLX8_2_STR_CALLBACK_INFO info; + memset(&info, 0, sizeof(info)); - int width = info->xPoints; - int batchCount = info->BatchPoints; - LOG_DEBUG("BatchPoints: %d, xPoints: %d\n", batchCount, width); + const int maxBatchLines = m_nBatchLines; - // 获取整个批次的轮廓数据(连续内存,大小为 BatchPoints * xPoints) - int32_t* batchProfileData = GLX8_2_GetBatchProfilePoint(DataObj, 0); - if (!batchProfileData) { - LOG_WARNING("No profile data in batch\n"); - return; - } - - // 拷贝整个批次数据到本地缓存,避免回调期间数据被覆盖 - size_t totalPoints = static_cast(batchCount) * width; + // 确保缓存足够大 + size_t totalPoints = static_cast(m_nProfileWidth) * maxBatchLines; if (m_profileBuffer.size() < totalPoints) { m_profileBuffer.resize(totalPoints); } - memcpy(m_profileBuffer.data(), batchProfileData, totalPoints * sizeof(int32_t)); + if (m_intensityBuffer.size() < totalPoints) { + m_intensityBuffer.resize(totalPoints); + } + + std::vector encoderBuffer(maxBatchLines); + + // 使用 GLX8_2_ReceiveDataAuto 顺序获取批处理数据 + int ret = GLX8_2_ReceiveDataAuto(m_nDeviceId, &info, + m_profileBuffer.data(), + m_intensityBuffer.data(), + encoderBuffer.data()); + + if (ret != 0) { + LOG_WARNING("GLX8_2_ReceiveDataAuto failed: %d\n", ret); + return; + } + + int batchCount = info.BatchPoints; + int width = info.xPoints; + + if (batchCount <= 0 || width <= 0) { + LOG_WARNING("Invalid batch data: batchCount=%d, width=%d\n", batchCount, width); + return; + } + + LOG_DEBUG("Received batch: %d lines, width: %d, startEncoder: %d\n", + batchCount, width, info.startEncoder); // 确保位置缓存足够大 if (m_positionBuffer.size() < static_cast(width)) { m_positionBuffer.resize(width); } - // 逐行处理数据并回调 + // 逐行处理数据并回调(转换为xyz点云数据) for (int lineIdx = 0; lineIdx < batchCount; lineIdx++) { + if (m_bStopDetect) { + break; + } + // 计算当前行在缓存中的偏移 const int32_t* lineProfile = m_profileBuffer.data() + static_cast(lineIdx) * width; + + // 转换为xyz坐标 ConvertProfileToPosition(lineProfile, width, lineIdx); // 填充 SVzLaserLineData 结构 @@ -309,32 +337,33 @@ void CGlLineLaserDevice::ProcessBatchData(const GLX8_2_STR_CALLBACK_INFO* info, laserLineData.llFrameIdx = m_ullFrameIndex; laserLineData.llTimeStamp = std::chrono::duration_cast( std::chrono::steady_clock::now().time_since_epoch()).count(); - laserLineData.nEncodeNo = info->startEncoder + lineIdx; + laserLineData.nEncodeNo = encoderBuffer[lineIdx]; // 使用实际的编码器值 laserLineData.fSwingAngle = 0.0f; // 线激光没有摆动角度 laserLineData.bEndOnceScan = (lineIdx == batchCount - 1) ? VzTrue : VzFalse; - // 回调 - m_pDetectCallback(m_eDataType, &laserLineData, m_pDetectCallbackParam); + // 回调给上层应用 + if (m_pDetectCallback) { + m_pDetectCallback(m_eDataType, &laserLineData, m_pDetectCallbackParam); + } m_ullFrameIndex++; } - LOG_DEBUG("Processed %d lines, xPoints: %d\n", batchCount, width); - // 如果是最后一个批处理,通知完成 - if (info->returnStatus != 0) { - StopDetect(); - } + LOG_DEBUG("Processed %d lines, total frames: %llu\n", batchCount, m_ullFrameIndex); } // 将轮廓数据转换为位置数据 void CGlLineLaserDevice::ConvertProfileToPosition(const int32_t* profileData, int count, int lineIndex) { + // lineIndex 参数保留用于未来扩展,当前使用 m_ullFrameIndex 计算全局偏移 + (void)lineIndex; + // 确保缓存足够大 if (m_positionBuffer.size() < static_cast(count)) { m_positionBuffer.resize(count); } - // 计算Y偏移(基于行索引) + // 计算Y偏移(基于全局帧索引) double yOffset = static_cast(m_ullFrameIndex) * m_dYPitch; // 转换每个点 diff --git a/Device/GlLineLaserDevice/_Inc/GlLineLaserDevice.h b/Device/GlLineLaserDevice/_Inc/GlLineLaserDevice.h index b45993b..af287df 100644 --- a/Device/GlLineLaserDevice/_Inc/GlLineLaserDevice.h +++ b/Device/GlLineLaserDevice/_Inc/GlLineLaserDevice.h @@ -127,10 +127,15 @@ private: // 内部方法 /** - * @brief 数据采集线程函数 + * @brief 数据采集线程函数(主动轮询模式,参考 test_deal_atch_datas) */ void DetectThreadFunc(); + /** + * @brief 获取批处理数据(参考 test_batch_datas 的流程) + */ + void GetBatchData(); + /** * @brief 将 gl_linelaser_sdk 的轮廓数据转换为 SVzNL3DPosition * @param profileData 轮廓数据(int32_t,单位0.01um) @@ -139,19 +144,6 @@ private: * @return 转换后的位置数据数组 */ void ConvertProfileToPosition(const int32_t* profileData, int count, int lineIndex); - - /** - * @brief 批处理数据回调(静态函数) - */ - static void BatchDataCallback(const GLX8_2_STR_CALLBACK_INFO* info, const GLX8_2_Data DataObj); - - /** - * @brief 处理批处理数据 - */ - void ProcessBatchData(const GLX8_2_STR_CALLBACK_INFO* info, const GLX8_2_Data DataObj); - - // 用于回调的实例指针 - static CGlLineLaserDevice* s_pInstance; }; #endif // CGLLINELASERDEVICE_H