front back det added
This commit is contained in:
Binary file not shown.
@@ -34,7 +34,7 @@ std::vector<handdleAI::Bbox> getpinHandleAiEvaluateRect(std::shared_ptr <detData
|
|||||||
int avgWidth = totalWidth / detResult.size();
|
int avgWidth = totalWidth / detResult.size();
|
||||||
|
|
||||||
cv::Point centerPos(src.rows / 2, src.cols / 2);
|
cv::Point centerPos(src.rows / 2, src.cols / 2);
|
||||||
cv::Rect targetRect(src.cols / 3, src.rows / 3, src.cols / 3, src.rows / 3);
|
cv::Rect targetRect(src.cols / 4, src.rows / 4, src.cols / 2, src.rows / 2);
|
||||||
for (auto detData : detResult)
|
for (auto detData : detResult)
|
||||||
{
|
{
|
||||||
if ((detData.x< targetRect.x || detData.x > targetRect.x + targetRect.width ||
|
if ((detData.x< targetRect.x || detData.x > targetRect.x + targetRect.width ||
|
||||||
|
|||||||
@@ -87,6 +87,7 @@ public:
|
|||||||
manualDetThread _manualDetThread;//手动触发线程
|
manualDetThread _manualDetThread;//手动触发线程
|
||||||
|
|
||||||
///////////////////////////////
|
///////////////////////////////
|
||||||
|
bool startDet = false;
|
||||||
QMutex detMutex;
|
QMutex detMutex;
|
||||||
std::string currentSn;
|
std::string currentSn;
|
||||||
void detProcessCallbackRegister()
|
void detProcessCallbackRegister()
|
||||||
@@ -97,7 +98,8 @@ public:
|
|||||||
_triggerManager.registerCallback(361, 1, [this](QByteArray& byteArray) {detectionSwitch1(byteArray); }, "检测开始");
|
_triggerManager.registerCallback(361, 1, [this](QByteArray& byteArray) {detectionSwitch1(byteArray); }, "检测开始");
|
||||||
_triggerManager.registerCallback(361, 2, [this](QByteArray& byteArray) {detectionSwitch2(byteArray); }, "检测结束1");
|
_triggerManager.registerCallback(361, 2, [this](QByteArray& byteArray) {detectionSwitch2(byteArray); }, "检测结束1");
|
||||||
_triggerManager.registerCallback(362, 1, [this](QByteArray& byteArray) {detectionEnd(byteArray); }, "检测结束2");
|
_triggerManager.registerCallback(362, 1, [this](QByteArray& byteArray) {detectionEnd(byteArray); }, "检测结束2");
|
||||||
|
_triggerManager.registerCallback(364, 1, [this](QByteArray& byteArray) {frontBackDet(); }, "检测正反面");
|
||||||
|
|
||||||
_threadManager.registerCallback([this](std::shared_ptr<detData>data) {correctionResultHandle(data); });
|
_threadManager.registerCallback([this](std::shared_ptr<detData>data) {correctionResultHandle(data); });
|
||||||
_threadManager.registerCallback([this](std::shared_ptr<detData>data) {detectionResultHandle(data); });
|
_threadManager.registerCallback([this](std::shared_ptr<detData>data) {detectionResultHandle(data); });
|
||||||
}
|
}
|
||||||
@@ -228,6 +230,7 @@ public:
|
|||||||
//拍照并检测 300
|
//拍照并检测 300
|
||||||
void captureImageAndDetection(QByteArray& byteArray)
|
void captureImageAndDetection(QByteArray& byteArray)
|
||||||
{
|
{
|
||||||
|
startDet = true;
|
||||||
//detMutex.lock();
|
//detMutex.lock();
|
||||||
_lightSourceManager.getLightSourcePtr("COM9")->setValue(lightSourceChannel::DChannel, 255);
|
_lightSourceManager.getLightSourcePtr("COM9")->setValue(lightSourceChannel::DChannel, 255);
|
||||||
QThread::msleep(2000);//延时等待机械臂停稳
|
QThread::msleep(2000);//延时等待机械臂停稳
|
||||||
@@ -277,7 +280,7 @@ public:
|
|||||||
emit _core._qtFunc.simpleSiemensTcp_Write100True();
|
emit _core._qtFunc.simpleSiemensTcp_Write100True();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//机械臂结束
|
//检测程序结束结束
|
||||||
void detectionEnd(QByteArray& byteArray)
|
void detectionEnd(QByteArray& byteArray)
|
||||||
{
|
{
|
||||||
_simpleSiemensTcp.writeDM100FALSE();
|
_simpleSiemensTcp.writeDM100FALSE();
|
||||||
@@ -326,12 +329,16 @@ public:
|
|||||||
int currentProductIndex = _core._appConfig._switchProductWidgetDataPtr.currentProductIndex;
|
int currentProductIndex = _core._appConfig._switchProductWidgetDataPtr.currentProductIndex;
|
||||||
if (currentBack == true)
|
if (currentBack == true)
|
||||||
currentBack = false;
|
currentBack = false;
|
||||||
else if (_core._appConfig.productDatas[currentProductIndex].isBackExist == true && result == true)
|
else if (
|
||||||
|
_core._appConfig.productDatas[currentProductIndex].isBackExist == true
|
||||||
|
&& result == true
|
||||||
|
&& startDet == true)
|
||||||
{
|
{
|
||||||
backArmIndex = _core._appConfig.productDatas[currentProductIndex].backArmIndex;
|
backArmIndex = _core._appConfig.productDatas[currentProductIndex].backArmIndex;
|
||||||
emit _core._qtFunc.uiModuleBackContinueDetDialog_show();
|
emit _core._qtFunc.uiModuleBackContinueDetDialog_show();
|
||||||
emit _core._qtFunc.uiModulestartDetBtn_disable();
|
emit _core._qtFunc.uiModulestartDetBtn_disable();
|
||||||
}
|
}
|
||||||
|
startDet = false;
|
||||||
}
|
}
|
||||||
//校准结果处理
|
//校准结果处理
|
||||||
void correctionResultHandle(std::shared_ptr<detData>data)
|
void correctionResultHandle(std::shared_ptr<detData>data)
|
||||||
@@ -441,7 +448,30 @@ public:
|
|||||||
detDataManager* dManager = data->dManager;
|
detDataManager* dManager = data->dManager;
|
||||||
data->dManager->deleteDetData(data->timeCode);
|
data->dManager->deleteDetData(data->timeCode);
|
||||||
}
|
}
|
||||||
|
//使用点激光测量检测是否为正面,没数据就是正面
|
||||||
|
void frontBackDet()
|
||||||
|
{
|
||||||
|
_triggerManager.sendFinsMsg("write_short_364_1");
|
||||||
|
auto cameraPtr = _cameraManager.getCamera("181964");
|
||||||
|
if (cameraPtr == nullptr)
|
||||||
|
return;
|
||||||
|
for (int i = 0; i < 10; i++)//弃用
|
||||||
|
{
|
||||||
|
cameraPtr->trigger();
|
||||||
|
cameraPtr->getCameraValue();
|
||||||
|
}
|
||||||
|
for (int i = 0; i < 100; i++)//检测是否有数据
|
||||||
|
{
|
||||||
|
cameraPtr->trigger();
|
||||||
|
if (cameraPtr->getCameraValue() > -100)//有数据 是反面
|
||||||
|
{
|
||||||
|
_triggerManager.sendFinsMsg("write_short_365_2");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
_triggerManager.sendFinsMsg("write_short_365_1");//无数据 是正面
|
||||||
|
//正面反面是否继续检测,在机械臂脚本中决定
|
||||||
|
}
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void runBackDet()
|
void runBackDet()
|
||||||
|
|||||||
@@ -122,9 +122,13 @@ void connectSignalAndSlots(MainWindow* front, appCore* _core, detProcess* _detPr
|
|||||||
front, [=]() {front->_displayWidget->_summaryDataManager->resetAllValue(); });
|
front, [=]() {front->_displayWidget->_summaryDataManager->resetAllValue(); });
|
||||||
|
|
||||||
QObject::connect(&_core->_qtFunc, &qtFunction::uiModulestartDetBtn_disable,
|
QObject::connect(&_core->_qtFunc, &qtFunction::uiModulestartDetBtn_disable,
|
||||||
front, [=]() {front->_displayWidget->_switchProductWidget->startBtn->setDisabled(true); });
|
front, [=]() {front->_displayWidget->_switchProductWidget->startBtn->setDisabled(true);
|
||||||
|
front->_displayWidget->_switchProductWidget->disableTextChange = true;
|
||||||
|
front->_displayWidget->_switchProductWidget->startBtn->setText(" "); });
|
||||||
QObject::connect(&_core->_qtFunc, &qtFunction::uiModulestartDetBtn_enable,
|
QObject::connect(&_core->_qtFunc, &qtFunction::uiModulestartDetBtn_enable,
|
||||||
front, [=]() {front->_displayWidget->_switchProductWidget->startBtn->setEnabled(true); });
|
front, [=]() {front->_displayWidget->_switchProductWidget->startBtn->setEnabled(true);
|
||||||
|
front->_displayWidget->_switchProductWidget->disableTextChange = false;
|
||||||
|
front->_displayWidget->_switchProductWidget->startBtn->setText("运行"); });
|
||||||
|
|
||||||
QObject::connect(&_core->_qtFunc, &qtFunction::uiModuleBackContinueDetDialog_show,
|
QObject::connect(&_core->_qtFunc, &qtFunction::uiModuleBackContinueDetDialog_show,
|
||||||
front, [=]() {front->_backContinueDetDialog->show(); });
|
front, [=]() {front->_backContinueDetDialog->show(); });
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ class switchProductWidget : public QWidget
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
//
|
//
|
||||||
|
bool disableTextChange = false;
|
||||||
QMutex mutex;
|
QMutex mutex;
|
||||||
std::vector<productDataStruct>productDatas;
|
std::vector<productDataStruct>productDatas;
|
||||||
int* currentProductIndexPtr;
|
int* currentProductIndexPtr;
|
||||||
@@ -137,14 +138,16 @@ public slots:
|
|||||||
if (status == true)
|
if (status == true)
|
||||||
{
|
{
|
||||||
startBtn->toDefault();
|
startBtn->toDefault();
|
||||||
startBtn->setText("运行");
|
if(disableTextChange == false)
|
||||||
|
startBtn->setText("运行");
|
||||||
snIntputLine->setDisabled(false);
|
snIntputLine->setDisabled(false);
|
||||||
std::cout << "按下软件运行" << std::endl;
|
std::cout << "按下软件运行" << std::endl;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
startBtn->toRed();
|
startBtn->toRed();
|
||||||
startBtn->setText("急停");
|
if (disableTextChange == false)
|
||||||
|
startBtn->setText("急停");
|
||||||
snIntputLine->setDisabled(true);
|
snIntputLine->setDisabled(true);
|
||||||
std::cout << "按下软件急停" << std::endl;
|
std::cout << "按下软件急停" << std::endl;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user