diff --git a/App/App.pro b/App/App.pro index 12ea98b1..d6a99e4f 100644 --- a/App/App.pro +++ b/App/App.pro @@ -1,23 +1,23 @@ TEMPLATE = subdirs # 拆包项目 -# SUBDIRS += ./GrabBag/GrabBag.pro +SUBDIRS += ./GrabBag/GrabBag.pro # 撕裂项目 -# SUBDIRS += ./BeltTearing/BeltTearing.pro +SUBDIRS += ./BeltTearing/BeltTearing.pro #焊接 -# SUBDIRS += ./LapWeld/LapWeld.pro +SUBDIRS += ./LapWeld/LapWeld.pro #工件定ä½� -# SUBDIRS += ./Workpiece/Workpiece.pro +SUBDIRS += ./Workpiece/Workpiece.pro # 颗粒尺寸检测 -# SUBDIRS += ./ParticleSize/ParticleSize.pro +SUBDIRS += ./ParticleSize/ParticleSize.pro -# å�Œç›®æ ‡è®°æ£€æµ‹ +# å�Œç›®Mark检测 SUBDIRS += ./BinocularMark/BinocularMark.pro # 工件项目(WorkpiecePositionå’ŒWorkpieceSplice) -# SUBDIRS += ./WorkpieceProject/WorkpieceProject.pro +SUBDIRS += ./WorkpieceProject/WorkpieceProject.pro diff --git a/App/GrabBag/GrabBagApp/Presenter/Src/DetectPresenter.cpp b/App/GrabBag/GrabBagApp/Presenter/Src/DetectPresenter.cpp index 811bf91e..6e6fe71a 100644 --- a/App/GrabBag/GrabBagApp/Presenter/Src/DetectPresenter.cpp +++ b/App/GrabBag/GrabBagApp/Presenter/Src/DetectPresenter.cpp @@ -3,6 +3,7 @@ DetectPresenter::DetectPresenter(/* args */) { + LOG_INFO("algo version : %s\n", sg_bagPositioningVersion()); } DetectPresenter::~DetectPresenter() diff --git a/App/GrabBag/GrabBagApp/Presenter/Src/GrabBagPresenter.cpp b/App/GrabBag/GrabBagApp/Presenter/Src/GrabBagPresenter.cpp index 1b0f862c..9b775e0b 100644 --- a/App/GrabBag/GrabBagApp/Presenter/Src/GrabBagPresenter.cpp +++ b/App/GrabBag/GrabBagApp/Presenter/Src/GrabBagPresenter.cpp @@ -1379,6 +1379,9 @@ int GrabBagPresenter::_DetectTask() // 支æŒ�旋转 detectionAlgoParam.supportRotate = xmlParams.supportRotate; + // 输出模å¼� + detectionAlgoParam.outputMode = xmlParams.outputMode; + // 使用 m_currentExecutionParams 中的包裹å�‚æ•° detectionAlgoParam.bagParam.bagL = m_currentExecutionParams.bagParam.bagL; detectionAlgoParam.bagParam.bagW = m_currentExecutionParams.bagParam.bagW; @@ -1398,6 +1401,8 @@ int GrabBagPresenter::_DetectTask() CVrTimeUtils oTimeUtils; DetectionResult detectionResult; LOG_INFO("[Algo Thread] About to call DetectBag with %zu lines\n", m_detectionDataCache.size()); + LOG_INFO("[Algo Thread] Algorithm params: supportRotate=%d, outputMode=%d (0-从大到å°�, 1-从å°�到大)\n", + detectionAlgoParam.supportRotate, detectionAlgoParam.outputMode); // 检查DetectPresenter是å�¦æœ‰æ•ˆ if (!m_pDetectPresenter) { diff --git a/App/GrabBag/GrabBagApp/Presenter/Src/ParameterManager.cpp b/App/GrabBag/GrabBagApp/Presenter/Src/ParameterManager.cpp index 6ce21b1d..a7e3b066 100644 --- a/App/GrabBag/GrabBagApp/Presenter/Src/ParameterManager.cpp +++ b/App/GrabBag/GrabBagApp/Presenter/Src/ParameterManager.cpp @@ -147,6 +147,9 @@ int ParameterManager::LoadGlobalParams(const ConfigResult* pConfigResult, // 设置支æŒ�旋转å�‚æ•° m_globalAlgoParam.supportRotate = xmlParams.supportRotate; + // 设置输出模å¼�å�‚æ•° + m_globalAlgoParam.outputMode = xmlParams.outputMode; + // 3. 设置颜色å�‚æ•° m_hsvCmpParam.hueTh = xmlParams.hsvCmpParam.hueTh; m_hsvCmpParam.saturateTh = xmlParams.hsvCmpParam.saturateTh; @@ -169,6 +172,8 @@ int ParameterManager::LoadGlobalParams(const ConfigResult* pConfigResult, LOG_INFO("[ParameterManager] Global parameters loaded successfully\n"); LOG_INFO("[ParameterManager] Bag: L=%.1f, W=%.1f, H=%.1f\n", m_globalAlgoParam.bagParam.bagL, m_globalAlgoParam.bagParam.bagW, m_globalAlgoParam.bagParam.bagH); + LOG_INFO("[ParameterManager] supportRotate=%d, outputMode=%d (0-从大到å°�, 1-从å°�到大)\n", + m_globalAlgoParam.supportRotate, m_globalAlgoParam.outputMode); return 0; } diff --git a/App/GrabBag/GrabBagApp/Version.h b/App/GrabBag/GrabBagApp/Version.h index 338895f0..c564ffc1 100644 --- a/App/GrabBag/GrabBagApp/Version.h +++ b/App/GrabBag/GrabBagApp/Version.h @@ -2,9 +2,9 @@ #define VERSION_H -#define GRABBAG_VERSION_STRING "1.3.2" -#define GRABBAG_BUILD_STRING "2" -#define GRABBAG_FULL_VERSION_STRING "V1.3.2_2" +#define GRABBAG_VERSION_STRING "1.3.3" +#define GRABBAG_BUILD_STRING "0" +#define GRABBAG_FULL_VERSION_STRING "V1.3.3_0" // 获å�–版本信æ�¯çš„便æ�·å‡½æ•° inline const char* GetGrabBagVersion() { diff --git a/App/GrabBag/GrabBagApp/Version.md b/App/GrabBag/GrabBagApp/Version.md index 93cd81dc..f88dcc15 100644 --- a/App/GrabBag/GrabBagApp/Version.md +++ b/App/GrabBag/GrabBagApp/Version.md @@ -1,3 +1,8 @@ +#1.3.3 +## build_0 2025-12-10 +1. 更新算法,增加outputModeå�‚æ•° + + #1.3.2 ## build_2 2025-11-23 1. config 修改默认数æ�® diff --git a/App/GrabBag/GrabBagConfig/Inc/IVrConfig.h b/App/GrabBag/GrabBagConfig/Inc/IVrConfig.h index 22948bbc..c8ca56d5 100644 --- a/App/GrabBag/GrabBagConfig/Inc/IVrConfig.h +++ b/App/GrabBag/GrabBagConfig/Inc/IVrConfig.h @@ -284,6 +284,7 @@ struct VrAlgorithmParams VrRgbColorPattern rgbColorPattern; VrColorTemplateParam colorTemplateParam; int supportRotate = 1; + int outputMode = 0; // 输出模å¼�:0 - 从大到å°�, 1 - 从å°�到大 }; /** diff --git a/App/GrabBag/GrabBagConfig/Src/VrConfig.cpp b/App/GrabBag/GrabBagConfig/Src/VrConfig.cpp index 2281344d..d242d377 100644 --- a/App/GrabBag/GrabBagConfig/Src/VrConfig.cpp +++ b/App/GrabBag/GrabBagConfig/Src/VrConfig.cpp @@ -186,7 +186,20 @@ ConfigResult CVrConfig::LoadConfig(const std::string& filePath) // 默认值为0,表示ä¸�支æŒ�旋转 result.algorithmParams.supportRotate = 0; } - + + // è§£æž�输出模å¼�å�‚æ•° + XMLElement* outputModeElement = algoParamsElement->FirstChildElement("OutputMode"); + if (outputModeElement) + { + if (outputModeElement->Attribute("mode")) + result.algorithmParams.outputMode = outputModeElement->IntAttribute("mode"); + } + else + { + // 默认值为0,表示从大到å°� + result.algorithmParams.outputMode = 0; + } + // è§£æž�HSV颜色比较å�‚æ•° XMLElement* hsvCmpParamElement = algoParamsElement->FirstChildElement("HsvCmpParam"); if (hsvCmpParamElement) @@ -555,7 +568,12 @@ bool CVrConfig::SaveConfig(const std::string& filePath, ConfigResult& configResu XMLElement* supportRotateElement = doc.NewElement("SupportRotate"); supportRotateElement->SetAttribute("enabled", configResult.algorithmParams.supportRotate); algoParamsElement->InsertEndChild(supportRotateElement); - + + // 添加输出模å¼�å�‚æ•° + XMLElement* outputModeElement = doc.NewElement("OutputMode"); + outputModeElement->SetAttribute("mode", configResult.algorithmParams.outputMode); + algoParamsElement->InsertEndChild(outputModeElement); + // 添加多相机平é�¢æ ¡å‡†å�‚æ•° XMLElement* planeCalibParamsElement = doc.NewElement("PlaneCalibParams"); diff --git a/App/GrabBag/GrabBagConfig/config/config.xml b/App/GrabBag/GrabBagConfig/config/config.xml index 44c8441c..832567ee 100644 --- a/App/GrabBag/GrabBagConfig/config/config.xml +++ b/App/GrabBag/GrabBagConfig/config/config.xml @@ -213,7 +213,10 @@ - + + + + diff --git a/SDK/bagPosition/Inc/SG_algo_Export.h b/SDK/bagPosition/Inc/SG_algo_Export.h new file mode 100644 index 00000000..f53e18ea --- /dev/null +++ b/SDK/bagPosition/Inc/SG_algo_Export.h @@ -0,0 +1,22 @@ +#pragma once + +#if defined(_MSC_VER) || defined(WIN64) || defined(_WIN64) || defined(__WIN64__) || defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__) +# define Q_DECL_EXPORT __declspec(dllexport) +# define Q_DECL_IMPORT __declspec(dllimport) +#else +# define Q_DECL_EXPORT __attribute__((visibility("default"))) +# define Q_DECL_IMPORT __attribute__((visibility("default"))) +#endif + +#if defined(SG_API_LIBRARY) +# define SG_APISHARED_EXPORT Q_DECL_EXPORT +#else +# define SG_APISHARED_EXPORT Q_DECL_IMPORT +#endif + +#include "SG_baseDataType.h" + + +#ifndef M_PI +#define M_PI 3.14159265358979323846 // pi +#endif // !M_PI diff --git a/SDK/bagPosition/Inc/SG_bagPositioning_Export.h b/SDK/bagPosition/Inc/SG_bagPositioning_Export.h index 05a5ee7b..3ca4aa4b 100644 --- a/SDK/bagPosition/Inc/SG_bagPositioning_Export.h +++ b/SDK/bagPosition/Inc/SG_bagPositioning_Export.h @@ -1,24 +1,10 @@ #pragma once -#if defined(_MSC_VER) || defined(WIN64) || defined(_WIN64) || defined(__WIN64__) || defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__) -# define Q_DECL_EXPORT __declspec(dllexport) -# define Q_DECL_IMPORT __declspec(dllimport) -#else -# define Q_DECL_EXPORT __attribute__((visibility("default"))) -# define Q_DECL_IMPORT __attribute__((visibility("default"))) -#endif - -#if defined(SG_API_LIBRARY) -# define SG_BAGSHARED_EXPORT Q_DECL_EXPORT -#else -# define SG_BAGSHARED_EXPORT Q_DECL_IMPORT -#endif - #define OUTPUT_DEBUG 0 #define BAG_ALGO_USE_CORNER_FEATURE 1 #define RGN_HIST_SIZE 16 //Ä¿±êÑÕɫͳ¼ÆµÄÊýÄ¿ -#include "SG_baseDataType.h" +#include "SG_algo_Export.h" #include typedef struct @@ -35,6 +21,7 @@ typedef struct //SSG_objSortParam sortParam; //SSG_polarScanParam polarScanParam; int supportRotate; + int outputMode; //0 - °´ÐòÊä³ö£¬ 1 - ´Ó´óµ½Ð¡Êä³ö }SG_bagPositionParam; typedef struct @@ -54,18 +41,21 @@ typedef struct double baseHoleDist; //ÍÐÅÌÁ½¸ö¿×¶´µÄ¾àÀë }SSG_stackBaseParam; +//¶Á°æ±¾ºÅ +SG_APISHARED_EXPORT const char* sg_bagPositioningVersion(void); + //Êý¾Ýµ÷ƽ -SG_BAGSHARED_EXPORT void sg_lineDataR( +SG_APISHARED_EXPORT void sg_lineDataR( SVzNL3DLaserLine* a_line, const double* camPoseR, double groundH); -SG_BAGSHARED_EXPORT void sg_lineDataR_RGBD( +SG_APISHARED_EXPORT void sg_lineDataR_RGBD( SVzNLXYZRGBDLaserLine* a_line, const double* camPoseR, double groundH); -SG_BAGSHARED_EXPORT void sg_bagPositioning_lineProc( +SG_APISHARED_EXPORT void sg_bagPositioning_lineProc( SVzNL3DLaserLine* a_line, int lineIdx, int* errCode, @@ -74,7 +64,7 @@ SG_BAGSHARED_EXPORT void sg_bagPositioning_lineProc( const SG_bagPositionParam algoParam); //»ñÈ¡±àÖ¯´üÖÐÐÄץȡµã×Ë̬£¬´Ó¶¥²¿×¥È¡ -SG_BAGSHARED_EXPORT void sg_getBagPosition( +SG_APISHARED_EXPORT void sg_getBagPosition( SVzNL3DLaserLine* laser3DPoints, int lineNum, //std::vector& all_vLineFeatures, @@ -83,7 +73,7 @@ SG_BAGSHARED_EXPORT void sg_getBagPosition( const SSG_planeCalibPara poseCalibPara, std::vector& objOps); -SG_BAGSHARED_EXPORT void sg_getBagPositionAndOrientation( +SG_APISHARED_EXPORT void sg_getBagPositionAndOrientation( SVzNLXYZRGBDLaserLine* laser3DPoints, int lineNum, //std::vector& all_vLineFeatures, @@ -100,13 +90,13 @@ SG_BAGSHARED_EXPORT void sg_getBagPositionAndOrientation( #endif int* errCode); -SG_BAGSHARED_EXPORT void sg_sideBagPosition( +SG_APISHARED_EXPORT void sg_sideBagPosition( SVzNL3DLaserLine* laser3DPoints, int lineNum, const SG_bagPositionParam algoParam, std::vector& objOps); -SG_BAGSHARED_EXPORT void sg_getSideBagStackBasePosition( +SG_APISHARED_EXPORT void sg_getSideBagStackBasePosition( SVzNL3DLaserLine* laser3DPoints, int lineNum, const SSG_stackBaseParam stackBaseParam, @@ -117,6 +107,6 @@ SG_BAGSHARED_EXPORT void sg_getSideBagStackBasePosition( //¼ÆËãÒ»¸öÆ½Ãæµ÷ƽ²ÎÊý¡£ //Êý¾ÝÊäÈëÖпÉÒÔÓÐÒ»¸öµØÆ½ÃæºÍ²Î¿¼µ÷Æ½Æ½Ãæ£¬ÒÔ×î¸ßµÄÆ½Ãæ½øÐе÷ƽ //Ðýת¾ØÕóΪµ÷ƽ²ÎÊý£¬¼´½«Æ½Ãæ·¨Ïòµ÷ÕûΪ´¹Ö±ÏòÁ¿µÄ²ÎÊý -SG_BAGSHARED_EXPORT SSG_planeCalibPara sg_getBagBaseCalibPara( +SG_APISHARED_EXPORT SSG_planeCalibPara sg_getBagBaseCalibPara( SVzNL3DLaserLine* laser3DPoints, int lineNum); \ No newline at end of file diff --git a/SDK/bagPosition/Inc/SG_baseDataType.h b/SDK/bagPosition/Inc/SG_baseDataType.h index fcd55f2b..d2d3a3e6 100644 --- a/SDK/bagPosition/Inc/SG_baseDataType.h +++ b/SDK/bagPosition/Inc/SG_baseDataType.h @@ -4,7 +4,7 @@ #include #include -#define PI 3.141592654 +#define PI 3.14159265358979323846 // ¶¨ÒåÅ·À­½Ç½á¹¹Ì壨µ¥Î»£º¶È£© typedef struct{ @@ -177,6 +177,15 @@ typedef struct double valleyMaxW; }SSG_VFeatureParam; +typedef struct +{ + int lineIdx; + int startPtIdx; + int endPtIdx; + SVzNL3DPoint startPt; + SVzNL3DPoint endPt; +}SWD_segFeature; + typedef struct { double sameGapTh; @@ -199,6 +208,22 @@ typedef struct double bagH; //¸ß }SSG_bagParam; +typedef struct +{ + double length; //³¤ + double width; //¿í + double height; //¸ß +}SWD_sizeParam; + +typedef struct +{ + SVzNLRangeD xRange; //< X·¶Î§ + SVzNLRangeD yRange; //< Y·¶Î§ + SVzNLRangeD zRange; //< Z·¶Î§ + double scale_x; + double scale_y; +} SWD_pointCloudPara; + typedef struct { ESG_poseSortingMode sortMode; @@ -235,6 +260,15 @@ typedef struct std::vector< SSG_featureSemiCircle> treeNodes; }SSG_semiCircleFeatureTree; +typedef struct +{ + int treeState; + int sLineIdx; + int eLineIdx; + double tree_value; + std::vector< SWD_segFeature> treeNodes; +}SWD_segFeatureTree; + typedef struct { int vTreeFlag; @@ -267,6 +301,15 @@ typedef struct int value; }SSG_RUN; +typedef struct +{ + int start; + int len; + int value; + bool start_zRising; //ÆðµãzÉÏÌø±êÖ¾ + bool end_zRising;//ÖÕµãzÉÏÌø±êÖ¾ +}SSG_RUN_EX; + typedef struct { double mean; @@ -322,10 +365,16 @@ typedef struct typedef struct { SVzNL3DPoint opCenter; //¶¨×ÓÖÐÐÄλÖà - int neighbourNum; //ÏàÁÚÄ¿±êÊýÁ¿ - double opAngle; //¶¨×ÓÍⲿÏà¸ô120¶È²Ù×÷µãµÄ²Ù×÷½Ç¶È¡£ÒÔYÐÎΪ»ù×¼½Ç¶È£¨0¶È) - double obstacleDist; //¾àÀëÖܱßÕϰ­µÄ¾àÀë -}SSG_motorStatorPosition; + double objR; +}SWD_motorStatorPosition; + +typedef struct +{ + int objID; + double grasperAngle; + double rotateAngle; //×¥ÊÖÔÚ0¶ÈλÖÃʱΪѾ×ÖÐΣ¬¼ä¸ô120¶È¡£ + double graspR; +}SWD_statorOuterGrasper; typedef struct { @@ -414,3 +463,18 @@ typedef struct double forward_z; double backward_z; }SSG_pntDirAngle; + +// ͼÏñÊý¾Ý½á¹¹ +typedef struct { + int width; + int height; + std::vector> gray; // »Ò¶Èͼ + std::vector> markers; // ±ê¼Çͼ£¨-1±íʾ·ÖË®Á룬0±íʾδ±ê¼Ç£¬>0±íÊ¾ÇøÓò£© +}SWD_waterShedImage; + +//²é¿Æ¶þάÂëMark +typedef struct +{ + int markID; + SVzNL3DPoint mark3D; +}SWD_charuco3DMark; diff --git a/SDK/bagPosition/Inc/SG_errCode.h b/SDK/bagPosition/Inc/SG_errCode.h index e0fd99dc..c6a94327 100644 --- a/SDK/bagPosition/Inc/SG_errCode.h +++ b/SDK/bagPosition/Inc/SG_errCode.h @@ -6,7 +6,17 @@ #define SG_ERR_NOT_GRID_FORMAT -1003 #define SG_ERR_LABEL_INFO_ERROR -1004 #define SG_ERR_INVLD_SORTING_MODE -1005 +#define SG_ERR_INVLD_Q_SCALE -1006 //BQ_workpiece #define SX_ERR_INVLD_VTREE_NUM -2001 -#define SX_ERR_INVLD_HTREE_NUM -2002 \ No newline at end of file +#define SX_ERR_INVLD_HTREE_NUM -2002 +#define SX_ERR_INVLD_EDGE_LINK_NUM -2003 +#define SX_ERR_INVLD_CLOSES_PT -2004 +#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_CUTTING_Z -2101 +#define SX_ERR_ZERO_OBJ -2102 \ No newline at end of file diff --git a/SDK/bagPosition/Windows/x64/Debug/bagPositioning.dll b/SDK/bagPosition/Windows/x64/Debug/bagPositioning.dll index dc2855f0..235f78ff 100644 Binary files a/SDK/bagPosition/Windows/x64/Debug/bagPositioning.dll and b/SDK/bagPosition/Windows/x64/Debug/bagPositioning.dll differ diff --git a/SDK/bagPosition/Windows/x64/Debug/bagPositioning.pdb b/SDK/bagPosition/Windows/x64/Debug/bagPositioning.pdb index f2888e8b..e61059f2 100644 Binary files a/SDK/bagPosition/Windows/x64/Debug/bagPositioning.pdb and b/SDK/bagPosition/Windows/x64/Debug/bagPositioning.pdb differ diff --git a/SDK/bagPosition/Windows/x64/Debug/baseAlgorithm.dll b/SDK/bagPosition/Windows/x64/Debug/baseAlgorithm.dll index 302e648e..a3f5907c 100644 Binary files a/SDK/bagPosition/Windows/x64/Debug/baseAlgorithm.dll and b/SDK/bagPosition/Windows/x64/Debug/baseAlgorithm.dll differ diff --git a/SDK/bagPosition/Windows/x64/Debug/baseAlgorithm.pdb b/SDK/bagPosition/Windows/x64/Debug/baseAlgorithm.pdb index d993e6ae..8db6fd2e 100644 Binary files a/SDK/bagPosition/Windows/x64/Debug/baseAlgorithm.pdb and b/SDK/bagPosition/Windows/x64/Debug/baseAlgorithm.pdb differ diff --git a/SDK/bagPosition/Windows/x64/Release/bagPositioning.dll b/SDK/bagPosition/Windows/x64/Release/bagPositioning.dll index 634813cf..64cb13f4 100644 Binary files a/SDK/bagPosition/Windows/x64/Release/bagPositioning.dll and b/SDK/bagPosition/Windows/x64/Release/bagPositioning.dll differ diff --git a/SDK/bagPosition/Windows/x64/Release/bagPositioning.pdb b/SDK/bagPosition/Windows/x64/Release/bagPositioning.pdb index 56164bc2..fe0d4960 100644 Binary files a/SDK/bagPosition/Windows/x64/Release/bagPositioning.pdb and b/SDK/bagPosition/Windows/x64/Release/bagPositioning.pdb differ diff --git a/SDK/bagPosition/Windows/x64/Release/baseAlgorithm.dll b/SDK/bagPosition/Windows/x64/Release/baseAlgorithm.dll index 1413d213..d3a16c6e 100644 Binary files a/SDK/bagPosition/Windows/x64/Release/baseAlgorithm.dll and b/SDK/bagPosition/Windows/x64/Release/baseAlgorithm.dll differ diff --git a/SDK/bagPosition/Windows/x64/Release/baseAlgorithm.pdb b/SDK/bagPosition/Windows/x64/Release/baseAlgorithm.pdb index d780842c..81b1c884 100644 Binary files a/SDK/bagPosition/Windows/x64/Release/baseAlgorithm.pdb and b/SDK/bagPosition/Windows/x64/Release/baseAlgorithm.pdb differ