diff --git a/App/App.pro b/App/App.pro
index 12ea98b..d6a99e4 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 811bf91..6e6fe71 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 1b0f862..9b775e0 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 6ce21b1..a7e3b06 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 338895f..c564ffc 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 93cd81d..f88dcc1 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 22948bb..c8ca56d 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 2281344..d242d37 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 44c8441..832567e 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 0000000..f53e18e
--- /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 05a5ee7..3ca4aa4 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(
//һƽƽ
//пһƽͲοƽƽ棬ߵƽеƽ
//תΪƽƽ淨ΪֱIJ
-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 fcd55f2..d2d3a3e 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ȲIJǶȡ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 e0fd99d..c6a9432 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 dc2855f..235f78f 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 f2888e8..e61059f 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 302e648..a3f5907 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 d993e6a..8db6fd2 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 634813c..64cb13f 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 56164bc..fe0d496 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 1413d21..d3a16c6 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 d780842..81b1c88 100644
Binary files a/SDK/bagPosition/Windows/x64/Release/baseAlgorithm.pdb and b/SDK/bagPosition/Windows/x64/Release/baseAlgorithm.pdb differ