hybridPosePositioning
version 1.4.7 : 转子钢芯,添加无隔板检测出来时的虚假检测的滤除
This commit is contained in:
parent
7a3d9538bf
commit
1fc70eb44d
@ -2353,7 +2353,7 @@ void HaiRuiMa_groundCalib_test(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
//拓普发工件孔定位(工件定位)
|
//拓普发工件孔定位(工件定位)
|
||||||
#define HRM_RotorCore_TEST_GROUP 6
|
#define HRM_RotorCore_TEST_GROUP 7
|
||||||
void HaiRuiMa_rotorCorePositioning_test(void)
|
void HaiRuiMa_rotorCorePositioning_test(void)
|
||||||
{
|
{
|
||||||
const char* dataPath[HRM_RotorCore_TEST_GROUP] = {
|
const char* dataPath[HRM_RotorCore_TEST_GROUP] = {
|
||||||
@ -2364,10 +2364,11 @@ void HaiRuiMa_rotorCorePositioning_test(void)
|
|||||||
"F:/ShangGu/项目/冠钦项目/宁波海瑞马/转子钢芯/2026-09-海瑞马/09-14/", //3
|
"F:/ShangGu/项目/冠钦项目/宁波海瑞马/转子钢芯/2026-09-海瑞马/09-14/", //3
|
||||||
"F:/ShangGu/项目/冠钦项目/宁波海瑞马/转子钢芯/2026-09-海瑞马/09-14中/", //4
|
"F:/ShangGu/项目/冠钦项目/宁波海瑞马/转子钢芯/2026-09-海瑞马/09-14中/", //4
|
||||||
"F:/ShangGu/项目/冠钦项目/宁波海瑞马/转子钢芯/2026-09-海瑞马/异常数据/", //5
|
"F:/ShangGu/项目/冠钦项目/宁波海瑞马/转子钢芯/2026-09-海瑞马/异常数据/", //5
|
||||||
|
"F:/ShangGu/项目/冠钦项目/宁波海瑞马/转子钢芯/2026-09-海瑞马/10-09小/", //6
|
||||||
};
|
};
|
||||||
|
|
||||||
SVzNLRange fileIdx[HRM_RotorCore_TEST_GROUP] = {
|
SVzNLRange fileIdx[HRM_RotorCore_TEST_GROUP] = {
|
||||||
{1,10}, {3,70},{9,9}, {51,51}, {1,54}, {1,6}
|
{1,10}, {3,70},{9,9}, {52,52}, {1,54}, {1,6}, {1,8}
|
||||||
};
|
};
|
||||||
|
|
||||||
const char* ver = wd_hybridPositioningVersion();
|
const char* ver = wd_hybridPositioningVersion();
|
||||||
@ -2456,6 +2457,11 @@ void HaiRuiMa_rotorCorePositioning_test(void)
|
|||||||
workpieceParam.radius = 42.0;
|
workpieceParam.radius = 42.0;
|
||||||
workpieceParam.height = 50.0;
|
workpieceParam.height = 50.0;
|
||||||
}
|
}
|
||||||
|
else if (grp == 6)
|
||||||
|
{
|
||||||
|
workpieceParam.radius = 32.0;
|
||||||
|
workpieceParam.height = 25.0;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
workpieceParam.radius = 45.0;
|
workpieceParam.radius = 45.0;
|
||||||
|
|||||||
@ -29,7 +29,8 @@
|
|||||||
//version 1.4.4 : 转子钢芯,添加了异常保护
|
//version 1.4.4 : 转子钢芯,添加了异常保护
|
||||||
//version 1.4.5 : 转子钢芯,隔板检测内部参数修改:2:1抽样,聚类距离门限5mm
|
//version 1.4.5 : 转子钢芯,隔板检测内部参数修改:2:1抽样,聚类距离门限5mm
|
||||||
//version 1.4.6 : 转子钢芯,添加隔板下工作部分可见时虚假检测的滤除,非中央部分工作按高度排序
|
//version 1.4.6 : 转子钢芯,添加隔板下工作部分可见时虚假检测的滤除,非中央部分工作按高度排序
|
||||||
std::string m_strVersion = "HybridPositioning 1.4.6";
|
//version 1.4.7 : 转子钢芯,添加无隔板检测出来时的虚假检测的滤除
|
||||||
|
std::string m_strVersion = "HybridPositioning 1.4.7";
|
||||||
const char* wd_hybridPositioningVersion(void)
|
const char* wd_hybridPositioningVersion(void)
|
||||||
{
|
{
|
||||||
return m_strVersion.c_str();
|
return m_strVersion.c_str();
|
||||||
@ -1013,6 +1014,19 @@ double _getListMeanZ(std::vector< SVzNL3DPosition>& listData, SVzNLRangeD& zRang
|
|||||||
return meanZ;
|
return meanZ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
double _getListMeanZ_2(std::vector< SVzNL3DPoint>& listData)
|
||||||
|
{
|
||||||
|
if (listData.size() == 0)
|
||||||
|
return 0;
|
||||||
|
double meanZ = 0;
|
||||||
|
for (int i = 0; i < (int)listData.size(); i++)
|
||||||
|
{
|
||||||
|
meanZ += listData[i].z;
|
||||||
|
}
|
||||||
|
meanZ = meanZ / (double)listData.size();
|
||||||
|
return meanZ;
|
||||||
|
}
|
||||||
|
|
||||||
//检测料筐边缘,以中心点为基准进行规划
|
//检测料筐边缘,以中心点为基准进行规划
|
||||||
WD_HRM_BinInfo wd_HRM_getBinSize_2(
|
WD_HRM_BinInfo wd_HRM_getBinSize_2(
|
||||||
std::vector< std::vector<SVzNL3DPosition>>& scanLines,
|
std::vector< std::vector<SVzNL3DPosition>>& scanLines,
|
||||||
@ -1505,6 +1519,20 @@ SVzNL3DPoint _searchNearestPoint(std::vector<SVzNL3DPosition>& pointList, const
|
|||||||
return target;
|
return target;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void _searchRCirclePoints(std::vector< std::vector<SVzNL3DPosition>>& scanData, const SVzNL3DPoint& seedPt, const double R, std::vector< SVzNL3DPoint>& resultPts)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < (int)scanData.size(); i++)
|
||||||
|
{
|
||||||
|
for (int j = 0; j < (int)scanData[i].size(); j++)
|
||||||
|
{
|
||||||
|
double dist = sqrt(pow(seedPt.x - scanData[i][j].pt3D.x, 2) + pow(seedPt.y - scanData[i][j].pt3D.y, 2));
|
||||||
|
if ( (dist <= R) && (scanData[i][j].pt3D.z > 1e-4))
|
||||||
|
resultPts.push_back(scanData[i][j].pt3D);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
void wd_HRM_RotorCorePositioning(
|
void wd_HRM_RotorCorePositioning(
|
||||||
std::vector< std::vector<SVzNLPositionD>>& scanLinesInput,
|
std::vector< std::vector<SVzNLPositionD>>& scanLinesInput,
|
||||||
std::vector<WD_objArea2D>& objROIs,
|
std::vector<WD_objArea2D>& objROIs,
|
||||||
@ -1880,7 +1908,7 @@ void wd_HRM_RotorCorePositioning(
|
|||||||
//添加对隔板下部分可见被识别目标的过滤
|
//添加对隔板下部分可见被识别目标的过滤
|
||||||
if ((spacerInfo.center.z > 1e-4)&& (a_workpiece.center.z > 1e-4)) //隔板存在
|
if ((spacerInfo.center.z > 1e-4)&& (a_workpiece.center.z > 1e-4)) //隔板存在
|
||||||
{
|
{
|
||||||
//搜索与工件中心最接近的点
|
//搜索隔板点云与工件中心最接近的点
|
||||||
SVzNL3DPoint nearestPt = _searchNearestPoint(spacerPoints, a_workpiece.center);
|
SVzNL3DPoint nearestPt = _searchNearestPoint(spacerPoints, a_workpiece.center);
|
||||||
double dist = sqrt(pow(nearestPt.x - a_workpiece.center.x, 2) + pow(nearestPt.y - a_workpiece.center.y, 2));
|
double dist = sqrt(pow(nearestPt.x - a_workpiece.center.x, 2) + pow(nearestPt.y - a_workpiece.center.y, 2));
|
||||||
if (dist < workpieceParam.radius * 0.3)
|
if (dist < workpieceParam.radius * 0.3)
|
||||||
@ -1890,6 +1918,19 @@ void wd_HRM_RotorCorePositioning(
|
|||||||
a_workpiece.center = { 0.0, 0.0, 0.0 };
|
a_workpiece.center = { 0.0, 0.0, 0.0 };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//搜索点云与工件中心最接近的点
|
||||||
|
std::vector<SVzNL3DPoint> roiPoints;
|
||||||
|
_searchRCirclePoints(roiScanLines, a_workpiece.center, workpieceParam.radius * 0.2, roiPoints);
|
||||||
|
double meanZ = _getListMeanZ_2(roiPoints);
|
||||||
|
if (meanZ > 1e-4)
|
||||||
|
{
|
||||||
|
double heightDiff = meanZ - a_workpiece.center.z;
|
||||||
|
if (heightDiff < workpieceParam.height / 4)
|
||||||
|
a_workpiece.center = { 0.0, 0.0, 0.0 };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef _OUTPUT_DEBUG_DATA
|
#ifdef _OUTPUT_DEBUG_DATA
|
||||||
if (a_workpiece.center.z > 1e-4)
|
if (a_workpiece.center.z > 1e-4)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user