备份
This commit is contained in:
@@ -330,10 +330,14 @@ bool simpleCorrection(correctionStruct* correctionData, CorrectionPoints& result
|
||||
sum += yData;
|
||||
result.OriginY = sum / 3;
|
||||
}
|
||||
if (result.OriginZ < -1000 || result.OriginX < -1000 || result.OriginY < -1000)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
void ALGO_Correction(std::shared_ptr <detData> data)
|
||||
{
|
||||
data->writeBack("short", 274, "1");
|
||||
return;
|
||||
CorrectionPoints resultPoints;
|
||||
if (simpleCorrection(&data->laserData, resultPoints) == false)
|
||||
{
|
||||
@@ -342,10 +346,10 @@ void ALGO_Correction(std::shared_ptr <detData> data)
|
||||
}
|
||||
Point3d point = getRPY(resultPoints);
|
||||
|
||||
std::cout << "ox:" << resultPoints.Origin[0] << "oy:" << resultPoints.Origin[1] << "oz:" << resultPoints.Origin[2] << std::endl;
|
||||
std::cout << "Rx:" << point.x << "Ry:" << point.y << "Rz:" << point.z << std::endl;
|
||||
qDebug() << "productIndex:"<< data->productType <<"ox:" << resultPoints.Origin[0] << "oy : " << resultPoints.Origin[1] << "oz : " << resultPoints.Origin[2];
|
||||
qDebug() << "Rx:" << point.x << "Ry:" << point.y << "Rz:" << point.z;
|
||||
//std::cout << "ox:" << resultPoints.Origin[0] << "oy:" << resultPoints.Origin[1] << "oz:" << resultPoints.Origin[2] << std::endl;
|
||||
//std::cout << "Rx:" << point.x << "Ry:" << point.y << "Rz:" << point.z << std::endl;
|
||||
//qDebug() << "productIndex:"<< data->productType <<"ox:" << resultPoints.Origin[0] << "oy : " << resultPoints.Origin[1] << "oz : " << resultPoints.Origin[2];
|
||||
//qDebug() << "Rx:" << point.x << "Ry:" << point.y << "Rz:" << point.z;
|
||||
|
||||
data->pointsOffsetStruct_.baseOffsetX = data->_productDataStruct.basePos[0] - resultPoints.OriginX;
|
||||
data->pointsOffsetStruct_.baseOffsetY = data->_productDataStruct.basePos[1] - resultPoints.OriginY;
|
||||
@@ -372,9 +376,9 @@ void ALGO_Correction(std::shared_ptr <detData> data)
|
||||
std::cout << "offsetX:" << data->pointsOffsetStruct_.baseOffsetX << "offsetY:" << data->pointsOffsetStruct_.baseOffsetY << "offsetZ:" << data->pointsOffsetStruct_.baseOffsetZ << std::endl;
|
||||
//std::cout << "offsetRx:" << offsetRx << "offsetRy:" << offsetRy << "offsetRz:" << offsetRz << std::endl;
|
||||
|
||||
createModbusStrs(310, data->pointsOffsetStruct_.baseOffsetX,data);
|
||||
/*createModbusStrs(310, data->pointsOffsetStruct_.baseOffsetX,data);
|
||||
createModbusStrs(313, data->pointsOffsetStruct_.baseOffsetY, data);
|
||||
createModbusStrs(316, data->pointsOffsetStruct_.baseOffsetZ, data);
|
||||
createModbusStrs(316, data->pointsOffsetStruct_.baseOffsetZ, data);*/
|
||||
|
||||
//createModbusStrs(319, offsetRx, data);
|
||||
//createModbusStrs(322, offsetRy, data);
|
||||
|
||||
@@ -25,6 +25,9 @@ signals:
|
||||
void uiModuleSummaryDataManager_SetSummaryResultText(QString text, Qt::GlobalColor color);
|
||||
void uiModuleSummaryDataManager_Reset();
|
||||
|
||||
void uiModulestartDetBtn_disable();
|
||||
void uiModulestartDetBtn_enable();
|
||||
|
||||
void uiModuleBackContinueDetDialog_show();
|
||||
void uiModuleBackContinueDetDialog_hide();
|
||||
|
||||
|
||||
@@ -158,7 +158,7 @@ public:
|
||||
cameraPtr->trigger();
|
||||
double rangeData1 = cameraPtr->getCameraValue();
|
||||
}
|
||||
for (int i = 0; i < 100; i++)
|
||||
for (int i = 0; i < 70; i++)
|
||||
{
|
||||
cameraPtr->trigger();
|
||||
double rangeData1 = cameraPtr->getCameraValue();
|
||||
@@ -228,7 +228,7 @@ public:
|
||||
//拍照并检测 300
|
||||
void captureImageAndDetection(QByteArray& byteArray)
|
||||
{
|
||||
detMutex.lock();
|
||||
//detMutex.lock();
|
||||
_lightSourceManager.getLightSourcePtr("COM9")->setValue(lightSourceChannel::DChannel, 255);
|
||||
QThread::msleep(2000);//延时等待机械臂停稳
|
||||
_triggerManager.sendFinsMsg("write_short_300_0");//触发信号清零
|
||||
@@ -253,7 +253,7 @@ public:
|
||||
|
||||
QThread::msleep(1000);//延时一秒完成拍照,后续改成拍完直接发送
|
||||
_triggerManager.sendFinsMsg("write_short_302_1");//开始检测信号
|
||||
detMutex.unlock();
|
||||
//detMutex.unlock();
|
||||
}
|
||||
//机械臂状态切换 361 1 空闲
|
||||
void detectionSwitch1(QByteArray& byteArray)
|
||||
@@ -282,14 +282,7 @@ public:
|
||||
{
|
||||
_simpleSiemensTcp.writeDM100FALSE();
|
||||
_lightSourceManager.getLightSourcePtr("COM9")->setValue(lightSourceChannel::DChannel, 0);
|
||||
int currentProductIndex = _core._appConfig._switchProductWidgetDataPtr.currentProductIndex;
|
||||
if (currentBack == true)
|
||||
currentBack = false;
|
||||
else if (_core._appConfig.productDatas[currentProductIndex].isBackExist == true)
|
||||
{
|
||||
backArmIndex = _core._appConfig.productDatas[currentProductIndex].backArmIndex;
|
||||
emit emit _core._qtFunc.uiModuleBackContinueDetDialog_show();
|
||||
}
|
||||
bool result = true;
|
||||
if (armIsRunning == true)
|
||||
{
|
||||
armIsRunning = false;
|
||||
@@ -304,7 +297,6 @@ public:
|
||||
|
||||
//先查询数据库
|
||||
auto sqlData = _core._appConfig._sqlManager.selectRowData(currentSn);
|
||||
bool result = true;
|
||||
if (sqlData.rowDatas.size() > 1)
|
||||
for (auto data : sqlData.rowDatas[0])
|
||||
if (!data.key.compare("detResult"))
|
||||
@@ -330,12 +322,24 @@ public:
|
||||
}
|
||||
std::cout << "detprocess runEnd" << std::endl;
|
||||
}
|
||||
|
||||
//是否继续运行背面检测
|
||||
int currentProductIndex = _core._appConfig._switchProductWidgetDataPtr.currentProductIndex;
|
||||
if (currentBack == true)
|
||||
currentBack = false;
|
||||
else if (_core._appConfig.productDatas[currentProductIndex].isBackExist == true && result == true)
|
||||
{
|
||||
backArmIndex = _core._appConfig.productDatas[currentProductIndex].backArmIndex;
|
||||
emit _core._qtFunc.uiModuleBackContinueDetDialog_show();
|
||||
emit _core._qtFunc.uiModulestartDetBtn_disable();
|
||||
}
|
||||
}
|
||||
//校准结果处理
|
||||
void correctionResultHandle(std::shared_ptr<detData>data)
|
||||
{
|
||||
lastPointsOffsetStruct_ = data->pointsOffsetStruct_;
|
||||
//写入plc
|
||||
for (auto writeBackStr : data->writeBackData)
|
||||
_triggerManager.sendFinsMsg(writeBackStr);
|
||||
}
|
||||
//检测结果处理
|
||||
void detectionResultHandle(std::shared_ptr<detData>data)
|
||||
@@ -384,9 +388,9 @@ public:
|
||||
emit _core._qtFunc.uiModuleImageDoubleCheckQdialog_ShowWindows(pack);
|
||||
pack.type = 2;
|
||||
}
|
||||
|
||||
if(data->halconOK == true)
|
||||
emit _core._qtFunc.addDashBoardData(0, data->halconOK);
|
||||
|
||||
else if (data->resultImgs.size() >= 2)
|
||||
{
|
||||
imageDoubleCheckPack pack;
|
||||
@@ -398,13 +402,12 @@ public:
|
||||
if (finalOk == true)
|
||||
emit _core._qtFunc.uiModuleLocationMap_SetProductSignStatus(data->armPos,2);
|
||||
|
||||
auto productData = _core._productDataCache.get(currentSn);
|
||||
if (finalOk == false)
|
||||
productData->ngCount++;
|
||||
|
||||
perConnector _perConnectorData;
|
||||
_perConnectorData.aiOk = data->aiDetOK;
|
||||
_perConnectorData.halconOk = data->halconOK;
|
||||
_perConnectorData.maxPinDetValue = data->maxPinDetValue;
|
||||
auto productData = _core._productDataCache.get(currentSn);
|
||||
productData->connectorResults.push_back(_perConnectorData);
|
||||
data->sqlVec.push_back({ "Result",std::to_string(finalOk)});
|
||||
}
|
||||
@@ -477,6 +480,7 @@ public slots:
|
||||
currentSn = SN.toStdString();
|
||||
_triggerManager.sendFinsMsg("write_short_350_" + QString::number(_core._appConfig.productDatas[productTypeIn].indexOfArm));
|
||||
_triggerManager.sendFinsMsg("write_short_351_1");
|
||||
qDebug() << "SN:" << SN << "开始运行,型号->" << QString::fromStdString(_core._detGlobalData.productTypeStr);
|
||||
}
|
||||
//人工复判按下NG
|
||||
void uiModuleImageDoubleCheckQdialog_pressNG(int armPos,int type)//1 halcon 2ai
|
||||
@@ -486,8 +490,11 @@ public slots:
|
||||
else if (type == 2)
|
||||
emit _core._qtFunc.addDashBoardData(1, false);
|
||||
emit _core._qtFunc.uiModuleLocationMap_SetProductSignStatus(armPos, 3);
|
||||
emit _core._qtFunc.uiModulestartDetBtn_enable();
|
||||
_triggerManager.sendFinsMsg("write_short_363_1");
|
||||
detMutex.unlock();
|
||||
auto productData = _core._productDataCache.get(currentSn);
|
||||
productData->ngCount++;
|
||||
//detMutex.unlock();
|
||||
}
|
||||
//人工复判按下OK
|
||||
void uiModuleImageDoubleCheckQdialog_pressOK(int armPos, int type)//1 halcon 2ai
|
||||
@@ -497,7 +504,8 @@ public slots:
|
||||
else if (type == 2)
|
||||
emit _core._qtFunc.addDashBoardData(1, true);
|
||||
emit _core._qtFunc.uiModuleLocationMap_SetProductSignStatus(armPos, 2);
|
||||
detMutex.unlock();
|
||||
emit _core._qtFunc.uiModulestartDetBtn_enable();
|
||||
//detMutex.unlock();
|
||||
}
|
||||
};
|
||||
#pragma once
|
||||
@@ -121,6 +121,11 @@ void connectSignalAndSlots(MainWindow* front, appCore* _core, detProcess* _detPr
|
||||
QObject::connect(&_core->_qtFunc, &qtFunction::uiModuleSummaryDataManager_Reset,
|
||||
front, [=]() {front->_displayWidget->_summaryDataManager->resetAllValue(); });
|
||||
|
||||
QObject::connect(&_core->_qtFunc, &qtFunction::uiModulestartDetBtn_disable,
|
||||
front, [=]() {front->_displayWidget->_switchProductWidget->startBtn->setDisabled(true); });
|
||||
QObject::connect(&_core->_qtFunc, &qtFunction::uiModulestartDetBtn_enable,
|
||||
front, [=]() {front->_displayWidget->_switchProductWidget->startBtn->setEnabled(true); });
|
||||
|
||||
QObject::connect(&_core->_qtFunc, &qtFunction::uiModuleBackContinueDetDialog_show,
|
||||
front, [=]() {front->_backContinueDetDialog->show(); });
|
||||
QObject::connect(&_core->_qtFunc, &qtFunction::uiModuleBackContinueDetDialog_hide,
|
||||
|
||||
@@ -17,6 +17,7 @@ public:
|
||||
};
|
||||
QPushButton* closeBtn = new QPushButton(this);
|
||||
fancyButtonText* continueBtn = new fancyButtonText(120,60,"继续","继续");
|
||||
fancyButtonText* cancelBtn = new fancyButtonText(120, 60, "取消", "取消");
|
||||
fancyWarnWindow(type typeIn,QString title,QString detail,bool Show)
|
||||
{
|
||||
QPalette paletteWhite, paletteRed, paletteGreen;
|
||||
@@ -110,9 +111,11 @@ public:
|
||||
|
||||
QHBoxLayout* funcBtnLayout = new QHBoxLayout();
|
||||
funcBtnLayout->addWidget(continueBtn, 3, 0);
|
||||
funcBtnLayout->addWidget(cancelBtn, 3, 0);
|
||||
layout->addLayout(funcBtnLayout, 3, 0);
|
||||
|
||||
QObject::connect(continueBtn, &QPushButton::clicked, this, &QDialog::close);
|
||||
QObject::connect(cancelBtn, &QPushButton::clicked, this, &QDialog::close);
|
||||
this->setWindowFlags(this->windowFlags() | Qt::WindowStaysOnTopHint);
|
||||
if (Show == true)
|
||||
this->show();
|
||||
|
||||
@@ -14,18 +14,24 @@ public:
|
||||
_fancyWarnWindow = new fancyWarnWindow(fancyWarnWindow::tip, "是否继续背面检测", "", false);
|
||||
_fancyWarnWindow->disableHideAfterClicked();
|
||||
_fancyWarnWindow->hide();
|
||||
_fancyWarnWindow->closeBtn->hide();
|
||||
QObject::connect(_fancyWarnWindow->continueBtn, &QPushButton::clicked, this, &backContinueDetDialog::continueClicked);
|
||||
|
||||
QObject::connect(_fancyWarnWindow->cancelBtn, &QPushButton::clicked, this, &backContinueDetDialog::cancelClicked);
|
||||
}
|
||||
private:
|
||||
|
||||
public slots:
|
||||
void cancelClicked()
|
||||
{
|
||||
qDebug() << "点击了取消检测背面";
|
||||
}
|
||||
void continueClicked()
|
||||
{
|
||||
timer->start(10000);
|
||||
emit continueClickedSignal();
|
||||
_fancyWarnWindow->continueBtn->setDisabled(true);
|
||||
QObject::connect(timer, &QTimer::timeout, this, [=]() {_fancyWarnWindow->continueBtn->setEnabled(true); });
|
||||
qDebug() << "点击运行背面";
|
||||
}
|
||||
void show()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user