通讯支持算法处理多条信号同步发送

master
zhou.mengjia 2 years ago
parent 6ae5aba12f
commit fc64f8873d

File diff suppressed because it is too large Load Diff

@ -29,7 +29,7 @@
"rotation_angle": 0,
"calib_file": ".\\config\\1.calib",
"save": 1,
"save_img_suffix": ".BMP",
"save_img_suffix": ".PNG",
"savefile_rgb_swapped": false,
"showname": "相机一",
"trigger_source": "Line0",
@ -66,7 +66,7 @@
"rotation_angle": 0,
"calib_file": ".\\config\\1.calib",
"save": 1,
"save_img_suffix": ".BMP",
"save_img_suffix": ".PNG",
"savefile_rgb_swapped": false,
"showname": "相机一",
"trigger_source": "Line0",
@ -78,7 +78,7 @@
"id": 3,
"exposure": 10000,
"location": 1,
"save_img_suffix": ".BMP",
"save_img_suffix": ".PNG",
"height": 3072,
"width": 2048,
"type": 210
@ -88,7 +88,7 @@
"id": 4,
"exposure": 10000,
"location": 2,
"save_img_suffix": ".BMP",
"save_img_suffix": ".PNG",
"height": 3072,
"width": 2048,
"type": 210

Binary file not shown.

@ -7,12 +7,12 @@ HeightCalculate::HeightCalculate(QObject *parent)
HeightCalculate::~HeightCalculate()
{}
void HeightCalculate::LoadBasicFile()
void HeightCalculate::LoadBasicFile(QString path)
{
}
void HeightCalculate::LoadPointCould()
void HeightCalculate::LoadPointCould(QString path)
{
}

@ -10,8 +10,8 @@ public:
HeightCalculate(QObject *parent = nullptr);
~HeightCalculate();
void LoadBasicFile();
void LoadPointCould();
void LoadBasicFile(QString path);
void LoadPointCould(QString path);
int SmokeHeight();
};

@ -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;
@ -398,9 +415,18 @@ Q_SLOT void SmokeBoxIdentification::onDecodeMsg(const QString& msg)
m_currtStockCheckInfo.stockLocation = strList.at(4);
m_currtStockCheckInfo.smokeTypeNum = strList.at(5);
m_currtStockCheckInfo.smokeQuantity = strList.at(6);
m_stocketList.insert(m_currtStockCheckInfo.id.toInt(),m_currtStockCheckInfo);
m_stocketList.insert(m_currtStockCheckInfo.id.toInt(), m_currtStockCheckInfo);
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:

@ -150,6 +150,8 @@ struct IntoStockInfo
QString stockNum; //货架位置UL062015020111 6号堆垛机2右边
QString id = 0;
QString stockLocation = 0; // 方向1左2右0保留为之前规则
QString smokeTypeNum; //上位机发送的品规号37010106
QString smokeQuantity; //上位机发送的数量30
QStringList imagesPathList;
};
@ -179,6 +181,7 @@ struct StockCheckInfo
QString smokeTypeNumRlt; //盘点识别的品规号
QString smokeQuantityRlt; //盘点识别的数量
bool correctness; //盘点结果是否与上位机一致
QStringList imagesPathList;
//void clear()
//{
// streetName.clear();

Loading…
Cancel
Save