diff --git a/sourceCode/dataFitting.cpp b/sourceCode/dataFitting.cpp index 26292e5..ec86a22 100644 --- a/sourceCode/dataFitting.cpp +++ b/sourceCode/dataFitting.cpp @@ -180,7 +180,8 @@ double fitCircleByLeastSquare( double r2 = radius * radius; for (int pId = 0; pId < N; ++pId) { e = abs(pow(pointArray[pId].x - center.x, 2) + pow(pointArray[pId].y - center.y, 2) - r2); -#if 0 if (e > err) { +#if 0 + if (e > err) { err = e; } #else diff --git a/sourceCode/rodAndBarDetection.cpp b/sourceCode/rodAndBarDetection.cpp index 8f16833..1b0181c 100644 --- a/sourceCode/rodAndBarDetection.cpp +++ b/sourceCode/rodAndBarDetection.cpp @@ -32,7 +32,8 @@ //version 1.4.0 : 矩森棒材抓取算法改进:(1)修正了两个棒材被识别成一根的问题(2)增强了对噪点的容忍度,增强了鲁棒性 //version 1.5.0 : 矩森棒材抓取算法改进:加强了对强噪声点云的处理 //version 1.6.0 : 矩森棒材抓取算法改进:添加了料筐信息提取和对边缘工件的判断 -std::string m_strVersion = "RodAndBarDetection_1.6.0"; +//version 1.6.1 : 矩森棒材抓取算法崩溃修复:没有棒材的情况不需要再计算料框信息 +std::string m_strVersion = "RodAndBarDetection_1.6.1"; const char* wd_rodAndBarDetectionVersion(void) { return m_strVersion.c_str(); @@ -3916,6 +3917,13 @@ void sx_rodPositioning( } } } + + if (rodInfo.empty()) + { + *errCode = SX_ERR_ZERO_OBJECTS; + return; + } + //(2)遮挡判断 //按高度排序 std::sort(rodInfo.begin(), rodInfo.end(), _commpareByCenterZ);