|
|
|
@ -206,20 +206,11 @@ void CMainWin::INewCameraImage(const QString& camKey, QImage img)
|
|
|
|
AlgResultCallBack func = std::bind(&CMainWin::IEngineResult, this, std::placeholders::_1);
|
|
|
|
AlgResultCallBack func = std::bind(&CMainWin::IEngineResult, this, std::placeholders::_1);
|
|
|
|
m_pDetectorEngine->detectByName(srcMat, solutionName, strMode, func);
|
|
|
|
m_pDetectorEngine->detectByName(srcMat, solutionName, strMode, func);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//算法结果接收
|
|
|
|
//算法结果接收
|
|
|
|
void CMainWin::IVariantMapToUI(const QString& camKey, const QVariantMap& vMap)
|
|
|
|
void CMainWin::IVariantMapToUI(const QString& camKey, const QVariantMap& vMap)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// return;
|
|
|
|
|
|
|
|
// QImage srcImg = vMap.value("srcImage").value<QImage>();
|
|
|
|
|
|
|
|
// cv::Mat srcMat = QImageToMat(srcImg);
|
|
|
|
|
|
|
|
// QString strMode;// = pResult->m_strModel;
|
|
|
|
|
|
|
|
// AlgResultCallBack func = std::bind(&CMainWin::IEngineResult, this, std::placeholders::_1);
|
|
|
|
|
|
|
|
// m_pDetectorEngine->detect(srcMat, strMode, func);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* QVariantMap mMap = vMap.value("algoRlt").toMap();
|
|
|
|
/* QVariantMap mMap = vMap.value("algoRlt").toMap();
|
|
|
|
IStation *pStation = m_pWfCtrl->IGetStationByKey(camKey);
|
|
|
|
IStation *pStation = m_pWfCtrl->IGetStationByKey(camKey);
|
|
|
|
@ -282,10 +273,6 @@ void CMainWin::IVariantMapToUI(const QString& camKey, const QVariantMap& vMap)
|
|
|
|
|
|
|
|
|
|
|
|
QVariant CMainWin::IGetVariantById(int id)
|
|
|
|
QVariant CMainWin::IGetVariantById(int id)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// IStation *pStation = m_pWfCtrl->IGetStationById(id);
|
|
|
|
|
|
|
|
// if (pStation) {
|
|
|
|
|
|
|
|
// return pStation->getVariant();
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
return QVariant();
|
|
|
|
return QVariant();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ -328,13 +315,13 @@ QString CMainWin::genSavePath(QString modelName, QImage &img)
|
|
|
|
Q_SLOT void CMainWin::onAppanalysis(SComFrame frame)
|
|
|
|
Q_SLOT void CMainWin::onAppanalysis(SComFrame frame)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
//数据接收
|
|
|
|
//数据接收
|
|
|
|
/* int nCmd = frame.cmd;
|
|
|
|
int nCmd = frame.cmd;
|
|
|
|
if (0x43 == nCmd)
|
|
|
|
if (0x43 == nCmd)//心跳 型号切换
|
|
|
|
{
|
|
|
|
{
|
|
|
|
onHeartComm(frame);
|
|
|
|
onHeartComm(frame);
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (0x50 == nCmd) {
|
|
|
|
else if (0x50 == nCmd) {//触发相机
|
|
|
|
int nCameraID = -1;
|
|
|
|
int nCameraID = -1;
|
|
|
|
if (5 == frame.data1) {
|
|
|
|
if (5 == frame.data1) {
|
|
|
|
nCameraID = 1;
|
|
|
|
nCameraID = 1;
|
|
|
|
@ -343,28 +330,20 @@ Q_SLOT void CMainWin::onAppanalysis(SComFrame frame)
|
|
|
|
nCameraID = 2;
|
|
|
|
nCameraID = 2;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (!m_pWfCtrl) {
|
|
|
|
if (lpGlobalConfig::instance()->m_bOnlineMode == true)//是PLC控制台切换型号模式 进入型号判断
|
|
|
|
qDebug() << "CommAchieved m_pWfCtrl is null";
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
IStation *pStation = m_pWfCtrl->IGetStationById(nCameraID);
|
|
|
|
|
|
|
|
if (!pStation) {
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (m_pWfCtrl->IOnlineMode() == true)
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (nCameraID == 1)
|
|
|
|
if (nCameraID == 1)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (m_StationInfo_1.m_bRunEnable == true)
|
|
|
|
if (m_StationInfo_1.m_bRunEnable == true)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
pStation->trigImage();
|
|
|
|
QString strCam = lpGlobalConfig::instance()->m_StationCamKey_1;
|
|
|
|
|
|
|
|
m_pCoreCtrl->ISnapImage(QStringList() << strCam);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
else {
|
|
|
|
QString strMsg = QString("%1:该型号ID:%2在模型库中不存在,不能拍照!!!").arg(QTime::currentTime().toString("hh:mm:ss zzz:")).arg(m_StationInfo_1.m_PLCID);
|
|
|
|
QString strMsg = QString("%1:该型号ID:%2在模型库中不存在,不能拍照!!!").arg(QTime::currentTime().toString("hh:mm:ss zzz:")).arg(m_StationInfo_1.m_PLCID);
|
|
|
|
emit sgShowLog(1, strMsg);
|
|
|
|
emit sgShowLog(1, strMsg);
|
|
|
|
if (m_StationInfo_1.m_PLCID > 0) {
|
|
|
|
if (m_StationInfo_1.m_PLCID > 0) {
|
|
|
|
pStation->setSerialPortPtr(m_pSerialPort);
|
|
|
|
sendResult(1, 999, 0, 0);
|
|
|
|
pStation->sendResult(999);
|
|
|
|
|
|
|
|
SYSLOG_STATUS << QString("●工位%1:收到触发信号,因索引不合法所以没触发相机拍照,发送了999角度数据,型号为[%2],型号索引ID为[%3],时间:%4")
|
|
|
|
SYSLOG_STATUS << QString("●工位%1:收到触发信号,因索引不合法所以没触发相机拍照,发送了999角度数据,型号为[%2],型号索引ID为[%3],时间:%4")
|
|
|
|
.arg(nCameraID)
|
|
|
|
.arg(nCameraID)
|
|
|
|
.arg(m_StationInfo_1.strModelName.isEmpty() == true ? "空" : m_StationInfo_1.strModelName)
|
|
|
|
.arg(m_StationInfo_1.strModelName.isEmpty() == true ? "空" : m_StationInfo_1.strModelName)
|
|
|
|
@ -384,15 +363,15 @@ Q_SLOT void CMainWin::onAppanalysis(SComFrame frame)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (m_StationInfo_2.m_bRunEnable == true)
|
|
|
|
if (m_StationInfo_2.m_bRunEnable == true)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
pStation->trigImage();
|
|
|
|
QString strCam = lpGlobalConfig::instance()->m_StationCamKey_2;
|
|
|
|
|
|
|
|
m_pCoreCtrl->ISnapImage(QStringList() << strCam);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
|
{
|
|
|
|
{
|
|
|
|
QString strMsg = QString("%1:该型号ID:%2在模型库中不存在,不能拍照!!!").arg(QTime::currentTime().toString("hh:mm:ss zzz:")).arg(m_StationInfo_2.m_PLCID);
|
|
|
|
QString strMsg = QString("%1:该型号ID:%2在模型库中不存在,不能拍照!!!").arg(QTime::currentTime().toString("hh:mm:ss zzz:")).arg(m_StationInfo_2.m_PLCID);
|
|
|
|
emit sgShowLog(2, strMsg);
|
|
|
|
emit sgShowLog(2, strMsg);
|
|
|
|
if (m_StationInfo_2.m_PLCID > 0) {
|
|
|
|
if (m_StationInfo_2.m_PLCID > 0) {
|
|
|
|
pStation->setSerialPortPtr(m_pSerialPort);
|
|
|
|
sendResult(2, 999, 0, 0);
|
|
|
|
pStation->sendResult(999);
|
|
|
|
|
|
|
|
SYSLOG_STATUS << QString("●工位%1:收到触发信号,因索引不合法所以没触发相机拍照,发送了999角度数据,型号为[%2],型号索引ID为[%3],时间:%4")
|
|
|
|
SYSLOG_STATUS << QString("●工位%1:收到触发信号,因索引不合法所以没触发相机拍照,发送了999角度数据,型号为[%2],型号索引ID为[%3],时间:%4")
|
|
|
|
.arg(nCameraID)
|
|
|
|
.arg(nCameraID)
|
|
|
|
.arg(m_StationInfo_2.strModelName.isEmpty() == true ? "空" : m_StationInfo_2.strModelName)
|
|
|
|
.arg(m_StationInfo_2.strModelName.isEmpty() == true ? "空" : m_StationInfo_2.strModelName)
|
|
|
|
@ -410,19 +389,29 @@ Q_SLOT void CMainWin::onAppanalysis(SComFrame frame)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else//不是PLC切换型号模式 可以触发拍照
|
|
|
|
pStation->trigImage();
|
|
|
|
{
|
|
|
|
|
|
|
|
if (nCameraID == 1)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
QString strCam = lpGlobalConfig::instance()->m_StationCamKey_1;
|
|
|
|
|
|
|
|
m_pCoreCtrl->ISnapImage(QStringList() << strCam);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else if (nCameraID == 2)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
QString strCam = lpGlobalConfig::instance()->m_StationCamKey_2;
|
|
|
|
|
|
|
|
m_pCoreCtrl->ISnapImage(QStringList() << strCam);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (0xf1 == nCmd)
|
|
|
|
else if (0xf1 == nCmd)
|
|
|
|
{//接收到下位机的命令关闭所有窗口 关机
|
|
|
|
{//接收到下位机的命令关闭所有窗口 关机
|
|
|
|
qApp->closeAllWindows();
|
|
|
|
qApp->closeAllWindows();
|
|
|
|
//shutDown();
|
|
|
|
}
|
|
|
|
}*/
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void CMainWin::onHeartComm(SComFrame &frame)
|
|
|
|
void CMainWin::onHeartComm(SComFrame &frame)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
/* static int nS1 = -1;
|
|
|
|
static int nS1 = -1;
|
|
|
|
static int nS2 = -1;
|
|
|
|
static int nS2 = -1;
|
|
|
|
|
|
|
|
|
|
|
|
if (m_pWfCtrl)
|
|
|
|
if (m_pWfCtrl)
|
|
|
|
@ -430,7 +419,7 @@ void CMainWin::onHeartComm(SComFrame &frame)
|
|
|
|
else
|
|
|
|
else
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
if (m_pWfCtrl->IOnlineMode() == true)
|
|
|
|
if (lpGlobalConfig::instance()->m_bOnlineMode == true)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
int nSta1 = frame.data1;
|
|
|
|
int nSta1 = frame.data1;
|
|
|
|
int nSta2 = frame.data2;
|
|
|
|
int nSta2 = frame.data2;
|
|
|
|
@ -449,76 +438,42 @@ void CMainWin::onHeartComm(SComFrame &frame)
|
|
|
|
if (!pStation) {
|
|
|
|
if (!pStation) {
|
|
|
|
continue;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
int nId = pStation->stationId();
|
|
|
|
|
|
|
|
if (nId <= 0 || nId > 8) {
|
|
|
|
|
|
|
|
//error
|
|
|
|
|
|
|
|
qWarning() << "error, id is beyong";
|
|
|
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int mmCmd = 0;
|
|
|
|
int mmCmd = 0;
|
|
|
|
if (nId == 1)
|
|
|
|
if (var == lpGlobalConfig::instance()->m_StationSolution_1)
|
|
|
|
|
|
|
|
{
|
|
|
|
mmCmd = frame.data1;
|
|
|
|
mmCmd = frame.data1;
|
|
|
|
if (nId == 2)
|
|
|
|
|
|
|
|
mmCmd = frame.data2;
|
|
|
|
|
|
|
|
if (nId == 3)
|
|
|
|
|
|
|
|
mmCmd = frame.data3;
|
|
|
|
|
|
|
|
if (nId == 4)
|
|
|
|
|
|
|
|
mmCmd = frame.data4;
|
|
|
|
|
|
|
|
if (nId == 5)
|
|
|
|
|
|
|
|
mmCmd = frame.data5;
|
|
|
|
|
|
|
|
if (nId == 6)
|
|
|
|
|
|
|
|
mmCmd = frame.data6;
|
|
|
|
|
|
|
|
if (nId == 7)
|
|
|
|
|
|
|
|
mmCmd = frame.data7;
|
|
|
|
|
|
|
|
if (nId == 8)
|
|
|
|
|
|
|
|
mmCmd = frame.data8;
|
|
|
|
|
|
|
|
QString strModel = pStation->modelByPlcCmd(mmCmd);
|
|
|
|
QString strModel = pStation->modelByPlcCmd(mmCmd);
|
|
|
|
if (!strModel.isEmpty())
|
|
|
|
if (!strModel.isEmpty())
|
|
|
|
{
|
|
|
|
|
|
|
|
emit(sgSelModel(nId, strModel));
|
|
|
|
|
|
|
|
if (nId == 1)
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (m_StationInfo_1.m_PLCID != mmCmd)
|
|
|
|
if (m_StationInfo_1.m_PLCID != mmCmd)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
m_StationInfo_1.m_PLCID = mmCmd;
|
|
|
|
m_StationInfo_1.m_PLCID = mmCmd;
|
|
|
|
m_StationInfo_1.strModelName = strModel;
|
|
|
|
m_StationInfo_1.strModelName = strModel;
|
|
|
|
SYSLOG_STATUS << QString("★工位%1:切换型号为[%2],型号索引ID为[%3],时间:%4")
|
|
|
|
SYSLOG_STATUS << QString("★工位%1:切换型号为[%2],型号索引ID为[%3],时间:%4")
|
|
|
|
.arg(nId)
|
|
|
|
.arg(1)
|
|
|
|
.arg(strModel)
|
|
|
|
|
|
|
|
.arg(mmCmd)
|
|
|
|
|
|
|
|
.arg(QDateTime::currentDateTime().toString("hh:mm:ss zzz"));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
m_StationInfo_1.m_bRunEnable = true;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else if (nId == 2)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (m_StationInfo_2.m_PLCID != mmCmd) {
|
|
|
|
|
|
|
|
m_StationInfo_2.m_PLCID = mmCmd;
|
|
|
|
|
|
|
|
m_StationInfo_2.strModelName = strModel;
|
|
|
|
|
|
|
|
SYSLOG_STATUS << QString("★工位%1:切换型号为[%2],型号索引ID为[%3],时间:%4")
|
|
|
|
|
|
|
|
.arg(nId)
|
|
|
|
|
|
|
|
.arg(strModel)
|
|
|
|
.arg(strModel)
|
|
|
|
.arg(mmCmd)
|
|
|
|
.arg(mmCmd)
|
|
|
|
.arg(QDateTime::currentDateTime().toString("hh:mm:ss zzz"));
|
|
|
|
.arg(QDateTime::currentDateTime().toString("hh:mm:ss zzz"));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (m_pWfCtrl) {
|
|
|
|
|
|
|
|
m_pWfCtrl->ISelModel(var, strModel);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
m_StationInfo_2.m_bRunEnable = true;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
m_StationInfo_1.m_bRunEnable = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
else {
|
|
|
|
if (nId == 1)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (m_StationInfo_1.m_PLCID != mmCmd) {
|
|
|
|
if (m_StationInfo_1.m_PLCID != mmCmd) {
|
|
|
|
m_StationInfo_1.m_PLCID = mmCmd;
|
|
|
|
m_StationInfo_1.m_PLCID = mmCmd;
|
|
|
|
m_StationInfo_1.strModelName = strModel;
|
|
|
|
m_StationInfo_1.strModelName = strModel;
|
|
|
|
if (mmCmd <= 0)
|
|
|
|
if (mmCmd <= 0)
|
|
|
|
SYSLOG_STATUS << QString("★工位%1:型号清零,型号索引ID为[%2],时间:%3")
|
|
|
|
SYSLOG_STATUS << QString("★工位%1:型号清零,型号索引ID为[%2],时间:%3")
|
|
|
|
.arg(nId)
|
|
|
|
.arg(1)
|
|
|
|
.arg(mmCmd)
|
|
|
|
.arg(mmCmd)
|
|
|
|
.arg(QDateTime::currentDateTime().toString("hh:mm:ss zzz"));
|
|
|
|
.arg(QDateTime::currentDateTime().toString("hh:mm:ss zzz"));
|
|
|
|
else
|
|
|
|
else
|
|
|
|
SYSLOG_STATUS << QString("★工位%1:型号切换失败,对应的索引不存在,型号索引ID为[%2],时间:%3")
|
|
|
|
SYSLOG_STATUS << QString("★工位%1:型号切换失败,对应的索引不存在,型号索引ID为[%2],时间:%3")
|
|
|
|
.arg(nId)
|
|
|
|
.arg(1)
|
|
|
|
.arg(mmCmd)
|
|
|
|
.arg(mmCmd)
|
|
|
|
.arg(QDateTime::currentDateTime().toString("hh:mm:ss zzz"));
|
|
|
|
.arg(QDateTime::currentDateTime().toString("hh:mm:ss zzz"));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -530,19 +485,39 @@ void CMainWin::onHeartComm(SComFrame &frame)
|
|
|
|
emit sgShowLog(1, strMsg);
|
|
|
|
emit sgShowLog(1, strMsg);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (nId == 2)
|
|
|
|
}
|
|
|
|
|
|
|
|
else if (var == lpGlobalConfig::instance()->m_StationSolution_2)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
mmCmd = frame.data2;
|
|
|
|
|
|
|
|
QString strModel = pStation->modelByPlcCmd(mmCmd);
|
|
|
|
|
|
|
|
if (!strModel.isEmpty())
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
if (m_StationInfo_2.m_PLCID != mmCmd) {
|
|
|
|
|
|
|
|
m_StationInfo_2.m_PLCID = mmCmd;
|
|
|
|
|
|
|
|
m_StationInfo_2.strModelName = strModel;
|
|
|
|
|
|
|
|
SYSLOG_STATUS << QString("★工位%1:切换型号为[%2],型号索引ID为[%3],时间:%4")
|
|
|
|
|
|
|
|
.arg(2)
|
|
|
|
|
|
|
|
.arg(strModel)
|
|
|
|
|
|
|
|
.arg(mmCmd)
|
|
|
|
|
|
|
|
.arg(QDateTime::currentDateTime().toString("hh:mm:ss zzz"));
|
|
|
|
|
|
|
|
if (m_pWfCtrl) {
|
|
|
|
|
|
|
|
m_pWfCtrl->ISelModel(var, strModel);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
m_StationInfo_2.m_bRunEnable = true;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else {
|
|
|
|
if (m_StationInfo_2.m_PLCID != mmCmd) {
|
|
|
|
if (m_StationInfo_2.m_PLCID != mmCmd) {
|
|
|
|
m_StationInfo_2.m_PLCID = mmCmd;
|
|
|
|
m_StationInfo_2.m_PLCID = mmCmd;
|
|
|
|
m_StationInfo_2.strModelName = strModel;
|
|
|
|
m_StationInfo_2.strModelName = strModel;
|
|
|
|
if (mmCmd <= 0)
|
|
|
|
if (mmCmd <= 0)
|
|
|
|
SYSLOG_STATUS << QString("★工位%1:型号清零,型号索引ID为[%2],时间:%3")
|
|
|
|
SYSLOG_STATUS << QString("★工位%1:型号清零,型号索引ID为[%2],时间:%3")
|
|
|
|
.arg(nId)
|
|
|
|
.arg(2)
|
|
|
|
.arg(mmCmd)
|
|
|
|
.arg(mmCmd)
|
|
|
|
.arg(QDateTime::currentDateTime().toString("hh:mm:ss zzz"));
|
|
|
|
.arg(QDateTime::currentDateTime().toString("hh:mm:ss zzz"));
|
|
|
|
else
|
|
|
|
else
|
|
|
|
SYSLOG_STATUS << QString("★工位%1:型号切换失败,对应的索引不存在,型号索引ID为[%2],时间:%3")
|
|
|
|
SYSLOG_STATUS << QString("★工位%1:型号切换失败,对应的索引不存在,型号索引ID为[%2],时间:%3")
|
|
|
|
.arg(nId)
|
|
|
|
.arg(2)
|
|
|
|
.arg(mmCmd)
|
|
|
|
.arg(mmCmd)
|
|
|
|
.arg(QDateTime::currentDateTime().toString("hh:mm:ss zzz"));
|
|
|
|
.arg(QDateTime::currentDateTime().toString("hh:mm:ss zzz"));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -555,7 +530,7 @@ void CMainWin::onHeartComm(SComFrame &frame)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}*/
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Q_SLOT void CMainWin::onHeardBit()
|
|
|
|
Q_SLOT void CMainWin::onHeardBit()
|
|
|
|
@ -1317,6 +1292,19 @@ void CMainWin::IEngineResult(QVariantMap vMap)
|
|
|
|
QPointF centerPoint = algResult.value("centerPoint").toPointF();
|
|
|
|
QPointF centerPoint = algResult.value("centerPoint").toPointF();
|
|
|
|
QString taskName = vMap.value("taskName").toString();
|
|
|
|
QString taskName = vMap.value("taskName").toString();
|
|
|
|
double taskTime = vMap.value("tasktime").toDouble();
|
|
|
|
double taskTime = vMap.value("tasktime").toDouble();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (solutionName == lpGlobalConfig::instance()->m_StationSolution_1)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
double centerX = centerPoint.x() * lpGlobalConfig::instance()->m_StationScale_1 + lpGlobalConfig::instance()->m_StationXOffset_1;
|
|
|
|
|
|
|
|
double centerY = centerPoint.y() * lpGlobalConfig::instance()->m_StationScale_1 + lpGlobalConfig::instance()->m_StationYOffset_1;
|
|
|
|
|
|
|
|
sendResult(1,dAngle, centerX, centerY);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else if (solutionName == lpGlobalConfig::instance()->m_StationSolution_2)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
double centerX = centerPoint.x() * lpGlobalConfig::instance()->m_StationScale_2 + lpGlobalConfig::instance()->m_StationXOffset_2;
|
|
|
|
|
|
|
|
double centerY = centerPoint.y() * lpGlobalConfig::instance()->m_StationScale_2 + lpGlobalConfig::instance()->m_StationYOffset_2;
|
|
|
|
|
|
|
|
sendResult(2, dAngle, centerX, centerY);
|
|
|
|
|
|
|
|
}
|
|
|
|
// ui.main_label_angle->setText(QString("%1").arg(dAngle));
|
|
|
|
// ui.main_label_angle->setText(QString("%1").arg(dAngle));
|
|
|
|
//
|
|
|
|
//
|
|
|
|
// ValueResult valueRlt;
|
|
|
|
// ValueResult valueRlt;
|
|
|
|
@ -1370,6 +1358,58 @@ void CMainWin::IEngineResult(QVariantMap vMap)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
onShowImage(stationID, maskImg);
|
|
|
|
onShowImage(stationID, maskImg);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bool CMainWin::sendResult(int nID, double angleValue, double centerX, double centerY)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (m_pSerialPort)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
const int c_nDataNum = 8;
|
|
|
|
|
|
|
|
const double c_dMaxAngle = 360.0;
|
|
|
|
|
|
|
|
if (angleValue < 0) {
|
|
|
|
|
|
|
|
angleValue += c_dMaxAngle;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
unsigned short data[c_nDataNum] = { 0 };
|
|
|
|
|
|
|
|
data[2] = int(angleValue);
|
|
|
|
|
|
|
|
double tmp = angleValue - int(angleValue);
|
|
|
|
|
|
|
|
tmp *= 1000.0;
|
|
|
|
|
|
|
|
data[3] = int(tmp);
|
|
|
|
|
|
|
|
SComFrame sendFram;
|
|
|
|
|
|
|
|
int nCmd = (nID == 1 ? 0x46 : 0x47);//stion1 0x46 /station2 0x47
|
|
|
|
|
|
|
|
sendFram.cmd = nCmd;
|
|
|
|
|
|
|
|
sendFram.data1 = data[0];
|
|
|
|
|
|
|
|
sendFram.data2 = data[1];
|
|
|
|
|
|
|
|
sendFram.data3 = data[2];
|
|
|
|
|
|
|
|
sendFram.data4 = data[3];
|
|
|
|
|
|
|
|
sendFram.data5 = data[4];
|
|
|
|
|
|
|
|
sendFram.data6 = data[5];
|
|
|
|
|
|
|
|
sendFram.data7 = data[6];
|
|
|
|
|
|
|
|
sendFram.data8 = data[7];
|
|
|
|
|
|
|
|
m_pSerialPort->enquequeData(sendFram);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (angleValue >= c_dMaxAngle) {
|
|
|
|
|
|
|
|
unsigned short data2[c_nDataNum] = { 0 };
|
|
|
|
|
|
|
|
data2[0] = 6 + nID - 1;
|
|
|
|
|
|
|
|
data2[1] = 50;
|
|
|
|
|
|
|
|
// for (int i = 0; i < c_nDataNum; i++) {
|
|
|
|
|
|
|
|
// swapBigEndian(data2[i]);
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
SComFrame sendFram2;
|
|
|
|
|
|
|
|
sendFram2.cmd = 0x48;
|
|
|
|
|
|
|
|
sendFram2.data1 = data2[0];
|
|
|
|
|
|
|
|
sendFram2.data2 = data2[1];
|
|
|
|
|
|
|
|
sendFram2.data3 = data2[2];
|
|
|
|
|
|
|
|
sendFram2.data4 = data2[3];
|
|
|
|
|
|
|
|
sendFram2.data5 = data2[4];
|
|
|
|
|
|
|
|
sendFram2.data6 = data2[5];
|
|
|
|
|
|
|
|
sendFram2.data7 = data2[6];
|
|
|
|
|
|
|
|
sendFram2.data8 = data2[7];
|
|
|
|
|
|
|
|
m_pSerialPort->enquequeData(sendFram2);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|