This commit is contained in:
2024-06-25 17:05:18 +08:00
parent 47a515e893
commit 5cc10dd7ba
15 changed files with 302 additions and 43 deletions
+103
View File
@@ -0,0 +1,103 @@
QObject::startTimer: Timers can only be used with threads started with QThread
Could not open the file -
Could not open the file - .//config//communicateConfig
Could not open the file -
Could not open the file -
Could not open the file -
init IP:192.168.1.200 Host:502 Sta:100007FFC4E324370SQL runing Init...
sleepname:sleeptime sleepvalue:20 readname:readnum readvalue:300 write_type:writetype write_value:ushort m_host:50200007FFC4E324370CreatePtr
[2024-06-25 16:35:45.397] [Info] [DetModule] GPU: NVIDIA GeForce RTX 3090
[2024-06-25 16:35:45.398] [Info] [ClsModule] GPU: NVIDIA GeForce RTX 3090
[2024-06-25 16:35:45.399] [Info] [DetModule] GPU: NVIDIA GeForce RTX 3090
[2024-06-25 16:35:45.399] [Info] [SegModule] GPU: NVIDIA GeForce RTX 3090
[2024-06-25 16:35:45.399] [Info] HanddleAI4.1-cls
[2024-06-25 16:35:45.399] [Info] HanddleAI4.1-seg
SQL init end
[2024-06-25 16:35:45.833] [Info] [SegModule] ./HandleAiModels/ASR-Seg.BHD has been successfully loaded.
[2024-06-25 16:35:45.848] [Info] [SegModule] runtime batch size is 1
[2024-06-25 16:35:45.848] [Info] [SegModule] seg model init success.
[2024-06-25 16:35:46.554] [Info] [ClsModule] ./HandleAiModels/ASR-Cls.BHD has been successfully loaded.
[2024-06-25 16:35:46.554] [Info] [DetModule] ./HandleAiModels/connectorDet.BHD has been successfully loaded.
[2024-06-25 16:35:46.555] [Info] [ClsModule] runtime batch size is 1
[2024-06-25 16:35:46.556] [Info] [ClsModule] cls model init success.
[2024-06-25 16:35:46.568] [Info] [DetModule] det model init success.
Range Message batch count: 1
pointZ:-73.686600
Range Message batch count: 1
pointZ:-73.686600
Range Message batch count: 1
pointZ:-73.694400
jiaozhun xValue:462.22 yValue:-427.5 zValue:108.17 rangeData:-73.6892
Range Message batch count: 1
pointZ:-76.416600
Range Message batch count: 1
pointZ:-76.416600
Range Message batch count: 1
pointZ:-76.389300
jiaozhun xValue:462.22 yValue:-427.5 zValue:108.17 rangeData:-76.4075
Range Message batch count: 1
pointZ:-75.652200
Range Message batch count: 1
pointZ:-75.648300
Range Message batch count: 1
pointZ:-75.648300
jiaozhun xValue:462.22 yValue:-427.5 zValue:108.17 rangeData:-75.6496
Range Message batch count: 1
pointZ:-61.713600
Range Message batch count: 1
pointZ:-61.721400
Range Message batch count: 1
pointZ:-61.713600
jiaozhun xValue:462.22 yValue:-427.5 zValue:108.17 rangeData:-61.7162
Range Message batch count: 1
pointZ:-61.928100
Range Message batch count: 1
pointZ:-61.928100
Range Message batch count: 1
pointZ:-61.932000
jiaozhun xValue:462.22 yValue:-427.5 zValue:108.17 rangeData:-61.9294
Range Message batch count: 1
pointZ:-67.158000
Range Message batch count: 1
pointZ:-67.158000
Range Message batch count: 1
pointZ:-67.158000
jiaozhun xValue:462.22 yValue:-427.5 zValue:108.17 rangeData:-67.158
Range Message batch count: 1
pointZ:16.068000
Range Message batch count: 1
pointZ:16.056300
Range Message batch count: 1
pointZ:16.064100
jiaozhun xValue:462.22 yValue:-427.5 zValue:108.17 rangeData:16.0628
Range Message batch count: 1
pointZ:15.982200
Range Message batch count: 1
pointZ:15.993900
Range Message batch count: 1
pointZ:15.986100
jiaozhun xValue:462.22 yValue:-427.5 zValue:108.17 rangeData:15.9874
Range Message batch count: 1
pointZ:14.874600
Range Message batch count: 1
pointZ:14.874600
Range Message batch count: 1
pointZ:14.878500
jiaozhun xValue:462.22 yValue:-427.5 zValue:108.17 rangeData:14.8759
error修改数组为空
arm @Pos:1修改数组为空
arm @Pos:2修改数组为空
arm @Pos:3修改数组为空
arm @Pos:4修改数组为空
arm @Pos:5修改数组为空
arm @Pos:6修改数组为空
arm @Pos:7修改数组为空
arm @Pos:8修改数组为空
arm @Pos:9修改数组为空
arm @Pos:10修改数组为空
arm @Pos:11修改数组为空
arm @Pos:12修改数组为空
D:\ciscoAoiUi\bin\HandleAiUi-new.exe (进程 18796)已退出,代码为 -1。
要在调试停止时自动关闭控制台,请启用“工具”->“选项”->“调试”->“调试停止时自动关闭控制台”。
按任意键关闭此窗口. . .
+87
View File
@@ -0,0 +1,87 @@
QObject::startTimer: Timers can only be used with threads started with QThread
Could not open the file -
Could not open the file - .//config//communicateConfig
Could not open the file -
Could not open the file -
Could not open the file -
init IP:192.168.1.200 Host:502 Sta:100007FFC4D414370sleepname:SQL runing Init...
sleeptime sleepvalue:20 readname:readnum readvalue:300 write_type:writetype write_value:ushort m_host:50200007FFC4D414370CreatePtr
[2024-06-25 16:18:33.468] [Info] [DetModule] GPU: NVIDIA GeForce RTX 3090
[2024-06-25 16:18:33.469] [Info] [DetModule] GPU: NVIDIA GeForce RTX 3090
[2024-06-25 16:18:33.469] [Info] [ClsModule] GPU: NVIDIA GeForce RTX 3090
[2024-06-25 16:18:33.469] [Info] [SegModule] GPU: NVIDIA GeForce RTX 3090
[2024-06-25 16:18:33.469] [Info] HanddleAI4.1-cls
[2024-06-25 16:18:33.469] [Info] HanddleAI4.1-seg
SQL init end
[2024-06-25 16:18:33.933] [Info] [SegModule] ./HandleAiModels/ASR-Seg.BHD has been successfully loaded.
[2024-06-25 16:18:33.952] [Info] [SegModule] runtime batch size is 1
[2024-06-25 16:18:33.953] [Info] [SegModule] seg model init success.
[2024-06-25 16:18:34.655] [Info] [ClsModule] ./HandleAiModels/ASR-Cls.BHD has been successfully loaded.
[2024-06-25 16:18:34.656] [Info] [DetModule] ./HandleAiModels/connectorDet.BHD has been successfully loaded.
[2024-06-25 16:18:34.657] [Info] [ClsModule] runtime batch size is 1
[2024-06-25 16:18:34.657] [Info] [ClsModule] cls model init success.
[2024-06-25 16:18:34.677] [Info] [DetModule] det model init success.
Range Message batch count: 1
pointZ:-73.710000
Range Message batch count: 1
pointZ:-73.710000
Range Message batch count: 1
pointZ:-73.706100
jiaozhun xValue:462.22 yValue:-427.5 zValue:108.17 rangeData:-73.7087
Range Message batch count: 1
pointZ:-76.385400
Range Message batch count: 1
pointZ:-76.401000
Range Message batch count: 1
pointZ:-76.393200
jiaozhun xValue:462.22 yValue:-427.5 zValue:108.17 rangeData:-76.3932
Range Message batch count: 1
pointZ:-75.679500
Range Message batch count: 1
pointZ:-75.656100
Range Message batch count: 1
pointZ:-75.667800
jiaozhun xValue:462.22 yValue:-427.5 zValue:108.17 rangeData:-75.6678
Range Message batch count: 1
pointZ:-61.701900
Range Message batch count: 1
pointZ:-61.694100
Range Message batch count: 1
pointZ:-61.686300
jiaozhun xValue:462.22 yValue:-427.5 zValue:108.17 rangeData:-61.6941
Range Message batch count: 1
pointZ:-61.951500
Range Message batch count: 1
pointZ:-61.951500
Range Message batch count: 1
pointZ:-61.955400
jiaozhun xValue:462.22 yValue:-427.5 zValue:108.17 rangeData:-61.9528
Range Message batch count: 1
pointZ:-67.169700
Range Message batch count: 1
pointZ:-67.161900
Range Message batch count: 1
pointZ:-67.158000
jiaozhun xValue:462.22 yValue:-427.5 zValue:108.17 rangeData:-67.1632
Range Message batch count: 1
pointZ:16.130400
Range Message batch count: 1
pointZ:16.161600
Range Message batch count: 1
pointZ:16.157700
jiaozhun xValue:462.22 yValue:-427.5 zValue:108.17 rangeData:16.1499
Range Message batch count: 1
pointZ:15.954900
Range Message batch count: 1
pointZ:15.939300
Range Message batch count: 1
pointZ:15.931500
jiaozhun xValue:462.22 yValue:-427.5 zValue:108.17 rangeData:15.9419
Range Message batch count: 1
pointZ:14.894100
Range Message batch count: 1
pointZ:14.905800
Range Message batch count: 1
pointZ:14.894100
jiaozhun xValue:462.22 yValue:-427.5 zValue:108.17 rangeData:14.898
errorox:
@@ -1,6 +1,7 @@
#include <FrontendBackendBridge.h>
#include <uiModule/uiModule_switchProduct.h>
#include <appConfig/appConfig.hpp>
#include <lightSource.hpp>
fbBridge bridge;
//INIT
backEnd::backEnd(QObject* parent)
@@ -9,27 +10,6 @@ backEnd::backEnd(QObject* parent)
}
void backEnd::Init()
{
//
for (auto data : json.LightSources.LightSourceList)
{
//QSerialPort* serialPort = new QSerialPort;//밟都눔왯
////serialPort->clear();
//serialPort->close();
//serialPort->setPortName(data.comPort);
//serialPort->open(QIODevice::ReadWrite);
//serialPort->setBaudRate(data.baudRate);
//serialPort->setDataBits(QSerialPort::Data8);
//serialPort->setParity(QSerialPort::NoParity);
//serialPort->setStopBits(QSerialPort::OneStop);
//serialPort->setFlowControl(QSerialPort::NoFlowControl);
//serialPort->write(data.initStr.toUtf8());
//serialPort->waitForBytesWritten();
//if (serialPort->isOpen() != true)
// qDebug() << data.comPort << "open failure!!";
//QSerialPorts.append(serialPort);
//QSerialPortsName.append(data.name);
}
}
@@ -8,6 +8,7 @@
#include <appConfig/jsonParsing.h>
#include <qmutex.h>
#include <uiModule/uiModule_tableView.h>
#include <lightSource.hpp>
//数据指针
struct productDataStruct;
class appConfig;
@@ -61,6 +62,7 @@ public:
{
}
lightSourceManager _lightSourceManager;
appConfig* _appConfig = nullptr;
private:
@@ -306,7 +306,11 @@ void ALGO_Correction(std::shared_ptr <detData> data)
return;
CorrectionPoints resultPoints;
HalconCorrection(data->correctionData, resultPoints);
if (HalconCorrection(data->correctionData, resultPoints) == false)
{
data->writeBack("short", 274, "1");
return;
}
Point3d point = getRPY(resultPoints);
std::cout << "ox:" << resultPoints.Origin[0] << "oy:" << resultPoints.Origin[1] << "oz:" << resultPoints.Origin[2] << std::endl;
@@ -5,7 +5,7 @@
#include <algo/simpleAlgo.h>
cv::Mat pinHandleAiEvaluate(std::shared_ptr <detData> data, cv::Mat& src,
handleAiModelSeg* segPtr, handleAiModelCls* clsPtr);
bool pinHalconEvaluate(cv::Rect& Result, cv::Mat& src, cv::Mat& out, int productType);
bool pinHalconEvaluate(std::shared_ptr <detData> data, cv::Rect& Result, cv::Mat& src, cv::Mat& out, int productType);
//公头定位
std::vector<handdleAI::Bbox> pinDetEvaluate(std::shared_ptr <detData> data ,cv::Mat& src, handleAiModelManager* _handleAiModelManager)
@@ -44,12 +44,12 @@ void halconEvaluate(std::shared_ptr <detData> data, std::vector<handdleAI::Bbox>
for (auto& box : connectorPos)
{
cv::Mat halconMatResult;
bool halconBoolResult = pinHalconEvaluate(BboxToRect(box), src, halconMatResult, box.classes);
bool halconBoolResult = pinHalconEvaluate(data,BboxToRect(box), src, halconMatResult, box.classes);
if (halconBoolResult == true)
halconImgResult.push_back(halconMatResult);//HALCON检测结果
}
}
bool pinHalconEvaluate(cv::Rect& Result, cv::Mat& src,cv::Mat& out,int productType)
bool pinHalconEvaluate(std::shared_ptr <detData> data, cv::Rect& Result, cv::Mat& src,cv::Mat& out,int productType)
{
#pragma region halcon变量定义
//测量
@@ -107,6 +107,8 @@ bool pinHalconEvaluate(cv::Rect& Result, cv::Mat& src,cv::Mat& out,int productTy
out = HObject2Mat(hv_out_Img_INS);
return true;
}
if (hv_out_Pings_X.Length() > 0)
data->halconOK = false;
out = HObject2Mat(hv_out_Img_INS);
return false;
//Pings_ROI(ho_in_Image, hv_in_ShapePath, hv_in_Parameter, &hv_out_ROI_Value, &hv_out_Flag_ROI);
@@ -160,9 +162,11 @@ cv::Mat pinHandleAiEvaluate(std::shared_ptr <detData> data, cv::Mat& src,
case 1:
color = cv::Scalar(0, 0, 255, 30);
clsFileName = "NG1";
data->aiDetOK = false;
break;
default:
clsFileName = std::to_string(clsRes);
data->aiDetOK = false;
}
data->clsOriginImgs.push_back(std::make_pair(clsFileName, clsImg));
cv::rectangle(Paint, originRect, color, 2);
@@ -93,7 +93,7 @@ void backEndManager::writeArmStartSignal(int productTypeIn)
_appConfig->productDatasMutex.lock();
productTypeStr = _appConfig->productDatas[productTypeIn].name;
_appConfig->productDatasMutex.unlock();
productType = productTypeIn;
_triggerManager->sendFinsMsg("write_short_350_"+QString::number(productTypeIn));
productType = _appConfig->productDatas[productTypeIn].indexOfArm;
_triggerManager->sendFinsMsg("write_short_350_"+QString::number(productType));
_triggerManager->sendFinsMsg("write_short_351_1");
}
+2 -2
View File
@@ -68,8 +68,8 @@ public:
}
productDataStruct _productDataStruct;
//结果
bool aiDetOK = false;
bool halconOK = false;
bool aiDetOK = true;
bool halconOK = true;
//存图相关
QMutex resultMutex;//结果图锁
std::vector<cv::Mat> resultImgs;//结果图
@@ -0,0 +1,74 @@
#include <qserialport.h>
#include <unordered_map>
enum lightSourceChannel
{
AChannel, BChannel, CChannel, DChannel
};
class lightSource
{
public:
QSerialPort* serialPort = new QSerialPort();
lightSource(std::string comName, int baudRate, std::string initStr)
{
serialPort->close();
serialPort->setPortName(QString::fromStdString(comName));
serialPort->open(QIODevice::ReadWrite);
serialPort->setBaudRate(baudRate);
serialPort->setDataBits(QSerialPort::Data8);
serialPort->setParity(QSerialPort::NoParity);
serialPort->setStopBits(QSerialPort::OneStop);
serialPort->setFlowControl(QSerialPort::NoFlowControl);
serialPort->write(initStr.c_str());
serialPort->waitForBytesWritten();
if (serialPort->isOpen() != true)
qDebug() << comName.c_str() << "open failure!!";
}
void setValue(lightSourceChannel channelIn,unsigned char value)
{
std::string controlStr;
switch (channelIn)
{
case lightSourceChannel::AChannel:
controlStr = "SA0";
break;
case lightSourceChannel::BChannel:
controlStr = "SB0";
break;
case lightSourceChannel::CChannel:
controlStr = "SC0";
break;
case lightSourceChannel::DChannel:
controlStr = "SD0";
break;
}
std::string valueStr = std::to_string(value);
if (valueStr.length() < 3)
for (int i = 0; i < 3 - valueStr.length(); i++)
controlStr += "0";
controlStr += valueStr + "#";
serialPort->write(controlStr.c_str());
serialPort->waitForBytesWritten();
}
};
class lightSourceManager
{
public:
lightSourceManager()
{
insertLightSource("COM8", 19200, "SA0000#SB0000#SC0000#SD0000#");
}
std::unordered_map<std::string, lightSource*>lightSources;
void insertLightSource(std::string comName ,int baudRate,std::string initStr)
{
lightSource* newLigthSource = new lightSource(comName, baudRate, initStr);
lightSources.insert(std::make_pair(comName, newLigthSource));
}
lightSource* getLightSourcePtr(std::string comName)
{
auto ptr = lightSources.find(comName);
if (ptr != lightSources.end())
return ptr->second;
return nullptr;
}
};
#pragma once
@@ -109,7 +109,7 @@ void threadManager::resultHandle(std::shared_ptr <detData> data)
cnt++;
}
}
emit _backEndManager->addDashBoardData(0, data->aiDetOK);
emit _backEndManager->addDashBoardData(1, data->aiDetOK);
emit _backEndManager->addDashBoardData(0, data->halconOK);
//SQL
std::vector<sqlData> sqlDatas;
@@ -295,11 +295,9 @@ void triggerManager::decodeCameraCMD(QByteArray byte)
correctionData->in_Z_Y0Z.push_back(zValue);
correctionData->in_X_Y0Z_Value.push_back(rangeData);
}
sendFinsMsg("write_short_261_0");//清零
sendFinsMsg("write_short_262_1");
sendFinsMsg("write_short_263_1");
//上位机校正完成,将寄存器274置为1,并将结果按照定义XYZ规则放入310~336中
if (armPos == 9)
{
@@ -317,6 +315,7 @@ void triggerManager::decodeCameraCMD(QByteArray byte)
if (checkTrigger(300, 1, byte) == true)
{
bridge._lightSourceManager.getLightSourcePtr("COM8")->setValue(lightSourceChannel::DChannel, 255);
QThread::msleep(1500);//延时一秒等待机械臂停稳
sendFinsMsg("write_short_300_0");//触发信号清零
sendFinsMsg("write_short_301_1");//开始检测信号
@@ -339,6 +338,7 @@ void triggerManager::decodeCameraCMD(QByteArray byte)
QThread::msleep(1000);//延时一秒完成拍照,后续改成拍完直接发送
sendFinsMsg("write_short_302_1");//开始检测信号
bridge._lightSourceManager.getLightSourcePtr("COM8")->setValue(lightSourceChannel::DChannel, 0);
}
if (checkTrigger(361, 1, byte) == true && armIsRunning == false)
+2 -2
View File
@@ -17,8 +17,8 @@
#define sColor_Black "22, 22, 22"
#define sColor_BlackWithWhite "45, 45, 45"
#define enableHandleAiModel 0
#define disableBackEndCheck 1
#define enableHandleAiModel 1
#define disableBackEndCheck 0
#define disableeAlgo 0
//窗口设置
+1
View File
@@ -59,6 +59,7 @@ MainWindow::MainWindow(appConfig* appData, QWidget* parent)
showMaximized();
QObject::connect(_loadingWidget.manualBtn, &QPushButton::clicked, this, &MainWindow::switchToManulMode);
//addDashBoardData(0, false);
}
MainWindow::~MainWindow()
@@ -3,7 +3,7 @@
class DashboardWidget : public QWidget {
public:
DashboardWidget(QWidget *parent = nullptr) : QWidget(parent) {
currentValue = 0;
currentValue = 0;//NG占比
showText = "100%";
setMinimumSize(80, 80);
setMaximumSize(100, 100);
@@ -16,13 +16,13 @@ public:
update();
}
}
void setCurrentValue(int value) {
if (value != currentValue) {
currentValue = value;
showText = QString::number((360-value)/360)+ "%";
update();
}
}
//void setCurrentValue(int value) {
// if (value != currentValue) {
// currentValue = value;
// showText = QString::number((360-value)/360)+ "%";
// update();
// }
//}
protected:
void paintEvent(QPaintEvent* event) override {
@@ -103,8 +103,12 @@ public:
totalLabel->setText(QString::number(OKCount + NGCount));
if(OKCount + NGCount == 0)
dashBoard->setCurrentPercentage(0);
else if (NGCount == 0 && OKCount > 0)
dashBoard->setCurrentPercentage(0);
else if (OKCount == 0 && NGCount > 0)
dashBoard->setCurrentPercentage(100);
else
dashBoard->setCurrentPercentage(((OKCount * 100) / ((OKCount + NGCount))));
dashBoard->setCurrentPercentage(((NGCount * 100) / ((OKCount + NGCount))));
}
};