feat:更新算法,增加outputMode参数
This commit is contained in:
parent
b5a01dcffc
commit
b8ffc01f27
14
App/App.pro
14
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
|
||||
|
||||
|
||||
@ -3,6 +3,7 @@
|
||||
|
||||
DetectPresenter::DetectPresenter(/* args */)
|
||||
{
|
||||
LOG_INFO("algo version : %s\n", sg_bagPositioningVersion());
|
||||
}
|
||||
|
||||
DetectPresenter::~DetectPresenter()
|
||||
|
||||
@ -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) {
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
@ -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() {
|
||||
|
||||
@ -1,3 +1,8 @@
|
||||
#1.3.3
|
||||
## build_0 2025-12-10
|
||||
1. 更新算法,增加outputMode参数
|
||||
|
||||
|
||||
#1.3.2
|
||||
## build_2 2025-11-23
|
||||
1. config 修改默认数据
|
||||
|
||||
@ -284,6 +284,7 @@ struct VrAlgorithmParams
|
||||
VrRgbColorPattern rgbColorPattern;
|
||||
VrColorTemplateParam colorTemplateParam;
|
||||
int supportRotate = 1;
|
||||
int outputMode = 0; // 输出模式:0 - 从大到小, 1 - 从小到大
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@ -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");
|
||||
|
||||
|
||||
@ -213,7 +213,10 @@
|
||||
|
||||
<!-- 支持旋转参数 -->
|
||||
<SupportRotate enabled="0" />
|
||||
|
||||
|
||||
<!-- 输出模式参数:0-从大到小排序,1-从小到大排序 -->
|
||||
<OutputMode mode="0" />
|
||||
|
||||
<!-- HSV颜色比较参数 -->
|
||||
<HsvCmpParam hueTh="15.0" saturateTh="120.0" FBVldPtRatioTh="0.075"
|
||||
frontVldPtGreater="true" front_upVldPtGreater="false" back_upVldPtGreater="true" />
|
||||
|
||||
22
SDK/bagPosition/Inc/SG_algo_Export.h
Normal file
22
SDK/bagPosition/Inc/SG_algo_Export.h
Normal file
@ -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
|
||||
@ -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 <vector>
|
||||
|
||||
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<SSG_lineFeature>& all_vLineFeatures,
|
||||
@ -83,7 +73,7 @@ SG_BAGSHARED_EXPORT void sg_getBagPosition(
|
||||
const SSG_planeCalibPara poseCalibPara,
|
||||
std::vector<SSG_peakRgnInfo>& objOps);
|
||||
|
||||
SG_BAGSHARED_EXPORT void sg_getBagPositionAndOrientation(
|
||||
SG_APISHARED_EXPORT void sg_getBagPositionAndOrientation(
|
||||
SVzNLXYZRGBDLaserLine* laser3DPoints,
|
||||
int lineNum,
|
||||
//std::vector<SSG_lineFeature>& 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<SSG_sideBagInfo>& 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);
|
||||
@ -4,7 +4,7 @@
|
||||
#include <vector>
|
||||
#include <SG_errCode.h>
|
||||
|
||||
#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<std::vector<int>> gray; // 灰度图
|
||||
std::vector<std::vector<int>> markers; // 标记图(-1表示分水岭,0表示未标记,>0表示区域)
|
||||
}SWD_waterShedImage;
|
||||
|
||||
//查科二维码Mark
|
||||
typedef struct
|
||||
{
|
||||
int markID;
|
||||
SVzNL3DPoint mark3D;
|
||||
}SWD_charuco3DMark;
|
||||
|
||||
@ -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
|
||||
#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
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user