|
|
|
|
@ -298,8 +298,14 @@ Q_SLOT void SmokeBoxIdentification::onDecodeMsg(const QString& msg)
|
|
|
|
|
msgContent.chop(1);
|
|
|
|
|
}
|
|
|
|
|
qDebug() << "msg: " << msg << " content: " << msgContent;
|
|
|
|
|
|
|
|
|
|
switch (m_moduleParam.COMMRules)
|
|
|
|
|
{
|
|
|
|
|
case eCommunicationRules::emNJ:
|
|
|
|
|
{
|
|
|
|
|
QStringList strList = msgContent.split(SPLIT_RULE);
|
|
|
|
|
qDebug() << "strlist length: " << strList.length() << " head: " << strList.at(0);
|
|
|
|
|
|
|
|
|
|
if (strList[0] == EMPTY_CHECK_HEAD)
|
|
|
|
|
{
|
|
|
|
|
if (strList.length() == 4)
|
|
|
|
|
@ -378,7 +384,16 @@ Q_SLOT void SmokeBoxIdentification::onDecodeMsg(const QString& msg)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if (strList.at(0) == START_CAPTURE)
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case eCommunicationRules::emSJZ:
|
|
|
|
|
{
|
|
|
|
|
QStringList msgList = msgContent.split(END_SYMBOL);
|
|
|
|
|
for (int i = 0; i < msgList.length(); i++)
|
|
|
|
|
{
|
|
|
|
|
QStringList strList = msgList[i].split(SPLIT_RULE);
|
|
|
|
|
qDebug() << "strlist length: " << strList.length() << " head: " << strList.at(0);
|
|
|
|
|
if (strList.at(0) == START_CAPTURE && strList.length() == 7)
|
|
|
|
|
{
|
|
|
|
|
qDebug() << "到位取图开始";
|
|
|
|
|
//m_workMode = WorkMode::Capture;
|
|
|
|
|
@ -386,9 +401,11 @@ Q_SLOT void SmokeBoxIdentification::onDecodeMsg(const QString& msg)
|
|
|
|
|
m_currtIntoStockInfo.id = strList.at(2);
|
|
|
|
|
m_currtIntoStockInfo.taskNum = strList.at(3);
|
|
|
|
|
m_currtIntoStockInfo.stockLocation = strList.at(4);
|
|
|
|
|
m_currtIntoStockInfo.smokeTypeNum = strList.at(5);
|
|
|
|
|
m_currtIntoStockInfo.smokeQuantity = strList.at(6);
|
|
|
|
|
captureSide(m_currtIntoStockInfo.stockLocation.toInt());
|
|
|
|
|
}
|
|
|
|
|
else if (strList.at(0) == START_CALCULATE)
|
|
|
|
|
else if (strList.at(0) == START_CALCULATE && strList.length() == 7)
|
|
|
|
|
{
|
|
|
|
|
qDebug() << "品规计数开始";
|
|
|
|
|
//m_workMode = WorkMode::StockCheck;
|
|
|
|
|
@ -402,6 +419,15 @@ Q_SLOT void SmokeBoxIdentification::onDecodeMsg(const QString& msg)
|
|
|
|
|
calculate(m_currtStockCheckInfo.id.toInt());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void SmokeBoxIdentification::calculate(int stocketID)
|
|
|
|
|
{
|
|
|
|
|
@ -444,6 +470,8 @@ void SmokeBoxIdentification::calculate(int stocketID)
|
|
|
|
|
m_pCategoryMatcher->saveResultsImage(filePath);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
m_stocketList[stocketID].imagesPathList.append(filePath.right(filePath.length()-1));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//根据相机编号,对应找到3D基准文件去计算层高
|
|
|
|
|
QString pclPath = dataSaveFolder;
|
|
|
|
|
@ -454,7 +482,16 @@ void SmokeBoxIdentification::calculate(int stocketID)
|
|
|
|
|
|
|
|
|
|
if (fileList.length() > 0)
|
|
|
|
|
{
|
|
|
|
|
m_pHeightCalculate->LoadPointCould();
|
|
|
|
|
pclPath = fileList[0].absolutePath();
|
|
|
|
|
m_pHeightCalculate->LoadPointCould(fileList[0].absolutePath());
|
|
|
|
|
str = QString("[%1]:Camera %2 -- PointCould = %3").arg(stocket.id)
|
|
|
|
|
.arg(imgInfo.cameraSn).arg(pclPath);
|
|
|
|
|
qInfo() << str;
|
|
|
|
|
|
|
|
|
|
int lastPos = pclPath.lastIndexOf('.');
|
|
|
|
|
QString depthImagePath = pclPath.left(lastPos);
|
|
|
|
|
depthImagePath.append(".PNG");
|
|
|
|
|
m_stocketList[stocketID].imagesPathList.append(depthImagePath.right(depthImagePath.length() - 1));
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
@ -470,9 +507,13 @@ void SmokeBoxIdentification::calculate(int stocketID)
|
|
|
|
|
.arg(imgInfo.cameraSn).arg(basicFile);
|
|
|
|
|
qWarning() << str;
|
|
|
|
|
}
|
|
|
|
|
m_pHeightCalculate->LoadBasicFile();
|
|
|
|
|
m_pHeightCalculate->LoadBasicFile(QString{});
|
|
|
|
|
|
|
|
|
|
//ÊýÁ¿¼ÆËã
|
|
|
|
|
m_stocketList[stocketID].smokeQuantityRlt = QString::number(m_pHeightCalculate->SmokeHeight());
|
|
|
|
|
|
|
|
|
|
//QFile::copy("C:\\Users\\LENOVO\\Downloads\\30t.pcd",pclPath);
|
|
|
|
|
QFile::rename(".\\Cache\\1.pcd", pclPath);
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
@ -483,6 +524,7 @@ void SmokeBoxIdentification::calculate(int stocketID)
|
|
|
|
|
QString filePath = dataSaveFolder + QString("\\%1_error.PNG")
|
|
|
|
|
.arg(stocket.smokeTypeNum);
|
|
|
|
|
m_pCategoryMatcher->saveResultsImage(filePath);
|
|
|
|
|
m_stocketList[stocketID].imagesPathList.append(filePath);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
@ -619,7 +661,8 @@ void SmokeBoxIdentification::sendResults(int mode, int id)
|
|
|
|
|
.append(m_stocketList.value(id).stockLocation).append(SPLIT_RULE)
|
|
|
|
|
.append(m_stocketList.value(id).smokeTypeNumRlt).append(SPLIT_RULE)
|
|
|
|
|
.append(m_stocketList.value(id).smokeQuantityRlt).append(SPLIT_RULE)
|
|
|
|
|
.append(QString::number(m_stocketList.value(id).correctness)).append(END_SYMBOL);
|
|
|
|
|
.append(QString::number(m_stocketList.value(id).correctness)).append(SPLIT_RULE)
|
|
|
|
|
.append(m_stocketList.value(id).imagesPathList.join(";")).append(END_SYMBOL);
|
|
|
|
|
m_stocketList.remove(id);
|
|
|
|
|
qInfo() << "m_stocketList.remove(id) = " << id <<"; Next ="<<m_stocketList.size();
|
|
|
|
|
|
|
|
|
|
@ -652,7 +695,9 @@ void SmokeBoxIdentification::sendResults(int mode, int id)
|
|
|
|
|
.append(m_currtIntoStockInfo.streetName).append(SPLIT_RULE)
|
|
|
|
|
.append(m_currtIntoStockInfo.id).append(SPLIT_RULE)
|
|
|
|
|
.append(m_currtIntoStockInfo.taskNum).append(SPLIT_RULE)
|
|
|
|
|
.append(m_currtIntoStockInfo.stockLocation).append(END_SYMBOL);
|
|
|
|
|
.append(m_currtIntoStockInfo.stockLocation).append(SPLIT_RULE)
|
|
|
|
|
.append(m_currtIntoStockInfo.smokeTypeNum).append(SPLIT_RULE)
|
|
|
|
|
.append(m_currtIntoStockInfo.smokeQuantity).append(END_SYMBOL);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
default:
|
|
|
|
|
|