更新工件孔检测算法,包含说有的工件
This commit is contained in:
parent
1b7a66a738
commit
1807fb52ae
@ -100,7 +100,7 @@ win32:CONFIG(debug, debug|release) {
|
||||
LIBS += -L../DiscHolePoseConfig/debug -lDiscHolePoseConfig
|
||||
LIBS += -L../../../AppUtils/AppConfig/debug -lAppConfig
|
||||
LIBS += -L../../../Module/AuthModule/debug -lAuthModule
|
||||
LIBS += -L../../../Module/HandEyeCalib/debug -lHandEyeCalibd
|
||||
LIBS += -L../../../Module/HandEyeCalib/debug -lHandEyeCalib
|
||||
LIBS += -L../../../Device/VrEyeDevice/debug -lVrEyeDevice
|
||||
LIBS += -L../../../Nets/debug -lModbusTCPServer
|
||||
LIBS += -L../../../Module/ShareMem/debug -lShareMem
|
||||
|
||||
@ -51,7 +51,7 @@ win32:CONFIG(debug, debug|release) {
|
||||
LIBS += -L../../../Utils/VrUtils/debug -lVrUtils
|
||||
LIBS += -L../../../AppUtils/AppConfig/debug -lAppConfig
|
||||
LIBS += -L../../../AppUtils/AppCommon/debug -lAppCommon
|
||||
LIBS += -L../../../Module/HandEyeCalib/debug -lHandEyeCalibd
|
||||
LIBS += -L../../../Module/HandEyeCalib/debug -lHandEyeCalib
|
||||
}else:win32:CONFIG(release, debug|release){
|
||||
LIBS += -L../../../Utils/VrUtils/release -lVrUtils
|
||||
LIBS += -L../../../AppUtils/AppConfig/release -lAppConfig
|
||||
|
||||
@ -96,7 +96,7 @@ win32:CONFIG(debug, debug|release) {
|
||||
LIBS += -L../JiuruiWorkpiecePoseConfig/debug -lJiuruiWorkpiecePoseConfig
|
||||
LIBS += -L../../../AppUtils/AppConfig/debug -lAppConfig
|
||||
LIBS += -L../../../Module/AuthModule/debug -lAuthModule
|
||||
LIBS += -L../../../Module/HandEyeCalib/debug -lHandEyeCalibd
|
||||
LIBS += -L../../../Module/HandEyeCalib/debug -lHandEyeCalib
|
||||
LIBS += -L../../../Device/VrEyeDevice/debug -lVrEyeDevice
|
||||
LIBS += -L../../../Nets/debug -lModbusTCPServer
|
||||
LIBS += -L../../../Module/ShareMem/debug -lShareMem
|
||||
|
||||
@ -51,7 +51,7 @@ win32:CONFIG(debug, debug|release) {
|
||||
LIBS += -L../../../Utils/VrUtils/debug -lVrUtils
|
||||
LIBS += -L../../../AppUtils/AppConfig/debug -lAppConfig
|
||||
LIBS += -L../../../AppUtils/AppCommon/debug -lAppCommon
|
||||
LIBS += -L../../../Module/HandEyeCalib/debug -lHandEyeCalibd
|
||||
LIBS += -L../../../Module/HandEyeCalib/debug -lHandEyeCalib
|
||||
}else:win32:CONFIG(release, debug|release){
|
||||
LIBS += -L../../../Utils/VrUtils/release -lVrUtils
|
||||
LIBS += -L../../../AppUtils/AppConfig/release -lAppConfig
|
||||
|
||||
@ -99,7 +99,7 @@ win32:CONFIG(debug, debug|release) {
|
||||
LIBS += -L../ScrewPositionConfig/debug -lScrewPositionConfig
|
||||
LIBS += -L../../../AppUtils/AppConfig/debug -lAppConfig
|
||||
LIBS += -L../../../Module/AuthModule/debug -lAuthModule
|
||||
LIBS += -L../../../Module/HandEyeCalib/debug -lHandEyeCalibd
|
||||
LIBS += -L../../../Module/HandEyeCalib/debug -lHandEyeCalib
|
||||
LIBS += -L../../../Device/VrEyeDevice/debug -lVrEyeDevice
|
||||
LIBS += -L../../../Nets/debug -lModbusTCPServer
|
||||
LIBS += -L../../../Module/ShareMem/debug -lShareMem
|
||||
|
||||
@ -97,7 +97,7 @@ win32:CONFIG(debug, debug|release) {
|
||||
LIBS += -L../TireHolePoseConfig/debug -lTireHolePoseConfig
|
||||
LIBS += -L../../../AppUtils/AppConfig/debug -lAppConfig
|
||||
LIBS += -L../../../Module/AuthModule/debug -lAuthModule
|
||||
LIBS += -L../../../Module/HandEyeCalib/debug -lHandEyeCalibd
|
||||
LIBS += -L../../../Module/HandEyeCalib/debug -lHandEyeCalib
|
||||
LIBS += -L../../../Device/VrEyeDevice/debug -lVrEyeDevice
|
||||
LIBS += -L../../../Nets/debug -lModbusTCPServer
|
||||
LIBS += -L../../../Module/ShareMem/debug -lShareMem
|
||||
|
||||
@ -51,7 +51,7 @@ win32:CONFIG(debug, debug|release) {
|
||||
LIBS += -L../../../Utils/VrUtils/debug -lVrUtils
|
||||
LIBS += -L../../../AppUtils/AppConfig/debug -lAppConfig
|
||||
LIBS += -L../../../AppUtils/AppCommon/debug -lAppCommon
|
||||
LIBS += -L../../../Module/HandEyeCalib/debug -lHandEyeCalibd
|
||||
LIBS += -L../../../Module/HandEyeCalib/debug -lHandEyeCalib
|
||||
}else:win32:CONFIG(release, debug|release){
|
||||
LIBS += -L../../../Utils/VrUtils/release -lVrUtils
|
||||
LIBS += -L../../../AppUtils/AppConfig/release -lAppConfig
|
||||
|
||||
@ -42,15 +42,15 @@
|
||||
|
||||
### 4.2 产品型号与拍照触发值(D1000)
|
||||
|
||||
| 序号 | 产品型号 | 触发相机1 | 触发相机2 | 定位算法 | 当前状态 |
|
||||
|------|----------|-----------|-----------|----------|----------|
|
||||
| 1 | 4WE6 | 1 | 2 | `wd_workpieceHolePositioning` | 已实现 |
|
||||
| 2 | Z2S6 | 101 | 102 | `wd_workpieceHolePositioning_2` | 已实现 |
|
||||
| 3 | Z2FS6_30_2 | 201 | 202 | `wd_workpieceHolePositioning_3` | 已实现 |
|
||||
| 4 | DB10 | 301 | 302 | `wd_workpieceHolePositioning_3`(复用) | 已接入 |
|
||||
| 5 | DB20 | 401 | 402 | `wd_workpieceHolePositioning_5` | 预留 |
|
||||
| 序号 | 产品型号 | 触发相机1 | 触发相机2 | 当前状态 |
|
||||
|------|----------|-----------|-----------|----------|
|
||||
| 1 | 4WE6 | 1 | 2 | 已实现 |
|
||||
| 2 | Z2S6 | 101 | 102 | 已实现 |
|
||||
| 3 | Z2FS6_30_2 | 201 | 202 | 已实现 |
|
||||
| 4 | DB10 | 301 | 302 | 已实现 |
|
||||
| 5 | DB20 | 401 | 402 | 已实现 |
|
||||
|
||||
工件4复用工件3的定位算法接口,但读取工件4独立配置的算法参数。工件5仍为预留;收到工件5请求后,视觉系统清除D1000,并向D1002写入状态码11。
|
||||
五种工件分别读取各自独立配置的检测参数。
|
||||
|
||||
### 4.3 检测结果状态码(D1002)
|
||||
|
||||
@ -118,7 +118,7 @@
|
||||
2. **拍照执行**
|
||||
- 检测到D1000为非零后,立即写0到D1000清除请求
|
||||
- 暂停轮询,根据D1000的值选择对应产品和相机
|
||||
- 触发相机拍照,执行该产品对应的工件孔定位算法
|
||||
- 触发相机拍照,执行该产品对应的工件孔定位检测
|
||||
|
||||
3. **坐标输出**(仅检测成功时)
|
||||
- 算法处理完成后,将坐标数据写入PLC的D2000开始的寄存器
|
||||
@ -154,7 +154,6 @@
|
||||
| 异常物料(`SX_ERR_UNKNOWN_OBJECT = -2501`) | 通知PLC,恢复轮询 | 2 |
|
||||
| 无产品(`SX_ERR_ZERO_OBJECTS = -1010`,兼容空目标类错误) | 通知PLC,恢复轮询 | 3 |
|
||||
| 其他算法检测失败 | 通知PLC,恢复轮询 | 11 |
|
||||
| 工件5算法预留 | 清除请求,通知PLC,恢复轮询 | 11 |
|
||||
| D1000触发值无效 | 清除请求,通知PLC,恢复轮询 | 11 |
|
||||
| 检测成功有结果 | 发送坐标,通知PLC,恢复轮询 | 1 |
|
||||
| 连接断开 | 自动重连,发送错误信号 | - |
|
||||
|
||||
@ -18,7 +18,7 @@ inline const ProductInfo* Products()
|
||||
{2, "Z2S6", true},
|
||||
{3, "Z2FS6_30_2", true},
|
||||
{4, "DB10", true},
|
||||
{5, "DB20", false}
|
||||
{5, "DB20", true}
|
||||
};
|
||||
return products;
|
||||
}
|
||||
|
||||
@ -170,6 +170,7 @@ int DetectPresenter::DetectWorkpieceHole(
|
||||
groundCalibPara, workpiecePositioning, &errCode);
|
||||
break;
|
||||
case 2:
|
||||
case 5:
|
||||
algorithmName = "wd_workpieceHolePositioning_2";
|
||||
wd_workpieceHolePositioning_2(
|
||||
algorithmData, workpiecePara, lineSegPara, filterParam, growParam,
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
#define WORKPIECEHOLE_APP_NAME "工件孔定位"
|
||||
|
||||
// 版本字符串
|
||||
#define WORKPIECEHOLE_VERSION_STRING "1.2.0"
|
||||
#define WORKPIECEHOLE_VERSION_STRING "1.2.1"
|
||||
#define WORKPIECEHOLE_BUILD_STRING "1"
|
||||
#define WORKPIECEHOLE_FULL_VERSION_STRING "V" WORKPIECEHOLE_VERSION_STRING "_" WORKPIECEHOLE_BUILD_STRING
|
||||
|
||||
|
||||
@ -1,3 +1,7 @@
|
||||
# 1.2.1
|
||||
## build_1 2026-07-14
|
||||
1. 更新算法包含1-5工件算法
|
||||
|
||||
# 1.2.0
|
||||
## build_1 2026-07-14
|
||||
1. 增加1-4的工件类型
|
||||
|
||||
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.
Binary file not shown.
Binary file not shown.
@ -115,9 +115,12 @@ void _removeZeroLines(std::vector<std::vector< SVzNL3DPosition>>& scanData)
|
||||
lastLine = line;
|
||||
}
|
||||
if (firstLine < 0)
|
||||
{
|
||||
scanData.clear();
|
||||
return;
|
||||
}
|
||||
|
||||
if (lastLine < (lineNum - 1))
|
||||
if ( (lastLine < (lineNum - 1)) && (lastLine > 0))
|
||||
scanData.erase(scanData.begin() + lastLine + 1, scanData.end());
|
||||
|
||||
scanData.erase(scanData.begin(), scanData.begin() + firstLine);
|
||||
@ -1339,7 +1342,7 @@ void TuoPuFa_holePosition_test(void)
|
||||
long t1 = (long)GetTickCount64();//统计时间
|
||||
|
||||
SSG_lineSegParam lineSegPara;
|
||||
lineSegPara.distScale = 3.0;
|
||||
lineSegPara.distScale = 10.0;
|
||||
lineSegPara.segGapTh_y = 15.0; //
|
||||
lineSegPara.segGapTh_z = 0.0; //z方向间隔大于10mm认为是分段
|
||||
SSG_outlierFilterParam filterParam;
|
||||
@ -1373,15 +1376,15 @@ void TuoPuFa_holePosition_test(void)
|
||||
&errCode);
|
||||
long t2 = (long)GetTickCount64();
|
||||
if(errCode == SX_ERR_UNKNOWN_OBJECT)
|
||||
printf("%s: %d(ms), 有异物残留!\n", _scan_file, (int)(t2 - t1));
|
||||
printf("%s: %d(ms), 有异物残留! ...", _scan_file, (int)(t2 - t1));
|
||||
else if(errCode == SX_ERR_ZERO_OBJECTS)
|
||||
printf("%s: %d(ms), 无产品!\n", _scan_file, (int)(t2 - t1));
|
||||
printf("%s: %d(ms), 无产品! ...", _scan_file, (int)(t2 - t1));
|
||||
else
|
||||
printf("%s: %d(ms), errCode=%d\n", _scan_file, (int)(t2 - t1), errCode);
|
||||
printf("%s: %d(ms), errCode=%d ...", _scan_file, (int)(t2 - t1), errCode);
|
||||
//输出测试结果
|
||||
sprintf_s(_scan_file, "%sresult\\LaserLine%d_result.txt", dataPath[grp], fidx);
|
||||
sprintf_s(_scan_file, "%sresult/LaserLine%d_result.txt", dataPath[grp], fidx);
|
||||
_outputRGBDResult_RGBD(_scan_file, scanLines, workpiecePositioning);
|
||||
sprintf_s(calibFile, "%sresult\\LaserLine%d_corner_info.txt", dataPath[grp], fidx);
|
||||
sprintf_s(calibFile, "%sresult/LaserLine%d_corner_info.txt", dataPath[grp], fidx);
|
||||
_outputWorkpieceInfo(calibFile, workpiecePositioning);
|
||||
|
||||
sprintf_s(calibFile, "%sresult/LaserLine%d_holes_projection.png", dataPath[grp], fidx);
|
||||
@ -1390,6 +1393,7 @@ void TuoPuFa_holePosition_test(void)
|
||||
double displayScale = 0.3;
|
||||
cv::String imgName(calibFile);
|
||||
_genXOYProjectionImage(imgName, scanLines, displayScale, workpiecePositioning, rpy, angleDrawLen);
|
||||
printf("done\n");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@ -1476,7 +1480,7 @@ void TuoPuFa_holePosition_test2(void)
|
||||
groundCalibPara.invRMatrix[i] = groundCalibPara.planeCalib[i];
|
||||
char calibFile[250];
|
||||
sprintf_s(calibFile, "%sground_calib_para.txt", dataPath[grp]);
|
||||
//groundCalibPara = _readCalibPara(calibFile);
|
||||
groundCalibPara = _readCalibPara(calibFile);
|
||||
|
||||
for (int fidx = fileIdx[grp].nMin; fidx <= fileIdx[grp].nMax; fidx++)
|
||||
{
|
||||
@ -1492,7 +1496,7 @@ void TuoPuFa_holePosition_test2(void)
|
||||
long t1 = (long)GetTickCount64();//统计时间
|
||||
|
||||
SSG_lineSegParam lineSegPara;
|
||||
lineSegPara.distScale = 3.0;
|
||||
lineSegPara.distScale = 10.0;
|
||||
lineSegPara.segGapTh_y = 15.0; //
|
||||
lineSegPara.segGapTh_z = 0.0; //z方向间隔大于10mm认为是分段
|
||||
SSG_outlierFilterParam filterParam;
|
||||
@ -1507,7 +1511,7 @@ void TuoPuFa_holePosition_test2(void)
|
||||
growParam.minVTypeTreeLen = 2.0; //mm
|
||||
WD_workpieceHoleParam workpiecePara;
|
||||
workpiecePara.workpieceType = 0;
|
||||
workpiecePara.holeDiameter = 6.0; //
|
||||
workpiecePara.holeDiameter = 8.0; //
|
||||
workpiecePara.holeDist_W = 32.0;
|
||||
workpiecePara.holeDist_L = 40.0;
|
||||
workpiecePara.xLen = 44;
|
||||
@ -1526,9 +1530,9 @@ void TuoPuFa_holePosition_test2(void)
|
||||
&errCode);
|
||||
long t2 = (long)GetTickCount64();
|
||||
if (errCode == SX_ERR_UNKNOWN_OBJECT)
|
||||
printf("%s: %d(ms), 有异物残留!\n", _scan_file, (int)(t2 - t1));
|
||||
printf("%s: %d(ms), 有异物残留! ...", _scan_file, (int)(t2 - t1));
|
||||
else if (errCode == SX_ERR_ZERO_OBJECTS)
|
||||
printf("%s: %d(ms), 无产品!\n", _scan_file, (int)(t2 - t1));
|
||||
printf("%s: %d(ms), 无产品! ...", _scan_file, (int)(t2 - t1));
|
||||
else
|
||||
printf("%s: %d(ms), errCode=%d ...", _scan_file, (int)(t2 - t1), errCode);
|
||||
//输出测试结果
|
||||
@ -1943,11 +1947,11 @@ void TuoPuFa_holePosition_test5(void)
|
||||
groundCalibPara.invRMatrix[i] = groundCalibPara.planeCalib[i];
|
||||
char calibFile[250];
|
||||
sprintf_s(calibFile, "%sground_calib_para.txt", dataPath[grp]);
|
||||
//groundCalibPara = _readCalibPara(calibFile);
|
||||
groundCalibPara = _readCalibPara(calibFile);
|
||||
|
||||
for (int fidx = fileIdx[grp].nMin; fidx <= fileIdx[grp].nMax; fidx++)
|
||||
{
|
||||
//fidx =2;
|
||||
//fidx =4;
|
||||
char _scan_file[256];
|
||||
sprintf_s(_scan_file, "%s%d_LaserData_Jh26B074.txt", dataPath[grp], fidx);
|
||||
std::vector<std::vector< SVzNL3DPosition>> scanLines;
|
||||
@ -1958,8 +1962,17 @@ void TuoPuFa_holePosition_test5(void)
|
||||
|
||||
long t1 = (long)GetTickCount64();//统计时间
|
||||
|
||||
WD_workpieceHoleParam workpiecePara;
|
||||
workpiecePara.workpieceType = 0;
|
||||
workpiecePara.holeDiameter = 6.0; //
|
||||
workpiecePara.holeDist_W = 32.0;
|
||||
workpiecePara.holeDist_L = 40.0;
|
||||
workpiecePara.xLen = 44;
|
||||
workpiecePara.yLen = 70;
|
||||
workpiecePara.H = 28;
|
||||
|
||||
SSG_lineSegParam lineSegPara;
|
||||
lineSegPara.distScale = 3.0;
|
||||
lineSegPara.distScale = workpiecePara.H / 2; //此参数用于确定
|
||||
lineSegPara.segGapTh_y = 15.0; //
|
||||
lineSegPara.segGapTh_z = 0.0; //z方向间隔大于10mm认为是分段
|
||||
SSG_outlierFilterParam filterParam;
|
||||
@ -1970,16 +1983,9 @@ void TuoPuFa_holePosition_test5(void)
|
||||
growParam.yDeviation_max = 4.0;
|
||||
growParam.maxSkipDistance = 0.0;
|
||||
growParam.zDeviation_max = 10.0;//
|
||||
growParam.minLTypeTreeLen = 2.0; //mm
|
||||
growParam.minVTypeTreeLen = 2.0; //mm
|
||||
WD_workpieceHoleParam workpiecePara;
|
||||
workpiecePara.workpieceType = 0;
|
||||
workpiecePara.holeDiameter = 10.0; //
|
||||
workpiecePara.holeDist_W = 32.0;
|
||||
workpiecePara.holeDist_L = 40.0;
|
||||
workpiecePara.xLen = 44;
|
||||
workpiecePara.yLen = 70;
|
||||
workpiecePara.H = 28;
|
||||
growParam.minLTypeTreeLen = 1.5; //mm
|
||||
growParam.minVTypeTreeLen = 1.5; //mm
|
||||
|
||||
int errCode = 0;
|
||||
std::vector< WD_workpieceInfo> workpiecePositioning;
|
||||
wd_workpieceHolePositioning_2(
|
||||
@ -2695,6 +2701,7 @@ typedef enum
|
||||
keSG_拓普发孔定位_工件3,
|
||||
keSG_拓普发孔定位_工件4,
|
||||
keSG_拓普发孔定位_工件5,
|
||||
keSG_拓普发孔定位_工件全测试,
|
||||
keSG_华航孔定位,
|
||||
keSG_微力砂轮盘定位,
|
||||
keSG_微力砂轮架子定位,
|
||||
@ -2708,7 +2715,8 @@ int main()
|
||||
//ESG_testMode testMode = keSG_拓普发孔定位_工件2;
|
||||
//ESG_testMode testMode = keSG_拓普发孔定位_工件3;
|
||||
//ESG_testMode testMode = keSG_拓普发孔定位_工件4;
|
||||
ESG_testMode testMode = keSG_拓普发孔定位_工件5;
|
||||
//ESG_testMode testMode = keSG_拓普发孔定位_工件5;
|
||||
ESG_testMode testMode = keSG_拓普发孔定位_工件全测试;
|
||||
//ESG_testMode testMode = keSG_华航孔定位;
|
||||
//ESG_testMode testMode = keSG_微力砂轮盘定位;
|
||||
//ESG_testMode testMode = keSG_微力砂轮架子定位;
|
||||
@ -2726,6 +2734,14 @@ int main()
|
||||
TuoPuFa_holePosition_test4();
|
||||
else if (keSG_拓普发孔定位_工件5 == testMode)
|
||||
TuoPuFa_holePosition_test5();
|
||||
else if (keSG_拓普发孔定位_工件全测试 == testMode)
|
||||
{
|
||||
TuoPuFa_holePosition_test();
|
||||
TuoPuFa_holePosition_test2();
|
||||
TuoPuFa_holePosition_test3();
|
||||
TuoPuFa_holePosition_test4();
|
||||
TuoPuFa_holePosition_test5();
|
||||
}
|
||||
else if (keSG_华航孔定位 == testMode)
|
||||
HuaHang_holePosition_test();
|
||||
else if (keSG_微力砂轮盘定位 == testMode)
|
||||
|
||||
@ -17,7 +17,7 @@
|
||||
| 11 | 铁路隧道槽道测量 | TunnelChannel | 1.0.0.3 |
|
||||
| 12 | 螺杆定位 | ScrewPosition | 1.2.4.1 |
|
||||
| 13 | 包裹拆线位置定位 | BagThreadPosition | 1.0.0.4 |
|
||||
| 14 | 工件孔定位 | WorkpieceHole | 1.2.0.1 |
|
||||
| 14 | 工件孔定位 | WorkpieceHole | 1.2.1.1 |
|
||||
| 15 | 轮胎孔定位 | TireHolePose | 1.0.2.1 |
|
||||
| 16 | 坑孔定位 | HolePitPosition | 无 |
|
||||
| 17 | 钢筋焊缝定位 | RodWeldSeam | 1.0.0.1 |
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user