Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 48be580226 | |||
| a629115e91 | |||
| c1e4144ed6 | |||
| c2b3f131ee | |||
| 20848bef1a | |||
| f6138dd2ed | |||
| f32ade7487 | |||
| 89c701c5f2 |
10
HPPA.sln
10
HPPA.sln
@ -10,6 +10,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "HPPA", "HPPA\HPPA.vcxproj",
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "vincecontrol", "vincecontrol\vincecontrol.vcxproj", "{B12702AD-ABFB-343A-A199-8E24837244A3}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "IrisMultiMotorController", "IrisMultiMotorController\IrisMultiMotorController\IrisMultiMotorController.vcxproj", "{2E792AA6-1BCB-4CDA-BE01-4D455EC5C473}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|x64 = Debug|x64
|
||||
@ -34,6 +36,14 @@ Global
|
||||
{B12702AD-ABFB-343A-A199-8E24837244A3}.Release|x64.Build.0 = Release|x64
|
||||
{B12702AD-ABFB-343A-A199-8E24837244A3}.Release|x86.ActiveCfg = Release|Win32
|
||||
{B12702AD-ABFB-343A-A199-8E24837244A3}.Release|x86.Build.0 = Release|Win32
|
||||
{2E792AA6-1BCB-4CDA-BE01-4D455EC5C473}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{2E792AA6-1BCB-4CDA-BE01-4D455EC5C473}.Debug|x64.Build.0 = Debug|x64
|
||||
{2E792AA6-1BCB-4CDA-BE01-4D455EC5C473}.Debug|x86.ActiveCfg = Debug|x64
|
||||
{2E792AA6-1BCB-4CDA-BE01-4D455EC5C473}.Debug|x86.Build.0 = Debug|x64
|
||||
{2E792AA6-1BCB-4CDA-BE01-4D455EC5C473}.Release|x64.ActiveCfg = Release|x64
|
||||
{2E792AA6-1BCB-4CDA-BE01-4D455EC5C473}.Release|x64.Build.0 = Release|x64
|
||||
{2E792AA6-1BCB-4CDA-BE01-4D455EC5C473}.Release|x86.ActiveCfg = Release|x64
|
||||
{2E792AA6-1BCB-4CDA-BE01-4D455EC5C473}.Release|x86.Build.0 = Release|x64
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
||||
158
HPPA/Corning410Imager.cpp
Normal file
158
HPPA/Corning410Imager.cpp
Normal file
@ -0,0 +1,158 @@
|
||||
#include "Corning410Imager.h"
|
||||
|
||||
Corning410Imager::Corning410Imager()
|
||||
{
|
||||
//<2F><><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD>У<EFBFBD><D0A3>ʹ<EFBFBD><CDB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>
|
||||
string CfgFile = getPathofEXE() + "\\corning410.cfg";
|
||||
m_configfile.setConfigfilePath(CfgFile);
|
||||
if (!m_configfile.isConfigfileExist())
|
||||
{
|
||||
m_configfile.createConfigFile();
|
||||
qDebug() << "create: " << QString::fromStdString(CfgFile);
|
||||
}
|
||||
m_configfile.parseConfigfile();
|
||||
qDebug() << "exist: " << QString::fromStdString(CfgFile);
|
||||
}
|
||||
|
||||
Corning410Imager::~Corning410Imager()
|
||||
{
|
||||
if (buffer != nullptr)
|
||||
{
|
||||
std::cout << "<EFBFBD>ͷŶ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڴ<EFBFBD>" << std::endl;
|
||||
free(buffer);
|
||||
free(dark);
|
||||
free(white);
|
||||
}
|
||||
}
|
||||
|
||||
double Corning410Imager::getFramerate()
|
||||
{
|
||||
return m_imager.get_framerate();
|
||||
}
|
||||
|
||||
double Corning410Imager::getIntegrationTime()
|
||||
{
|
||||
return m_imager.get_integration_time() / 1000;
|
||||
}
|
||||
|
||||
double Corning410Imager::getGain()
|
||||
{
|
||||
return m_imager.get_gain();
|
||||
}
|
||||
|
||||
void Corning410Imager::setGain(const double gain)
|
||||
{
|
||||
m_imager.set_gain(gain);
|
||||
}
|
||||
|
||||
void Corning410Imager::setFramerate(const double frames_per_second)
|
||||
{
|
||||
m_imager.set_framerate(frames_per_second);
|
||||
m_RgbImage->m_iFramerate = frames_per_second;
|
||||
}
|
||||
|
||||
void Corning410Imager::setIntegrationTime(const double milliseconds)
|
||||
{
|
||||
m_imager.set_integration_time(milliseconds * 1000);
|
||||
}
|
||||
|
||||
int Corning410Imager::getStartBand()
|
||||
{
|
||||
return m_imager.get_start_band();
|
||||
}
|
||||
|
||||
int Corning410Imager::getEndBand()
|
||||
{
|
||||
return m_imager.get_end_band();
|
||||
}
|
||||
|
||||
void Corning410Imager::connectImager(const char* camera_sn)
|
||||
{
|
||||
m_imager.connect();
|
||||
|
||||
//<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ò<EFBFBD><C3B2><EFBFBD>
|
||||
bool ret, ret1, ret2;
|
||||
|
||||
int spatialBin;
|
||||
int spectralBin;
|
||||
ret1 = m_configfile.getspatialBin(spatialBin);
|
||||
ret2 = m_configfile.getSpectralBin(spectralBin);
|
||||
if (ret1 && ret2)
|
||||
{
|
||||
bool haha = m_imager.setSpectralBin(spectralBin);
|
||||
bool haha2 = m_imager.setSpatialBin(spatialBin);
|
||||
|
||||
std::cout << "spectralBin<EFBFBD><EFBFBD>" << spectralBin << std::endl;
|
||||
std::cout << "spatialBin<EFBFBD><EFBFBD>" << spatialBin << std::endl;
|
||||
}
|
||||
|
||||
float gain, offset;
|
||||
ret = m_configfile.getGainOffset(gain, offset);
|
||||
if (ret)
|
||||
{
|
||||
m_imager.setGainOffset(gain, offset);
|
||||
}
|
||||
|
||||
int width = 0, offsetx = 0, height = 0, offsety = 0;
|
||||
ret = m_configfile.getEffectiveWindow(width, offsetx, height, offsety);
|
||||
if (ret)
|
||||
{
|
||||
m_imager.setEffectiveWindow(offsetx, width, offsety, height);
|
||||
}
|
||||
|
||||
|
||||
int bufferPolicy, acqBufferSize;
|
||||
ret1 = m_configfile.getBufferPolicy(bufferPolicy);
|
||||
if (ret1)
|
||||
{
|
||||
m_imager.setBufferPolicy(bufferPolicy);
|
||||
}
|
||||
ret1 = m_configfile.getAcqBufferSize(acqBufferSize);
|
||||
if (ret1)
|
||||
{
|
||||
m_imager.setAcqBufferSize(acqBufferSize);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void Corning410Imager::disconnectImager()
|
||||
{
|
||||
m_imager.disconnect();
|
||||
}
|
||||
|
||||
void Corning410Imager::imagerStartCollect()
|
||||
{
|
||||
m_imager.start();
|
||||
}
|
||||
|
||||
void Corning410Imager::imagerStopCollect()
|
||||
{
|
||||
m_imager.stop();
|
||||
}
|
||||
|
||||
unsigned short* Corning410Imager::getFrame(unsigned short* buffer)
|
||||
{
|
||||
m_imager.get_frame(buffer);
|
||||
|
||||
return buffer;
|
||||
}
|
||||
|
||||
void Corning410Imager::setSpectraBin(int new_spectral_bin)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
double Corning410Imager::getWavelengthAtBand(int band)
|
||||
{
|
||||
return m_imager.get_wavelength_at_band(band);
|
||||
}
|
||||
|
||||
int Corning410Imager::getBandCount()
|
||||
{
|
||||
return m_imager.get_band_count();
|
||||
}
|
||||
|
||||
int Corning410Imager::getSampleCount()
|
||||
{
|
||||
return m_imager.get_sample_count();
|
||||
}
|
||||
48
HPPA/Corning410Imager.h
Normal file
48
HPPA/Corning410Imager.h
Normal file
@ -0,0 +1,48 @@
|
||||
#pragma once
|
||||
#include <string>
|
||||
#include <opencv2/core/core.hpp>
|
||||
|
||||
#include "ImagerOperationBase.h"
|
||||
#include "image2display.h"
|
||||
#include "fileOperation.h"
|
||||
|
||||
#include "irisximeaimager.h"
|
||||
#include "path_tc.h"
|
||||
#include "hppaConfigFile.h"
|
||||
|
||||
class Corning410Imager :public ImagerOperationBase
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
Corning410Imager();
|
||||
~Corning410Imager();
|
||||
|
||||
Iris::IrisXimeaImager m_imager;
|
||||
|
||||
double getWavelengthAtBand(int band);
|
||||
int getBandCount();
|
||||
int getSampleCount();
|
||||
double getFramerate();
|
||||
double getIntegrationTime();
|
||||
double getGain();
|
||||
void setFramerate(const double frames_per_second);
|
||||
void setIntegrationTime(const double milliseconds);
|
||||
void setGain(const double gain);
|
||||
int getStartBand();
|
||||
int getEndBand();
|
||||
void connectImager(const char* camera_sn = NULL);
|
||||
void disconnectImager();
|
||||
void imagerStartCollect();
|
||||
void imagerStopCollect();
|
||||
unsigned short* getFrame(unsigned short* buffer);
|
||||
void setSpectraBin(int new_spectral_bin);
|
||||
|
||||
protected:
|
||||
private:
|
||||
CorningConfigfile m_configfile;
|
||||
|
||||
public slots:
|
||||
|
||||
signals:
|
||||
};
|
||||
@ -11,7 +11,7 @@
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Dialog</string>
|
||||
<string>调焦</string>
|
||||
</property>
|
||||
<property name="windowIcon">
|
||||
<iconset resource="HPPA.qrc">
|
||||
|
||||
650
HPPA/HPPA.cpp
650
HPPA/HPPA.cpp
@ -13,15 +13,11 @@ HPPA::HPPA(QWidget *parent)
|
||||
{
|
||||
ui.setupUi(this);
|
||||
|
||||
QString strPath = QCoreApplication::applicationDirPath() + "/UILayout.ini";
|
||||
QFile file(strPath);
|
||||
if (file.open(QIODevice::ReadOnly)) {
|
||||
QByteArray ba;
|
||||
QDataStream in(&file);
|
||||
in >> ba;
|
||||
file.close();
|
||||
this->restoreState(ba);
|
||||
}
|
||||
QCoreApplication::setOrganizationName("IRIS");
|
||||
QCoreApplication::setOrganizationDomain("iris.com");
|
||||
QCoreApplication::setApplicationName("HPPA");
|
||||
|
||||
|
||||
|
||||
//<2F><><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD>У<EFBFBD><D0A3>ʹ<EFBFBD><CDB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>
|
||||
string HPPACfgFile = getPathofEXE() + "\\HPPA.cfg";
|
||||
@ -94,23 +90,8 @@ HPPA::HPPA(QWidget *parent)
|
||||
ptoolbar->addAction(pAction);*/
|
||||
|
||||
|
||||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD>
|
||||
QWidget* widget = new QWidget();
|
||||
QGridLayout* grid = new QGridLayout(widget);
|
||||
|
||||
|
||||
m_chartView = new QChartView(ui.mDockWidgetSpectralViewer);
|
||||
m_chartView->setRenderHint(QPainter::Antialiasing);
|
||||
|
||||
grid->addWidget(m_chartView);
|
||||
//grid->setMargin(0);
|
||||
grid->setContentsMargins(0, 0, 0, 0);
|
||||
//grid->SetMaximumSize(0);
|
||||
ui.mDockWidgetSpectralViewer->setWidget(widget);
|
||||
|
||||
//QLineSeries *series = new QLineSeries();
|
||||
//QChart *chart = new QChart();
|
||||
|
||||
|
||||
//<2F><><EFBFBD><EFBFBD><EFBFBD>Dz<EFBFBD><C7B2><EFBFBD>
|
||||
m_Imager = nullptr;
|
||||
@ -259,11 +240,30 @@ HPPA::HPPA(QWidget *parent)
|
||||
connect(this->ui.action_about, SIGNAL(triggered()), this, SLOT(onAbout()));
|
||||
|
||||
initPanelToolbar();
|
||||
connect(this->ui.mActionOneMotorScenario, SIGNAL(triggered()), this, SLOT(createOneMotorScenario()));
|
||||
|
||||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ
|
||||
QWidget* widget = new QWidget();
|
||||
QGridLayout* grid = new QGridLayout(widget);
|
||||
|
||||
m_chartView = new QChartView(ui.mDockWidgetSpectralViewer);
|
||||
m_chartView->setRenderHint(QPainter::Antialiasing);
|
||||
|
||||
grid->addWidget(m_chartView);
|
||||
//grid->setMargin(0);
|
||||
grid->setContentsMargins(0, 0, 0, 0);
|
||||
//grid->SetMaximumSize(0);
|
||||
ui.mDockWidgetSpectralViewer->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea | Qt::TopDockWidgetArea | Qt::BottomDockWidgetArea);
|
||||
ui.mDockWidgetSpectralViewer->setWidget(widget);
|
||||
//QLineSeries *series = new QLineSeries();
|
||||
//QChart *chart = new QChart();
|
||||
mPanelMenu->addAction(ui.mDockWidgetSpectralViewer->toggleViewAction());
|
||||
|
||||
//<2F>켣<EFBFBD>滮
|
||||
m_pathPlan = new PathPlan(m_xMotor, m_yMotor, ui.xmotor_location_slider, ui.ymotor_location_slider);
|
||||
QDockWidget* dock_pathPlan = new QDockWidget(QString::fromLocal8Bit("<EFBFBD>켣<EFBFBD>滮"), this);
|
||||
dock_pathPlan->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
|
||||
dock_pathPlan->setObjectName("mDockPathPlan");
|
||||
dock_pathPlan->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea | Qt::TopDockWidgetArea | Qt::BottomDockWidgetArea);
|
||||
dock_pathPlan->setWidget(m_pathPlan);
|
||||
tabifyDockWidget(ui.mDockWidgetLinearStage, dock_pathPlan);
|
||||
mPanelMenu->addAction(dock_pathPlan->toggleViewAction());
|
||||
@ -272,6 +272,7 @@ HPPA::HPPA(QWidget *parent)
|
||||
adjustTable* adt = new adjustTable();
|
||||
|
||||
QDockWidget* dock_adt = new QDockWidget(QString::fromLocal8Bit("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"), this);
|
||||
dock_adt->setObjectName("mDockAdjustTable");
|
||||
dock_adt->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
|
||||
dock_adt->setWidget(adt);
|
||||
tabifyDockWidget(dock_pathPlan, dock_adt);
|
||||
@ -281,6 +282,7 @@ HPPA::HPPA(QWidget *parent)
|
||||
PowerControl* pc = new PowerControl();
|
||||
|
||||
QDockWidget* dock_pc = new QDockWidget(QString::fromLocal8Bit("<EFBFBD><EFBFBD>Դ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>"), this);
|
||||
dock_pc->setObjectName("mDockPowerControl");
|
||||
dock_pc->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
|
||||
dock_pc->setWidget(pc);
|
||||
tabifyDockWidget(dock_adt, dock_pc);
|
||||
@ -288,8 +290,85 @@ HPPA::HPPA(QWidget *parent)
|
||||
connect(pc, &PowerControl::powerOpened, this, &HPPA::newMotor);
|
||||
connect(pc, &PowerControl::powerClosed, this, &HPPA::deleteMotor);
|
||||
|
||||
//<2F><>е<EFBFBD>ۿ<EFBFBD><DBBF><EFBFBD>
|
||||
rac = new RobotArmControl();
|
||||
connect(rac->robotController, SIGNAL(hsiRecordSignal(int)), this, SLOT(recordFromRobotArm(int)));
|
||||
QDockWidget* dock_rac = new QDockWidget(QString::fromLocal8Bit("<EFBFBD><EFBFBD>е<EFBFBD>ۿ<EFBFBD><EFBFBD><EFBFBD>"), this);
|
||||
dock_rac->setObjectName("mDockRobotArmControl");
|
||||
dock_rac->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
|
||||
dock_rac->setWidget(rac);
|
||||
tabifyDockWidget(dock_adt, dock_rac);
|
||||
mPanelMenu->addAction(dock_rac->toggleViewAction());
|
||||
|
||||
//һ<><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
omc = new OneMotorControl();
|
||||
connect(omc, SIGNAL(startRecordLineSignal(int)), this, SLOT(recordHyperSpecImg(int)));
|
||||
|
||||
dock_omc = new QDockWidget(QString::fromLocal8Bit("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"), this);
|
||||
dock_omc->setObjectName("mDockOneMotorControl");
|
||||
dock_omc->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
|
||||
dock_omc->setWidget(omc);
|
||||
tabifyDockWidget(dock_rac, dock_omc);
|
||||
mPanelMenu->addAction(dock_omc->toggleViewAction());
|
||||
|
||||
createActionGroups();
|
||||
connect(mImagerGroup, &QActionGroup::triggered, this, &HPPA::selectingImager);
|
||||
|
||||
createMoveplatformActionGroup();
|
||||
connect(moveplatformActionGroup, &QActionGroup::triggered, this, &HPPA::selectingMoveplatform);
|
||||
|
||||
QString strPath = QCoreApplication::applicationDirPath() + "/UILayout.ini";
|
||||
QFile file(strPath);
|
||||
if (file.open(QIODevice::ReadOnly))
|
||||
{
|
||||
QByteArray ba;
|
||||
QDataStream in(&file);
|
||||
in >> ba;
|
||||
file.close();
|
||||
this->restoreState(ba);
|
||||
}
|
||||
}
|
||||
|
||||
void HPPA::recordHyperSpecImg(int status)
|
||||
{
|
||||
if (status == 1)
|
||||
{
|
||||
emit StartRecordSignal();//<2F><><EFBFBD>俪ʼ<E4BFAA>ɼ<EFBFBD><C9BC>ź<EFBFBD>
|
||||
}
|
||||
else if (status == 0)
|
||||
{
|
||||
m_Imager->setRecordControlState(false);//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֹͣ<CDA3>ɼ<EFBFBD>
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void HPPA::recordFromRobotArm(int fileCounter)
|
||||
{
|
||||
//qDebug() << "recordFromRobotArm" << fileCounter;
|
||||
|
||||
if (fileCounter == -1)
|
||||
{
|
||||
m_Imager->setRecordControlState(false);
|
||||
|
||||
ui.action_start_recording->setText(QString::fromLocal8Bit("<EFBFBD>ɼ<EFBFBD>"));
|
||||
ui.mainToolBar->widgetForAction(ui.action_start_recording)->setStyleSheet("QWidget{background-color:rgb(0,255,0);}");
|
||||
//qDebug() << "recordFromRobotArm: 1111111111111111111111";
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (fileCounter - 1 == 0)
|
||||
{
|
||||
ui.ImageViewerTabWidget->clear();
|
||||
}
|
||||
|
||||
onCreateTab(fileCounter-1);
|
||||
m_numberOfRecording = fileCounter - 1;
|
||||
emit StartRecordSignal();
|
||||
|
||||
ui.action_start_recording->setText(QString::fromLocal8Bit("<EFBFBD>ɼ<EFBFBD><EFBFBD><EFBFBD>"));
|
||||
ui.mainToolBar->widgetForAction(ui.action_start_recording)->setStyleSheet("QWidget{background-color:rgb(255,0,0);}");
|
||||
//qDebug() << "recordFromRobotArm: 2222222222222222222222";
|
||||
}
|
||||
|
||||
void HPPA::createActionGroups()
|
||||
@ -301,13 +380,74 @@ void HPPA::createActionGroups()
|
||||
mImagerGroup->addAction(ui.mActionCorning_410);
|
||||
mImagerGroup->addAction(ui.mActionPica_NIR);
|
||||
|
||||
ui.mActionPica_NIR->setChecked(true);
|
||||
imagerSelected = ui.mActionPica_NIR->objectName();
|
||||
|
||||
// <20><>ȡ<EFBFBD>ϴ<EFBFBD>ѡ<EFBFBD><D1A1><EFBFBD>Ľ<EFBFBD><C4BD><EFBFBD>
|
||||
QSettings settings;
|
||||
QString lastSelectedAction = settings.value("LastSelectedImagerAction").toString();
|
||||
|
||||
// <20>ָ<EFBFBD><D6B8>ϴ<EFBFBD>ѡ<EFBFBD><D1A1><EFBFBD>Ľ<EFBFBD><C4BD><EFBFBD>
|
||||
if (lastSelectedAction == "mActionPica_L")
|
||||
{
|
||||
ui.mActionPica_L->setChecked(true);
|
||||
}
|
||||
else if (lastSelectedAction == "mActionPica_NIR")
|
||||
{
|
||||
ui.mActionPica_NIR->setChecked(true);
|
||||
}
|
||||
else if (lastSelectedAction == "mActionPika_XC2")
|
||||
{
|
||||
ui.mActionPika_XC2->setChecked(true);
|
||||
}
|
||||
else if (lastSelectedAction == "mActionCorning_410")
|
||||
{
|
||||
ui.mActionCorning_410->setChecked(true);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void HPPA::selectingImager(QAction* selectedAction)
|
||||
{
|
||||
imagerSelected = selectedAction->objectName();
|
||||
QSettings settings;
|
||||
settings.setValue("LastSelectedImagerAction", selectedAction->objectName());
|
||||
settings.sync();
|
||||
}
|
||||
|
||||
void HPPA::createMoveplatformActionGroup()
|
||||
{
|
||||
moveplatformActionGroup = new QActionGroup(this);
|
||||
moveplatformActionGroup->addAction(ui.mAction_is_no_motor);
|
||||
moveplatformActionGroup->addAction(ui.mAction_2AxisMotor);
|
||||
moveplatformActionGroup->addAction(ui.mAction_RobotArm);
|
||||
moveplatformActionGroup->addAction(ui.mAction_1AxisMotor);
|
||||
|
||||
// <20><>ȡ<EFBFBD>ϴ<EFBFBD>ѡ<EFBFBD><D1A1><EFBFBD>Ľ<EFBFBD><C4BD><EFBFBD>
|
||||
QSettings settings;
|
||||
QString lastSelectedAction = settings.value("LastSelectedMoveplatform").toString();
|
||||
|
||||
// <20>ָ<EFBFBD><D6B8>ϴ<EFBFBD>ѡ<EFBFBD><D1A1><EFBFBD>Ľ<EFBFBD><C4BD><EFBFBD>
|
||||
if (lastSelectedAction == "mAction_is_no_motor")
|
||||
{
|
||||
ui.mAction_is_no_motor->setChecked(true);
|
||||
}
|
||||
else if (lastSelectedAction == "mAction_2AxisMotor")
|
||||
{
|
||||
ui.mAction_2AxisMotor->setChecked(true);
|
||||
}
|
||||
else if (lastSelectedAction == "mAction_RobotArm")
|
||||
{
|
||||
ui.mAction_RobotArm->setChecked(true);
|
||||
}
|
||||
else if (lastSelectedAction == "mAction_1AxisMotor")
|
||||
{
|
||||
ui.mAction_1AxisMotor->setChecked(true);
|
||||
}
|
||||
}
|
||||
|
||||
void HPPA::selectingMoveplatform(QAction* selectedAction)
|
||||
{
|
||||
QSettings settings;
|
||||
settings.setValue("LastSelectedMoveplatform", selectedAction->objectName());
|
||||
settings.sync();
|
||||
}
|
||||
|
||||
HPPA::~HPPA()
|
||||
@ -362,6 +502,41 @@ void HPPA::initPanelToolbar()
|
||||
mToolbarMenu->addAction(ui.mainToolBar->toggleViewAction());
|
||||
}
|
||||
|
||||
void HPPA::createOneMotorScenario()
|
||||
{
|
||||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>DockWidget
|
||||
//this->removeDockWidget(ui.mDockWidgetSpectrometer);
|
||||
QList<QDockWidget*> dockWidgets = this->findChildren<QDockWidget*>();
|
||||
for (QDockWidget* dock : dockWidgets)
|
||||
{
|
||||
dock->hide();
|
||||
}
|
||||
|
||||
ui.mDockWidgetSpectralViewer->show();
|
||||
ui.mDockWidgetSpectrometer->show();
|
||||
dock_omc->show();
|
||||
|
||||
//tabifyDockWidget(ui.mDockWidgetSpectrometer, dock_omc);
|
||||
|
||||
//addDockWidget(Qt::RightDockWidgetArea, ui.mDockWidgetSpectralViewer);
|
||||
//addDockWidget(Qt::RightDockWidgetArea, ui.mDockWidgetSpectrometer);
|
||||
//splitDockWidget(ui.mDockWidgetSpectralViewer, ui.mDockWidgetSpectrometer, Qt::Vertical);
|
||||
|
||||
//QDockWidget* dockTop = new QDockWidget(QString::fromLocal8Bit("1"), this);
|
||||
//QDockWidget* dockBottom = new QDockWidget(QString::fromLocal8Bit("2"), this);
|
||||
//QDockWidget* dockBottom3 = new QDockWidget(QString::fromLocal8Bit("3"), this);
|
||||
|
||||
//// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ͻ<EFBFBD> dock
|
||||
//addDockWidget(Qt::RightDockWidgetArea, dockTop);
|
||||
|
||||
//// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>½<EFBFBD> dock<63><6B><EFBFBD><EFBFBD>ʼҲ<CABC><D2B2><EFBFBD>Ҳ<EFBFBD>
|
||||
//addDockWidget(Qt::RightDockWidgetArea, dockBottom);
|
||||
//addDockWidget(Qt::RightDockWidgetArea, dockBottom3);
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD>½<EFBFBD> dock <20>ָ<D6B8><EEB5BD><EFBFBD><EFBFBD> dock <20><><EFBFBD>·<EFBFBD>
|
||||
//splitDockWidget(dockTop, dockBottom, Qt::Horizontal);
|
||||
}
|
||||
|
||||
void HPPA::CalculateIntegratioinTimeRange()
|
||||
{
|
||||
double range = 1 / m_Imager->getFramerate() * 1000;//<2F><><EFBFBD><EFBFBD>
|
||||
@ -373,62 +548,28 @@ void HPPA::CalculateIntegratioinTimeRange()
|
||||
|
||||
void HPPA::onStartRecordStep1()
|
||||
{
|
||||
////<2F><><EFBFBD>Դ<EFBFBD><D4B4>룬<EFBFBD><EBA3AC><EFBFBD><EFBFBD>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD>ɼ<EFBFBD><C9BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
//m_RecordState += 1;
|
||||
|
||||
//if (m_RecordState % 2 == 1)
|
||||
//{
|
||||
// onCreateTab(1);
|
||||
// m_numberOfRecording = 0;
|
||||
// m_Imager->setFileName2Save(m_FilenameLineEdit->text().toStdString());
|
||||
// emit StartRecordSignal();//<2F><><EFBFBD>俪ʼ<E4BFAA>ɼ<EFBFBD><C9BC>ź<EFBFBD>
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// m_Imager->setRecordControlState(false);//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֹͣ<CDA3>ɼ<EFBFBD>
|
||||
|
||||
// ui.action_start_recording->setText(QString::fromLocal8Bit("<22>ɼ<EFBFBD>"));
|
||||
// ui.mainToolBar->widgetForAction(ui.action_start_recording)->setStyleSheet("QWidget{background-color:rgb(0,255,0);}");
|
||||
//}
|
||||
|
||||
|
||||
//ȷ<><C8B7>x<EFBFBD><78><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><CEBB> С<><D0A1> x<><78><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɼ<EFBFBD><C9BC><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><CEBB>
|
||||
int validLineCount = 0;
|
||||
for (size_t i = 0; i < m_pathPlan->getRecordLineTableWidget()->rowCount(); i++)
|
||||
QAction* checked = moveplatformActionGroup->checkedAction();
|
||||
if (!checked)
|
||||
{
|
||||
//xx = xx + ui.xmotor_location_slider->value() < m_pathPlan->getRecordLineTableWidget()->item(i, 1)->text().toDouble();
|
||||
|
||||
if (ui.xmotor_location_slider->value() < m_pathPlan->getRecordLineTableWidget()->item(i, 1)->text().toDouble())
|
||||
{
|
||||
validLineCount++;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (validLineCount < m_pathPlan->getRecordLineTableWidget()->rowCount())
|
||||
{
|
||||
QMessageBox::information(this, QString::fromLocal8Bit("<EFBFBD><EFBFBD>ʾ"), QString::fromLocal8Bit("<EFBFBD>켣x<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"));
|
||||
QMessageBox msgBox;
|
||||
msgBox.setText(QString::fromLocal8Bit("<EFBFBD><EFBFBD>ѡ<EFBFBD><EFBFBD>ɨ<EFBFBD><EFBFBD>ƽ̨<EFBFBD><EFBFBD>"));
|
||||
msgBox.exec();
|
||||
return;
|
||||
}
|
||||
|
||||
//ȷ<EFBFBD><EFBFBD><EFBFBD>ɼ<EFBFBD><EFBFBD>ߴ<EFBFBD><EFBFBD><EFBFBD>
|
||||
if (m_pathPlan->getRecordLineTableWidget()->rowCount() <= 0)
|
||||
{
|
||||
QMessageBox::information(this, QString::fromLocal8Bit("<EFBFBD><EFBFBD>ʾ"), QString::fromLocal8Bit("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɹ켣<EFBFBD><EFBFBD>"));
|
||||
return;
|
||||
}
|
||||
//<EFBFBD>ж<EFBFBD><EFBFBD>ǷǴ<EFBFBD><EFBFBD>ڵ<EFBFBD><EFBFBD>ļ<EFBFBD>
|
||||
FileOperation* fileOperation = new FileOperation();
|
||||
string directory = fileOperation->getDirectoryFromString();
|
||||
//string imgPath = directory + "\\tmp_image";
|
||||
string imgPath = directory + "\\" + m_FilenameLineEdit->text().toStdString();
|
||||
|
||||
//<2F><>ʼ<EFBFBD>ɼ<EFBFBD>
|
||||
m_RecordState += 1;
|
||||
|
||||
if (m_RecordState % 2 == 1)
|
||||
{
|
||||
//<2F>ж<EFBFBD><D0B6>ǷǴ<F1B8B2B8><C7B4>ڵ<EFBFBD><DAB5>ļ<EFBFBD>
|
||||
FileOperation * fileOperation = new FileOperation();
|
||||
string directory = fileOperation->getDirectoryFromString();
|
||||
//string imgPath = directory + "\\tmp_image";
|
||||
string imgPath = directory + "\\" + m_FilenameLineEdit->text().toStdString() + "_" + std::to_string(1);
|
||||
int x = _access(imgPath.c_str(), 0);
|
||||
m_RecordState -= 1;
|
||||
|
||||
string tmp = imgPath + "_" + std::to_string(1) + ".bil";
|
||||
int x = _access(tmp.c_str(), 0);
|
||||
if (!x)//<2F><><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD>ھ<EFBFBD>ִ<EFBFBD>д<EFBFBD>if<69>Ĵ<EFBFBD><C4B4><EFBFBD>
|
||||
{
|
||||
enum QMessageBox::StandardButton response = QMessageBox::question(this, QString::fromLocal8Bit("<EFBFBD><EFBFBD>ʾ"), QString::fromLocal8Bit("<EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڣ<EFBFBD><EFBFBD>Ƿǣ<EFBFBD>"), QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes);;
|
||||
@ -439,50 +580,155 @@ void HPPA::onStartRecordStep1()
|
||||
else
|
||||
{
|
||||
//std::cout << "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>" << std::endl;
|
||||
m_RecordState -= 1;//<2F><><EFBFBD><EFBFBD><EFBFBD>ǵĻ<C7B5><C4BB><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA>ԭ<EFBFBD><D4AD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֹͣ<CDA3>ɼ<EFBFBD>
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
operateWidget = QObject::sender()->objectName();
|
||||
|
||||
//<2F><><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
m_Imager->setFileName2Save(m_FilenameLineEdit->text().toStdString());
|
||||
|
||||
//ɾ<><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>tab
|
||||
ui.ImageViewerTabWidget->clear();
|
||||
|
||||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼x<C2BC><78><EFBFBD><EFBFBD>λ<EFBFBD>õ<EFBFBD><C3B5>ļ<EFBFBD>
|
||||
string x_location = directory + "\\" + m_FilenameLineEdit->text().toStdString() + "x_location.pos";
|
||||
m_hTimesFile = fopen(x_location.c_str(), "w+");
|
||||
|
||||
//<2F><>ʼѭ<CABC><D1AD>
|
||||
m_ForLoopControl->setLoopCount(m_pathPlan->getRecordLineTableWidget()->rowCount());//Ϊѭ<CEAA><D1AD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>߳<EFBFBD><DFB3><EFBFBD><EFBFBD><EFBFBD>ѭ<EFBFBD><D1AD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
emit StartLoopSignal();
|
||||
|
||||
|
||||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>ɫ
|
||||
for (size_t i = 0; i < m_pathPlan->getRecordLineTableWidget()->rowCount(); i++)
|
||||
{
|
||||
for (size_t j = 0; j < m_pathPlan->getRecordLineTableWidget()->columnCount(); j++)
|
||||
{
|
||||
m_pathPlan->getRecordLineTableWidget()->item(i, j)->setBackgroundColor(QColor(240, 240, 240));
|
||||
}
|
||||
}
|
||||
|
||||
ui.action_start_recording->setText(QString::fromLocal8Bit("ֹͣ<EFBFBD>ɼ<EFBFBD>"));
|
||||
ui.mainToolBar->widgetForAction(ui.action_start_recording)->setStyleSheet("QWidget{background-color:rgb(255,0,0);}");
|
||||
}
|
||||
else
|
||||
{
|
||||
m_Imager->setRecordControlState(false);//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֹͣ<CDA3>ɼ<EFBFBD>
|
||||
m_RecordState -= 1;
|
||||
}
|
||||
|
||||
m_ForLoopControl->m_boolQuitLoop = true;//ѭ<><D1AD>ֹͣ
|
||||
QString checkedName = checked->objectName();
|
||||
if (checkedName == "mAction_is_no_motor")
|
||||
{
|
||||
m_RecordState += 1;
|
||||
|
||||
ui.action_start_recording->setText(QString::fromLocal8Bit("<EFBFBD>ɼ<EFBFBD>"));
|
||||
ui.mainToolBar->widgetForAction(ui.action_start_recording)->setStyleSheet("QWidget{background-color:rgb(0,255,0);}");
|
||||
if (m_RecordState % 2 == 1)
|
||||
{
|
||||
ui.ImageViewerTabWidget->clear();
|
||||
|
||||
onCreateTab(0);
|
||||
m_numberOfRecording = 0;
|
||||
|
||||
m_Imager->setFileName2Save(imgPath);
|
||||
m_Imager->setFrameNumber(this->frame_number->text().toInt());
|
||||
emit StartRecordSignal();//<2F><><EFBFBD>俪ʼ<E4BFAA>ɼ<EFBFBD><C9BC>ź<EFBFBD>
|
||||
|
||||
ui.action_start_recording->setText(QString::fromLocal8Bit("ֹͣ<EFBFBD>ɼ<EFBFBD>"));
|
||||
ui.mainToolBar->widgetForAction(ui.action_start_recording)->setStyleSheet("QWidget{background-color:rgb(255,0,0);}");
|
||||
}
|
||||
else
|
||||
{
|
||||
m_Imager->setRecordControlState(false);//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֹͣ<CDA3>ɼ<EFBFBD>
|
||||
m_RecordState -= 1;
|
||||
|
||||
ui.action_start_recording->setText(QString::fromLocal8Bit("<EFBFBD>ɼ<EFBFBD>"));
|
||||
ui.mainToolBar->widgetForAction(ui.action_start_recording)->setStyleSheet("QWidget{background-color:rgb(0,255,0);}");
|
||||
}
|
||||
return;
|
||||
}
|
||||
else if (checkedName == "mAction_1AxisMotor")
|
||||
{
|
||||
m_RecordState += 1;
|
||||
|
||||
if (m_RecordState % 2 == 1)
|
||||
{
|
||||
ui.ImageViewerTabWidget->clear();
|
||||
|
||||
onCreateTab(0);
|
||||
m_numberOfRecording = 0;
|
||||
|
||||
ui.action_start_recording->setText(QString::fromLocal8Bit("ֹͣ<EFBFBD>ɼ<EFBFBD>"));
|
||||
ui.mainToolBar->widgetForAction(ui.action_start_recording)->setStyleSheet("QWidget{background-color:rgb(255,0,0);}");
|
||||
|
||||
//Ӧ<><D3A6><EFBFBD>ȿ<EFBFBD><C8BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˶<EFBFBD><CBB6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˶<EFBFBD><CBB6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ٿ<EFBFBD>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD>Dzɼ<C7B2><C9BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>俪ʼ<E4BFAA>ɼ<EFBFBD><C9BC>źţ<C5BA>
|
||||
m_Imager->setFileName2Save(imgPath);
|
||||
m_Imager->setFrameNumber(this->frame_number->text().toInt());
|
||||
omc->moveMotorAndRecordHyperSpecImg(500);
|
||||
}
|
||||
else
|
||||
{
|
||||
omc->moveMotor2StartPosAndStopRecord();
|
||||
m_RecordState -= 1;
|
||||
|
||||
ui.action_start_recording->setText(QString::fromLocal8Bit("<EFBFBD>ɼ<EFBFBD>"));
|
||||
ui.mainToolBar->widgetForAction(ui.action_start_recording)->setStyleSheet("QWidget{background-color:rgb(0,255,0);}");
|
||||
}
|
||||
return;
|
||||
}
|
||||
else if (checkedName == "mAction_2AxisMotor")
|
||||
{
|
||||
//ȷ<><C8B7>x<EFBFBD><78><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><CEBB> С<><D0A1> x<><78><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɼ<EFBFBD><C9BC><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><CEBB>
|
||||
int validLineCount = 0;
|
||||
for (size_t i = 0; i < m_pathPlan->getRecordLineTableWidget()->rowCount(); i++)
|
||||
{
|
||||
//xx = xx + ui.xmotor_location_slider->value() < m_pathPlan->getRecordLineTableWidget()->item(i, 1)->text().toDouble();
|
||||
|
||||
if (ui.xmotor_location_slider->value() < m_pathPlan->getRecordLineTableWidget()->item(i, 1)->text().toDouble())
|
||||
{
|
||||
validLineCount++;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (validLineCount < m_pathPlan->getRecordLineTableWidget()->rowCount())
|
||||
{
|
||||
QMessageBox::information(this, QString::fromLocal8Bit("<EFBFBD><EFBFBD>ʾ"), QString::fromLocal8Bit("<EFBFBD>켣x<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"));
|
||||
return;
|
||||
}
|
||||
|
||||
//ȷ<><C8B7><EFBFBD>ɼ<EFBFBD><C9BC>ߴ<EFBFBD><DFB4><EFBFBD>
|
||||
if (m_pathPlan->getRecordLineTableWidget()->rowCount() <= 0)
|
||||
{
|
||||
QMessageBox::information(this, QString::fromLocal8Bit("<EFBFBD><EFBFBD>ʾ"), QString::fromLocal8Bit("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɹ켣<EFBFBD><EFBFBD>"));
|
||||
return;
|
||||
}
|
||||
|
||||
//<2F><>ʼ<EFBFBD>ɼ<EFBFBD>
|
||||
m_RecordState += 1;
|
||||
|
||||
if (m_RecordState % 2 == 1)
|
||||
{
|
||||
//
|
||||
operateWidget = QObject::sender()->objectName();
|
||||
|
||||
//ɾ<><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>tab
|
||||
ui.ImageViewerTabWidget->clear();
|
||||
|
||||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼x<C2BC><78><EFBFBD><EFBFBD>λ<EFBFBD>õ<EFBFBD><C3B5>ļ<EFBFBD>
|
||||
string x_location = removeFileExtension(imgPath) + "x_location.pos";
|
||||
m_hTimesFile = fopen(x_location.c_str(), "w+");
|
||||
|
||||
m_Imager->setFileName2Save(imgPath);
|
||||
|
||||
//<2F><>ʼѭ<CABC><D1AD>
|
||||
m_ForLoopControl->setLoopCount(m_pathPlan->getRecordLineTableWidget()->rowCount());//Ϊѭ<CEAA><D1AD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>߳<EFBFBD><DFB3><EFBFBD><EFBFBD><EFBFBD>ѭ<EFBFBD><D1AD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
emit StartLoopSignal();
|
||||
|
||||
|
||||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>ɫ
|
||||
for (size_t i = 0; i < m_pathPlan->getRecordLineTableWidget()->rowCount(); i++)
|
||||
{
|
||||
for (size_t j = 0; j < m_pathPlan->getRecordLineTableWidget()->columnCount(); j++)
|
||||
{
|
||||
m_pathPlan->getRecordLineTableWidget()->item(i, j)->setBackgroundColor(QColor(240, 240, 240));
|
||||
}
|
||||
}
|
||||
|
||||
ui.action_start_recording->setText(QString::fromLocal8Bit("ֹͣ<EFBFBD>ɼ<EFBFBD>"));
|
||||
ui.mainToolBar->widgetForAction(ui.action_start_recording)->setStyleSheet("QWidget{background-color:rgb(255,0,0);}");
|
||||
}
|
||||
else
|
||||
{
|
||||
m_Imager->setRecordControlState(false);//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֹͣ<CDA3>ɼ<EFBFBD>
|
||||
|
||||
m_ForLoopControl->m_boolQuitLoop = true;//ѭ<><D1AD>ֹͣ
|
||||
|
||||
ui.action_start_recording->setText(QString::fromLocal8Bit("<EFBFBD>ɼ<EFBFBD>"));
|
||||
ui.mainToolBar->widgetForAction(ui.action_start_recording)->setStyleSheet("QWidget{background-color:rgb(0,255,0);}");
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
else if (checkedName == "mAction_RobotArm")
|
||||
{
|
||||
//<2F><><EFBFBD>ж<EFBFBD><D0B6>Ƿ<EFBFBD>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ִ<EFBFBD>к<EFBFBD><D0BA><EFBFBD>RobotArmControl::executeTask<73><6B><EFBFBD><EFBFBD><DEB8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾbug
|
||||
m_Imager->setFileName2Save(imgPath);
|
||||
m_Imager->setFrameNumber(this->frame_number->text().toInt());
|
||||
rac->executeTaskWithHyperImager();
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@ -515,7 +761,7 @@ void HPPA::onStartRecordStep2(int lineNumber)
|
||||
else if (lineNumber == -1)
|
||||
{
|
||||
std::cout << "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Զ<EFBFBD><EFBFBD><EFBFBD>ֹ<EFBFBD>ɼ<EFBFBD><EFBFBD><EFBFBD>" << std::endl;
|
||||
m_RecordState++;
|
||||
m_RecordState += 1;
|
||||
|
||||
ui.action_start_recording->setText(QString::fromLocal8Bit("<EFBFBD>ɼ<EFBFBD>"));
|
||||
ui.mainToolBar->widgetForAction(ui.action_start_recording)->setStyleSheet("QWidget{background-color:rgb(0,255,0);}");
|
||||
@ -673,7 +919,7 @@ void HPPA::onLeftMouseButtonPressed(int x, int y)
|
||||
|
||||
FileOperation * fileOperation = new FileOperation();
|
||||
string directory = fileOperation->getDirectoryFromString();
|
||||
string imgPath = directory + "\\" + m_FilenameLineEdit->text().toStdString() + "_" + std::to_string(m_TabWidgetCurrentIndex + 1);
|
||||
string imgPath = directory + "\\" + m_FilenameLineEdit->text().toStdString() + "_" + std::to_string(m_TabWidgetCurrentIndex + 1) + ".bil";
|
||||
|
||||
ImageReaderWriter *ImageReader = new ImageReaderWriter(imgPath.c_str());
|
||||
|
||||
@ -690,15 +936,43 @@ void HPPA::onLeftMouseButtonPressed(int x, int y)
|
||||
QLineSeries *series = new QLineSeries();
|
||||
//series->clear();//////////////////////////////
|
||||
|
||||
for (size_t i = 0; i < m_Imager->getBandCount(); i++)
|
||||
QString imagerSelected = mImagerGroup->checkedAction()->objectName();
|
||||
if (imagerSelected == "mActionPica_L" || imagerSelected == "mActionCorning_410" || imagerSelected == "mActionPika_XC2")
|
||||
{
|
||||
//malloc<6F><63><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڴ<EFBFBD><DAB4>÷<EFBFBD>1<EFBFBD><31><EFBFBD><EFBFBD><EFBFBD>Ե<EFBFBD><D4B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
series->append(m_Imager->getWavelengthAtBand(i), data[i]);
|
||||
int start = m_Imager->getStartBand();
|
||||
for (size_t i = 0; i < m_Imager->getBandCount() - 1; i++)
|
||||
{
|
||||
//malloc<6F><63><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڴ<EFBFBD><DAB4>÷<EFBFBD>1<EFBFBD><31><EFBFBD><EFBFBD><EFBFBD>Ե<EFBFBD><D4B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
series->append(m_Imager->getWavelengthAtBand(i + start), data[i]);
|
||||
|
||||
////malloc<6F><63><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڴ<EFBFBD><DAB4>÷<EFBFBD>2<EFBFBD><32>ָ<EFBFBD><D6B8><EFBFBD><EFBFBD>ȡ
|
||||
//series->append(m_Imager->getWavelengthAtBand(i), *data);
|
||||
//data++;
|
||||
////malloc<6F><63><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڴ<EFBFBD><DAB4>÷<EFBFBD>2<EFBFBD><32>ָ<EFBFBD><D6B8><EFBFBD><EFBFBD>ȡ
|
||||
//series->append(m_Imager->getWavelengthAtBand(i), *data);
|
||||
//data++;
|
||||
}
|
||||
}
|
||||
else if (imagerSelected == "mActionPica_NIR")
|
||||
{
|
||||
int start = 0;
|
||||
for (size_t i = 0; i < m_Imager->getBandCount() - 1; i++)
|
||||
{
|
||||
//malloc<6F><63><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڴ<EFBFBD><DAB4>÷<EFBFBD>1<EFBFBD><31><EFBFBD><EFBFBD><EFBFBD>Ե<EFBFBD><D4B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
series->append(m_Imager->getWavelengthAtBand(i + start), data[i]);
|
||||
|
||||
////malloc<6F><63><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڴ<EFBFBD><DAB4>÷<EFBFBD>2<EFBFBD><32>ָ<EFBFBD><D6B8><EFBFBD><EFBFBD>ȡ
|
||||
//series->append(m_Imager->getWavelengthAtBand(i), *data);
|
||||
//data++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
QMessageBox msgBox;
|
||||
msgBox.setText(QString::fromLocal8Bit("<EFBFBD><EFBFBD>ѡ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"));
|
||||
msgBox.exec();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
QChart *chart = new QChart();
|
||||
chart->legend()->hide();
|
||||
@ -728,7 +1002,7 @@ void HPPA::timerEvent(QTimerEvent *event)
|
||||
{
|
||||
if (m_xMotor == nullptr || m_yMotor == nullptr)
|
||||
{
|
||||
qDebug() << "Motor pointer is null!!!!!";
|
||||
//qDebug() << "Motor pointer is null!!!!!";
|
||||
|
||||
xmotor_state_label1->setStyleSheet("QLabel{background-color:rgb(255,0,0);}");
|
||||
SetXMotorWidgetEnable(false);
|
||||
@ -746,7 +1020,7 @@ void HPPA::timerEvent(QTimerEvent *event)
|
||||
}
|
||||
ByteBack xMotorState = m_xMotor->GetState();//ִ<><D6B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
|
||||
std::cout << "------------------------------------------x<><78><EFBFBD><EFBFBD><EFBFBD>ٶȣ<D9B6>" << xMotorState.Speed << std::endl;
|
||||
//std::cout << "------------------------------------------x<><78><EFBFBD><EFBFBD><EFBFBD>ٶȣ<D9B6>" << xMotorState.Speed << std::endl;
|
||||
|
||||
if (xMotorState.Speed == -1000000)
|
||||
{
|
||||
@ -1491,6 +1765,7 @@ void HPPA::newMotor()
|
||||
m_yMotor = new VinceControl(NETTCP, 6001);//ԭ<><D4AD><EFBFBD><EFBFBD>6001<30><31><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ԣ<EFBFBD>6003
|
||||
|
||||
m_pathPlan->setMotor(m_xMotor, m_yMotor);
|
||||
QString imagerSelected = mImagerGroup->checkedAction()->objectName();
|
||||
if (imagerSelected == "mActionPica_NIR")
|
||||
{
|
||||
connect(m_xMotor, SIGNAL(newTCPConnection(VinceControl*)), this, SLOT(setMotorParamMicroscope(VinceControl*)));
|
||||
@ -1626,6 +1901,7 @@ void HPPA::onconnect()
|
||||
m_RecordThread = new QThread();
|
||||
|
||||
//<2F><><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʹ<EFBFBD><CDB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>mImagerGroup
|
||||
QString imagerSelected = mImagerGroup->checkedAction()->objectName();
|
||||
if (imagerSelected == "mActionPica_L")
|
||||
{
|
||||
m_Imager = new ResononPicaLImager();
|
||||
@ -1636,11 +1912,11 @@ void HPPA::onconnect()
|
||||
}
|
||||
else if (imagerSelected == "mActionPika_XC2")
|
||||
{
|
||||
|
||||
m_Imager = new ResononPicaLImager();
|
||||
}
|
||||
else if (imagerSelected == "mActionCorning_410")
|
||||
{
|
||||
|
||||
m_Imager = new Corning410Imager();
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1656,7 +1932,7 @@ void HPPA::onconnect()
|
||||
|
||||
m_Imager->connect_imager(frame_number->text().toInt());
|
||||
m_Imager->setFileName2Save(m_FilenameLineEdit->text().toStdString());
|
||||
connect(m_Imager, SIGNAL(PlotSignal()), this, SLOT(onPlotHyperspectralImageRgbImage()));
|
||||
connect(m_Imager, SIGNAL(PlotSignal(int)), this, SLOT(onPlotHyperspectralImageRgbImage(int)));
|
||||
connect(m_Imager, SIGNAL(RecordFinishedSignal_WhenFrameNumberMeet()), this, SLOT(onRecordFinishedSignal_WhenFrameNumberMeet()));
|
||||
connect(m_Imager, SIGNAL(RecordFinishedSignal_WhenFrameNumberNotMeet()), this, SLOT(onRecordFinishedSignal_WhenFrameNumberNotMeet()));
|
||||
connect(m_Imager, SIGNAL(SpectralSignal(int)), this, SLOT(PlotSpectral(int)));
|
||||
@ -1816,15 +2092,42 @@ void HPPA::onAbout()
|
||||
void HPPA::onDark()
|
||||
{
|
||||
QMessageBox msgBox;
|
||||
msgBox.setText(QString::fromLocal8Bit("<EFBFBD><EFBFBD>ȷ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͷ<EFBFBD>Ǹ<EFBFBD><EFBFBD>ϣ<EFBFBD>"));
|
||||
msgBox.setText(QString::fromLocal8Bit("<EFBFBD>ɼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȷ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͷ<EFBFBD>Ǹ<EFBFBD><EFBFBD>ϣ<EFBFBD>"));
|
||||
msgBox.exec();
|
||||
|
||||
bool isMotorEnable = this->ui.mAction_2AxisMotor->isChecked();
|
||||
if (isMotorEnable)
|
||||
{
|
||||
//<2F>ƶ<EFBFBD>x<EFBFBD><78><EFBFBD><EFBFBD>
|
||||
if (!isMotorConnected(m_xMotor))
|
||||
{
|
||||
m_xMotor->EnableMotro();
|
||||
m_lXmotorLocationOfStartRecord = m_xMotor->GetLocationNow();
|
||||
m_xMotor->SettingSpeed(ui.xmotor_speed_slider->OriginalValue());
|
||||
//m_xMotor->SettingSpeed(m_lManualSpeedOfXMotor);
|
||||
|
||||
m_xMotor->MoveMotar(true);
|
||||
}
|
||||
}
|
||||
|
||||
emit RecordDarlSignal();
|
||||
}
|
||||
|
||||
void HPPA::recordDarkFinish()
|
||||
{
|
||||
ui.mainToolBar->widgetForAction(ui.action_dark)->setStyleSheet("QWidget{background-color:rgb(0,255,0);}");
|
||||
|
||||
bool isMotorEnable = this->ui.mAction_2AxisMotor->isChecked();
|
||||
if (isMotorEnable)
|
||||
{
|
||||
//<2F>ƶ<EFBFBD>x<EFBFBD><78><EFBFBD><EFBFBD>
|
||||
if (!isMotorConnected(m_xMotor))
|
||||
{
|
||||
//x<><78><EFBFBD>ﷵ<EFBFBD>زɼ<D8B2>ǰ<EFBFBD><C7B0>λ<EFBFBD><CEBB>
|
||||
m_xMotor->SettingSpeed(m_lManualSpeedOfXMotor);
|
||||
m_xMotor->MoveToLocation(m_lXmotorLocationOfStartRecord);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void HPPA::onReference()
|
||||
@ -1833,15 +2136,19 @@ void HPPA::onReference()
|
||||
msgBox.setText(QString::fromLocal8Bit("<EFBFBD><EFBFBD>ȷ<EFBFBD><EFBFBD><EFBFBD>װ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȷ<EFBFBD><EFBFBD>"));
|
||||
msgBox.exec();
|
||||
|
||||
//<2F>ƶ<EFBFBD>x<EFBFBD><78><EFBFBD><EFBFBD>
|
||||
if (!isMotorConnected(m_xMotor))
|
||||
bool isMotorEnable = this->ui.mAction_2AxisMotor->isChecked();
|
||||
if (isMotorEnable)
|
||||
{
|
||||
m_xMotor->EnableMotro();
|
||||
m_lXmotorLocationOfStartRecord = m_xMotor->GetLocationNow();
|
||||
m_xMotor->SettingSpeed(ui.xmotor_speed_slider->OriginalValue());
|
||||
//m_xMotor->SettingSpeed(m_lManualSpeedOfXMotor);
|
||||
//<2F>ƶ<EFBFBD>x<EFBFBD><78><EFBFBD><EFBFBD>
|
||||
if (!isMotorConnected(m_xMotor))
|
||||
{
|
||||
m_xMotor->EnableMotro();
|
||||
m_lXmotorLocationOfStartRecord = m_xMotor->GetLocationNow();
|
||||
m_xMotor->SettingSpeed(ui.xmotor_speed_slider->OriginalValue());
|
||||
//m_xMotor->SettingSpeed(m_lManualSpeedOfXMotor);
|
||||
|
||||
m_xMotor->MoveMotar(true);
|
||||
m_xMotor->MoveMotar(true);
|
||||
}
|
||||
}
|
||||
|
||||
emit RecordWhiteSignal();
|
||||
@ -1851,17 +2158,30 @@ void HPPA::recordWhiteFinish()
|
||||
{
|
||||
ui.mainToolBar->widgetForAction(ui.action_reference)->setStyleSheet("QWidget{background-color:rgb(0,255,0);}");
|
||||
|
||||
//<2F>ƶ<EFBFBD>x<EFBFBD><78><EFBFBD><EFBFBD>
|
||||
if (!isMotorConnected(m_xMotor))
|
||||
bool isMotorEnable = this->ui.mAction_2AxisMotor->isChecked();
|
||||
if (isMotorEnable)
|
||||
{
|
||||
//x<><78><EFBFBD>ﷵ<EFBFBD>زɼ<EFBFBD>ǰ<EFBFBD><EFBFBD>λ<EFBFBD><EFBFBD>
|
||||
m_xMotor->SettingSpeed(m_lManualSpeedOfXMotor);
|
||||
m_xMotor->MoveToLocation(m_lXmotorLocationOfStartRecord);
|
||||
//<EFBFBD>ƶ<EFBFBD>x<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
if (!isMotorConnected(m_xMotor))
|
||||
{
|
||||
//x<><78><EFBFBD>ﷵ<EFBFBD>زɼ<D8B2>ǰ<EFBFBD><C7B0>λ<EFBFBD><CEBB>
|
||||
m_xMotor->SettingSpeed(m_lManualSpeedOfXMotor);
|
||||
m_xMotor->MoveToLocation(m_lXmotorLocationOfStartRecord);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void HPPA::onPlotHyperspectralImageRgbImage()
|
||||
void HPPA::onPlotHyperspectralImageRgbImage(int number)
|
||||
{
|
||||
//ʹ<>û<EFBFBD>е<EFBFBD>۲ɼ<DBB2>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֹͣ<CDA3>ɼ<EFBFBD><C9BC><EFBFBD><EFBFBD><EFBFBD>˲<EFBFBD><CBB2><EFBFBD>ֿ<EFBFBD>ʼ<EFBFBD>ɼ<EFBFBD><C9BC><EFBFBD><EFBFBD>ᵼ<EFBFBD><E1B5BC><EFBFBD>ϴβɼ<CEB2><C9BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>źŵ<C5BA><C5B5>ô˲ۺ<CBB2><DBBA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
QAction* checked = moveplatformActionGroup->checkedAction();
|
||||
QString checkedName = checked->objectName();
|
||||
if (number == -1 && checkedName == "mAction_RobotArm")
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
//return;
|
||||
//<2F><>ȡ<EFBFBD><C8A1>ͼ<EFBFBD>ؼ<EFBFBD>
|
||||
QWidget* currentWidget = ui.ImageViewerTabWidget->widget(m_numberOfRecording);
|
||||
QList<ImageViewer *> currentImageViewer = currentWidget->findChildren<ImageViewer *>();
|
||||
@ -1878,10 +2198,12 @@ void HPPA::onPlotHyperspectralImageRgbImage()
|
||||
|
||||
//20241225
|
||||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>rgb
|
||||
FileOperation* fileOperation = new FileOperation();
|
||||
string directory = fileOperation->getDirectoryOfExe();
|
||||
string rgbFilePathNoStrech = directory + "\\tmp_image_no_strech2.png";//<2F><><EFBFBD><EFBFBD>ͼƬ
|
||||
cv::imwrite(rgbFilePathNoStrech, rgbImageStretched);
|
||||
//FileOperation* fileOperation = new FileOperation();
|
||||
//string directory = fileOperation->getDirectoryOfExe();
|
||||
//string rgbFilePathNoStrech = directory + "\\tmp_image_no_strech.png";//δ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͼƬ
|
||||
//string rgbFilePathStrech = directory + "\\tmp_image_strech.png";//<2F><><EFBFBD><EFBFBD>ͼƬ
|
||||
//cv::imwrite(rgbFilePathNoStrech, rgbImage);
|
||||
//cv::imwrite(rgbFilePathStrech, rgbImageStretched);
|
||||
|
||||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA>ʾ<EFBFBD><CABE>ͼ<EFBFBD><CDBC>--qt<71>汾
|
||||
//QRect CuttedRect = m_Imager->getRgbImage()->m_QRgbImage->rect();//<2F>Ȼ<EFBFBD>ȡimage<67><65><EFBFBD><EFBFBD>rect
|
||||
@ -1902,7 +2224,7 @@ void HPPA::PlotSpectral(int state)
|
||||
|
||||
ImageProcessor imageProcessor;
|
||||
//cv::Mat grayImage(*m_Imager->getRgbImage()->m_matFocusGrayImage, cv::Range::all(), cv::Range::all());//2022.3.18<EFBFBD>ع<EFBFBD><EFBFBD><EFBFBD>
|
||||
cv::Mat grayImage(*m_Imager->getMatFocusGrayImage(), cv::Range::all(), cv::Range::all());
|
||||
//cv::Mat grayImage(*m_Imager->getMatFocusGrayImage(), cv::Range::all(), cv::Range::all());
|
||||
//currentImageViewer[0]->SetImage(&QPixmap::fromImage(imageProcessor.Mat2QImage(grayImage)));//<2F><><EFBFBD><EFBFBD>ͼ<EFBFBD><CDBC>
|
||||
|
||||
currentImageViewer[0]->SetImage(&QPixmap::fromImage(m_Imager->getQImageFocusGrayImage()));//<2F><><EFBFBD><EFBFBD>ͼ<EFBFBD><CDBC>
|
||||
@ -1915,7 +2237,8 @@ void HPPA::PlotSpectral(int state)
|
||||
{
|
||||
//malloc<6F><63><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڴ<EFBFBD><DAB4>÷<EFBFBD>1<EFBFBD><31><EFBFBD><EFBFBD><EFBFBD>Ե<EFBFBD><D4B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
//series->append(i, m_Imager->buffer[i + 5 * 900]);
|
||||
series->append(i, m_Imager->buffer[900 * 150 + i]);
|
||||
//series->append(i, m_Imager->buffer[900 * 150 + i]);
|
||||
series->append(i, m_Imager->buffer[1368 * 150 + i]);
|
||||
}
|
||||
|
||||
QChart *chart = new QChart();
|
||||
@ -1974,12 +2297,49 @@ void HPPA::PlotSpectral(int state)
|
||||
|
||||
void HPPA::onRecordFinishedSignal_WhenFrameNumberMeet()
|
||||
{
|
||||
QAction* checked = moveplatformActionGroup->checkedAction();
|
||||
QString checkedName = checked->objectName();
|
||||
if (checkedName == "mAction_2AxisMotor")//<2F><><EFBFBD>ж<EFBFBD><D0B6><EFBFBD><EFBFBD>ɼ<EFBFBD><C9BC>ߣ<EFBFBD><DFA3>м<EFBFBD><D0BC><EFBFBD>ij<EFBFBD><C4B3><EFBFBD>ɼ<EFBFBD><C9BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɺ<C9BA><F3B2BBB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɼ<EFBFBD><C9BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
std::cout << "ֹͣ<EFBFBD>ɼ<EFBFBD>ԭ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>֡<EFBFBD><EFBFBD><EFBFBD>ɼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˡ<EFBFBD>" << std::endl;
|
||||
|
||||
ui.action_start_recording->setText(QString::fromLocal8Bit("<EFBFBD>ɼ<EFBFBD>"));
|
||||
ui.mainToolBar->widgetForAction(ui.action_start_recording)->setStyleSheet("QWidget{background-color:rgb(0,255,0);}");
|
||||
|
||||
m_RecordState++;//<2F><><EFBFBD>Զ<EFBFBD>ֹͣ<CDA3>ɼ<EFBFBD>
|
||||
|
||||
if (checkedName == "mAction_1AxisMotor")
|
||||
{
|
||||
omc->moveMotor2StartPosAndStopRecord();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void HPPA::onRecordFinishedSignal_WhenFrameNumberNotMeet()
|
||||
{
|
||||
QAction* checked = moveplatformActionGroup->checkedAction();
|
||||
QString checkedName = checked->objectName();
|
||||
|
||||
if (checkedName == "mAction_RobotArm")//<2F><>е<EFBFBD>ۻ<EFBFBD><DBBB><EFBFBD>ֹͣ<CDA3>ɼ<EFBFBD><C9BC><EFBFBD><EFBFBD><EFBFBD>˲<EFBFBD><CBB2><EFBFBD>ֿ<EFBFBD>ʼ<EFBFBD>ɼ<EFBFBD><C9BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ui.action_start_recording<6E><67>ʾ<EFBFBD>쳣
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (checkedName == "mAction_2AxisMotor")//<2F><><EFBFBD>ж<EFBFBD><D0B6><EFBFBD><EFBFBD>ɼ<EFBFBD><C9BC>ߣ<EFBFBD><DFA3>м<EFBFBD><D0BC><EFBFBD>ij<EFBFBD><C4B3><EFBFBD>ɼ<EFBFBD><C9BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɺ<C9BA><F3B2BBB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɼ<EFBFBD><C9BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
std::cout << "ֹͣ<EFBFBD>ɼ<EFBFBD>ԭ<EFBFBD><EFBFBD>1<EFBFBD><EFBFBD>֡<EFBFBD><EFBFBD>û<EFBFBD>вɼ<EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ﵽ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD>ã<EFBFBD><EFBFBD><EFBFBD>2<EFBFBD><EFBFBD><EFBFBD>ֶ<EFBFBD>ֹͣ<EFBFBD>ɼ<EFBFBD><EFBFBD><EFBFBD>" << std::endl;
|
||||
|
||||
ui.action_start_recording->setText(QString::fromLocal8Bit("<EFBFBD>ɼ<EFBFBD>"));
|
||||
ui.mainToolBar->widgetForAction(ui.action_start_recording)->setStyleSheet("QWidget{background-color:rgb(0,255,0);}");
|
||||
|
||||
m_RecordState++;
|
||||
}
|
||||
|
||||
ForLoopControl::ForLoopControl()
|
||||
|
||||
18
HPPA/HPPA.h
18
HPPA/HPPA.h
@ -33,11 +33,14 @@
|
||||
#include "adjustTable.h"
|
||||
#include "PowerControl.h"
|
||||
#include "PathPlan.h"
|
||||
#include "RobotArmControl.h"
|
||||
#include "OneMotorControl.h"
|
||||
|
||||
#include "hppaConfigFile.h"
|
||||
#include "path_tc.h"
|
||||
|
||||
#include "ResononNirImager.h"
|
||||
#include "Corning410Imager.h"
|
||||
|
||||
#define PI 3.1415926
|
||||
|
||||
@ -236,16 +239,23 @@ private:
|
||||
void getRequest(QString str);
|
||||
|
||||
QActionGroup* mImagerGroup = nullptr;
|
||||
QString imagerSelected;
|
||||
void createActionGroups();
|
||||
void selectingImager(QAction* selectedAction);
|
||||
QActionGroup* moveplatformActionGroup = nullptr;
|
||||
void createMoveplatformActionGroup();
|
||||
void selectingMoveplatform(QAction* selectedAction);
|
||||
RobotArmControl* rac;
|
||||
|
||||
OneMotorControl* omc;
|
||||
QDockWidget* dock_omc;
|
||||
|
||||
|
||||
PathPlan* m_pathPlan;
|
||||
|
||||
FILE* m_hTimesFile;
|
||||
|
||||
public Q_SLOTS:
|
||||
void onPlotHyperspectralImageRgbImage();
|
||||
void onPlotHyperspectralImageRgbImage(int number);
|
||||
void PlotSpectral(int state);
|
||||
void onRecordFinishedSignal_WhenFrameNumberMeet();
|
||||
void onRecordFinishedSignal_WhenFrameNumberNotMeet();
|
||||
@ -334,6 +344,10 @@ public Q_SLOTS:
|
||||
|
||||
void requestFinished(QNetworkReply* reply);
|
||||
|
||||
void recordFromRobotArm(int fileCounter);
|
||||
void recordHyperSpecImg(int status);
|
||||
|
||||
void createOneMotorScenario();
|
||||
signals:
|
||||
void StartFocusSignal();
|
||||
void StartLoopSignal();
|
||||
|
||||
88
HPPA/HPPA.ui
88
HPPA/HPPA.ui
@ -6,8 +6,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>1078</width>
|
||||
<height>623</height>
|
||||
<width>1194</width>
|
||||
<height>834</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
@ -46,7 +46,7 @@
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>1</number>
|
||||
<number>0</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="tab_4">
|
||||
<attribute name="title">
|
||||
@ -84,7 +84,7 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>1078</width>
|
||||
<width>1194</width>
|
||||
<height>30</height>
|
||||
</rect>
|
||||
</property>
|
||||
@ -162,8 +162,19 @@ color:white;
|
||||
<string>窗口</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QMenu" name="menu_2">
|
||||
<property name="title">
|
||||
<string>扫描平台</string>
|
||||
</property>
|
||||
<addaction name="mAction_is_no_motor"/>
|
||||
<addaction name="mAction_1AxisMotor"/>
|
||||
<addaction name="mAction_2AxisMotor"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="mAction_RobotArm"/>
|
||||
</widget>
|
||||
<addaction name="file"/>
|
||||
<addaction name="menuspectrometer"/>
|
||||
<addaction name="menu_2"/>
|
||||
<addaction name="mWindowsMenu"/>
|
||||
<addaction name="menuhelp"/>
|
||||
</widget>
|
||||
@ -433,19 +444,19 @@ QDockWidget::title {
|
||||
<widget class="QWidget" name="dockWidgetContents_4">
|
||||
<layout class="QGridLayout" name="gridLayout_13">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item row="1" column="0">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_11">
|
||||
@ -697,19 +708,19 @@ QDockWidget::title {
|
||||
<widget class="QWidget" name="dockWidgetContents_5">
|
||||
<layout class="QGridLayout" name="gridLayout_14">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QGroupBox" name="groupBox_2">
|
||||
@ -1535,6 +1546,55 @@ QDockWidget::title {
|
||||
<string>工具栏</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="action_2">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>马达</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="mAction_is_no_motor">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>无</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="mAction_2AxisMotor">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>2 轴线性马达</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="mAction_RobotArm">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>机械臂</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="mAction_1AxisMotor">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>1 轴线性马达</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<layoutdefault spacing="6" margin="11"/>
|
||||
<customwidgets>
|
||||
|
||||
@ -55,16 +55,16 @@
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
|
||||
<IncludePath>D:\cpp_library\gdal2.2.3_vs2017\include;C:\Program Files\ResononAPI\include;D:\cpp_library\opencv3.4.11\opencv\build\include;D:\cpp_library\opencv3.4.11\opencv\build\include\opencv;D:\cpp_library\opencv3.4.11\opencv\build\include\opencv2;D:\cpp_project_vs2022\AutoFocus_InspireLinearMotor_DLL\AutoFocus_InspireLinearMotor_DLL\SDKs\PCOMM\Include;D:\cpp_project_vs2022\AutoFocus_InspireLinearMotor_DLL\AutoFocus_InspireLinearMotor_DLL\SDKs\PortControl;D:\cpp_project_vs2022\AutoFocus_InspireLinearMotor_DLL\AutoFocus_InspireLinearMotor_DLL;D:\cpp_project_vs2022\HPPA\HPPA;D:\cpp_library\libconfig-1.7.3\lib;D:\cpp_project_vs2022\HPPA\vincecontrol;D:\cpp_library\vincecontrol_vs2017;$(IncludePath)</IncludePath>
|
||||
<LibraryPath>D:\cpp_library\opencv3.4.11\opencv\build\x64\vc15\lib;D:\cpp_library\gdal2.2.3_vs2017\lib;C:\Program Files\ResononAPI\lib64;D:\cpp_project_vs2022\AutoFocus_InspireLinearMotor_DLL\x64\Debug;D:\cpp_library\libconfig-1.7.3\build\x64;D:\cpp_project_vs2022\HPPA\x64\Debug;$(LibraryPath)</LibraryPath>
|
||||
<IncludePath>D:\cpp_library\gdal2.2.3_vs2017\include;C:\Program Files\ResononAPI\include;D:\cpp_library\opencv3.4.11\opencv\build\include;D:\cpp_library\opencv3.4.11\opencv\build\include\opencv;D:\cpp_library\opencv3.4.11\opencv\build\include\opencv2;D:\cpp_project_vs2022\AutoFocus_InspireLinearMotor_DLL\AutoFocus_InspireLinearMotor_DLL\SDKs\PCOMM\Include;D:\cpp_project_vs2022\AutoFocus_InspireLinearMotor_DLL\AutoFocus_InspireLinearMotor_DLL\SDKs\PortControl;D:\cpp_project_vs2022\AutoFocus_InspireLinearMotor_DLL\AutoFocus_InspireLinearMotor_DLL;D:\cpp_project_vs2022\HPPA\HPPA;D:\cpp_library\libconfig-1.7.3\lib;D:\cpp_project_vs2022\HPPA\vincecontrol;D:\cpp_library\vincecontrol_vs2017;C:\XIMEA\API\xiAPI;D:\cpp_project_vs2022\HPPA\IrisMultiMotorController\IrisMultiMotorController;$(IncludePath)</IncludePath>
|
||||
<LibraryPath>D:\cpp_library\opencv3.4.11\opencv\build\x64\vc15\lib;D:\cpp_library\gdal2.2.3_vs2017\lib;C:\Program Files\ResononAPI\lib64;D:\cpp_project_vs2022\AutoFocus_InspireLinearMotor_DLL\x64\Debug;D:\cpp_library\libconfig-1.7.3\build\x64;D:\cpp_project_vs2022\HPPA\x64\Debug;C:\XIMEA\API\xiAPI;D:\cpp_project_vs2022\HPPA\IrisMultiMotorController\x64\Debug;$(LibraryPath)</LibraryPath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
|
||||
<IncludePath>D:\cpp_library\gdal2.2.3_vs2017\include;C:\Program Files\ResononAPI\include;D:\cpp_library\opencv3.4.11\opencv\build\include;D:\cpp_library\opencv3.4.11\opencv\build\include\opencv;D:\cpp_library\opencv3.4.11\opencv\build\include\opencv2;D:\cpp_project_vs2022\AutoFocus_InspireLinearMotor_DLL\AutoFocus_InspireLinearMotor_DLL\SDKs\PCOMM\Include;D:\cpp_project_vs2022\AutoFocus_InspireLinearMotor_DLL\AutoFocus_InspireLinearMotor_DLL\SDKs\PortControl;D:\cpp_project_vs2022\AutoFocus_InspireLinearMotor_DLL\AutoFocus_InspireLinearMotor_DLL;D:\cpp_project_vs2022\HPPA\HPPA;D:\cpp_library\libconfig-1.7.3\lib;D:\cpp_project_vs2022\HPPA\vincecontrol;$(IncludePath)</IncludePath>
|
||||
<LibraryPath>D:\cpp_library\opencv3.4.11\opencv\build\x64\vc15\lib;D:\cpp_library\vincecontrol_vs2017_release;D:\cpp_library\gdal2.2.3_vs2017\lib;C:\Program Files\ResononAPI\lib64;D:\cpp_project_vs2022\AutoFocus_InspireLinearMotor_DLL\x64\Release;D:\cpp_library\libconfig-1.7.3\build\x64;$(LibraryPath)</LibraryPath>
|
||||
<IncludePath>D:\cpp_library\gdal2.2.3_vs2017\include;C:\Program Files\ResononAPI\include;D:\cpp_library\opencv3.4.11\opencv\build\include;D:\cpp_library\opencv3.4.11\opencv\build\include\opencv;D:\cpp_library\opencv3.4.11\opencv\build\include\opencv2;D:\cpp_project_vs2022\AutoFocus_InspireLinearMotor_DLL\AutoFocus_InspireLinearMotor_DLL\SDKs\PCOMM\Include;D:\cpp_project_vs2022\AutoFocus_InspireLinearMotor_DLL\AutoFocus_InspireLinearMotor_DLL\SDKs\PortControl;D:\cpp_project_vs2022\AutoFocus_InspireLinearMotor_DLL\AutoFocus_InspireLinearMotor_DLL;D:\cpp_project_vs2022\HPPA\HPPA;D:\cpp_library\libconfig-1.7.3\lib;D:\cpp_project_vs2022\HPPA\vincecontrol;C:\XIMEA\API\xiAPI;D:\cpp_project_vs2022\HPPA\IrisMultiMotorController\IrisMultiMotorController;$(IncludePath)</IncludePath>
|
||||
<LibraryPath>D:\cpp_library\opencv3.4.11\opencv\build\x64\vc15\lib;D:\cpp_library\vincecontrol_vs2017_release;D:\cpp_library\gdal2.2.3_vs2017\lib;C:\Program Files\ResononAPI\lib64;D:\cpp_project_vs2022\AutoFocus_InspireLinearMotor_DLL\x64\Release;D:\cpp_library\libconfig-1.7.3\build\x64;D:\cpp_project_vs2022\IrisMultiMotorController\x64\Release;C:\XIMEA\API\xiAPI;$(LibraryPath)</LibraryPath>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<Link>
|
||||
<AdditionalDependencies>opencv_world3411.lib;opencv_world3411d.lib;gdal_i.lib;resonon-basler.lib;AutoFocus_InspireLinearMotor_DLL.lib;libconfig++d.lib;vincecontrol.lib;resonon-allied.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalDependencies>opencv_world3411.lib;opencv_world3411d.lib;gdal_i.lib;resonon-basler.lib;AutoFocus_InspireLinearMotor_DLL.lib;libconfig++d.lib;vincecontrol.lib;resonon-allied.lib;xiapi64.lib;IrisMultiMotorController.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>D:\cpp_project_vs2022\HPPA\x64\Debug;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
</Link>
|
||||
<ClCompile>
|
||||
@ -73,7 +73,7 @@
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<Link>
|
||||
<AdditionalDependencies>opencv_world3411.lib;vincecontrol.lib;gdal_i.lib;resonon-basler.lib;resonon-allied.lib;AutoFocus_InspireLinearMotor_DLL.lib;libconfig++.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalDependencies>opencv_world3411.lib;vincecontrol.lib;gdal_i.lib;resonon-basler.lib;resonon-allied.lib;AutoFocus_InspireLinearMotor_DLL.lib;libconfig++.lib;xiapi64.lib;IrisMultiMotorController.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>D:\cpp_project_vs2022\HPPA\x64\Release;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
@ -86,7 +86,7 @@
|
||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
@ -106,8 +106,12 @@
|
||||
<ItemGroup>
|
||||
<ClCompile Include="aboutWindow.cpp" />
|
||||
<ClCompile Include="adjustTable.cpp" />
|
||||
<ClCompile Include="Corning410Imager.cpp" />
|
||||
<ClCompile Include="hppaConfigFile.cpp" />
|
||||
<ClCompile Include="ImagerOperationBase.cpp" />
|
||||
<ClCompile Include="imager_base.cpp" />
|
||||
<ClCompile Include="irisximeaimager.cpp" />
|
||||
<ClCompile Include="OneMotorControl.cpp" />
|
||||
<ClCompile Include="PathPlan.cpp" />
|
||||
<ClCompile Include="path_tc.cpp" />
|
||||
<ClCompile Include="PowerControl.cpp" />
|
||||
@ -116,6 +120,7 @@
|
||||
<ClCompile Include="resononImager.cpp" />
|
||||
<ClCompile Include="ResononNirImager.cpp" />
|
||||
<ClCompile Include="RgbCameraOperation.cpp" />
|
||||
<ClCompile Include="RobotArmControl.cpp" />
|
||||
<ClCompile Include="stdafx.cpp">
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
|
||||
@ -137,8 +142,10 @@
|
||||
<ClCompile Include="imagerSimulatioin.cpp" />
|
||||
<ClCompile Include="ImageViewer.cpp" />
|
||||
<ClCompile Include="main.cpp" />
|
||||
<QtUic Include="oneMotorControl.ui" />
|
||||
<QtUic Include="PathPlan.ui" />
|
||||
<QtUic Include="PowerControl.ui" />
|
||||
<QtUic Include="RobotArmControl.ui" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<QtMoc Include="fileOperation.h" />
|
||||
@ -153,6 +160,11 @@
|
||||
<QtMoc Include="adjustTable.h" />
|
||||
<QtMoc Include="PowerControl.h" />
|
||||
<QtMoc Include="PathPlan.h" />
|
||||
<QtMoc Include="RobotArmControl.h" />
|
||||
<QtMoc Include="Corning410Imager.h" />
|
||||
<ClInclude Include="imager_base.h" />
|
||||
<ClInclude Include="irisximeaimager.h" />
|
||||
<QtMoc Include="OneMotorControl.h" />
|
||||
<ClInclude Include="utility_tc.h" />
|
||||
<QtMoc Include="aboutWindow.h" />
|
||||
<ClInclude Include="hppaConfigFile.h" />
|
||||
|
||||
@ -21,6 +21,12 @@
|
||||
<UniqueIdentifier>{639EADAA-A684-42e4-A9AD-28FC9BCB8F7C}</UniqueIdentifier>
|
||||
<Extensions>ts</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Header Files\motor">
|
||||
<UniqueIdentifier>{eadfac5f-f4f9-49e2-9f99-0849bf074cf8}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Source Files\motor">
|
||||
<UniqueIdentifier>{4672856c-86fb-46e3-94ff-0a296dcc6111}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<QtRcc Include="HPPA.qrc">
|
||||
@ -106,6 +112,21 @@
|
||||
<ClCompile Include="PathPlan.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="RobotArmControl.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Corning410Imager.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="imager_base.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="irisximeaimager.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="OneMotorControl.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<QtMoc Include="fileOperation.h">
|
||||
@ -153,6 +174,15 @@
|
||||
<QtMoc Include="PathPlan.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</QtMoc>
|
||||
<QtMoc Include="RobotArmControl.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</QtMoc>
|
||||
<QtMoc Include="Corning410Imager.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</QtMoc>
|
||||
<QtMoc Include="OneMotorControl.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</QtMoc>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="imageProcessor.h">
|
||||
@ -179,6 +209,12 @@
|
||||
<ClInclude Include="utility_tc.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="imager_base.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="irisximeaimager.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<QtUic Include="FocusDialog.ui">
|
||||
@ -196,6 +232,12 @@
|
||||
<QtUic Include="PathPlan.ui">
|
||||
<Filter>Form Files</Filter>
|
||||
</QtUic>
|
||||
<QtUic Include="RobotArmControl.ui">
|
||||
<Filter>Form Files</Filter>
|
||||
</QtUic>
|
||||
<QtUic Include="oneMotorControl.ui">
|
||||
<Filter>Form Files</Filter>
|
||||
</QtUic>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="cpp.hint" />
|
||||
|
||||
@ -54,9 +54,9 @@ double ImagerOperationBase::auto_exposure()
|
||||
while (true)
|
||||
{
|
||||
getFrame(buffer);
|
||||
if (GetMaxValue(buffer, m_FrameSize) >= 4095)
|
||||
if (GetMaxValue(buffer, m_FrameSize) >= 4094)
|
||||
{
|
||||
setIntegrationTime(getIntegrationTime() * 0.8);
|
||||
setIntegrationTime(getIntegrationTime() * 0.95);
|
||||
std::cout << "<EFBFBD>Զ<EFBFBD><EFBFBD>ع<EFBFBD>-----------" << std::endl;
|
||||
}
|
||||
else
|
||||
@ -204,16 +204,13 @@ void ImagerOperationBase::start_record()
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
FileOperation* fileOperation = new FileOperation();
|
||||
string directory = fileOperation->getDirectoryFromString();
|
||||
string imgPath = directory + "\\" + m_FileName2Save + "_" + std::to_string(m_FileSavedCounter);
|
||||
|
||||
FILE* m_fImage = fopen((imgPath + ".bil").c_str(), "w+b");
|
||||
m_FileName2Save2 = m_FileName2Save + "_" + std::to_string(m_FileSavedCounter) + ".bil";
|
||||
FILE* m_fImage = fopen(m_FileName2Save2.c_str(), "w+b");
|
||||
|
||||
size_t x;
|
||||
double pixelValueTmp;
|
||||
|
||||
string timesFile = imgPath + ".times";
|
||||
string timesFile = removeFileExtension(m_FileName2Save2) + ".times";
|
||||
FILE* hTimesFile = fopen(timesFile.c_str(), "w+");
|
||||
|
||||
imagerStartCollect();
|
||||
@ -273,7 +270,7 @@ void ImagerOperationBase::start_record()
|
||||
//ÿ<><C3BF>1s<31><73><EFBFBD><EFBFBD>һ<EFBFBD>ν<EFBFBD><CEBD><EFBFBD>ͼ<EFBFBD>λ<EFBFBD><CEBB><EFBFBD>
|
||||
if (m_iFrameCounter % (int)getFramerate() == 0)
|
||||
{
|
||||
emit PlotSignal();
|
||||
emit PlotSignal(m_iFrameCounter);
|
||||
}
|
||||
|
||||
if (m_iFrameCounter >= m_iFrameNumber)
|
||||
@ -290,7 +287,7 @@ void ImagerOperationBase::start_record()
|
||||
|
||||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD>λ<EFBFBD>ͼǰ<CDBC><C7B0>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
//m_RgbImage
|
||||
emit PlotSignal();//<2F>ɼ<EFBFBD><C9BC><EFBFBD><EFBFBD>ɺ<EFBFBD><C9BA><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD>λ<EFBFBD>ͼ<EFBFBD><CDBC><EFBFBD>Է<EFBFBD><D4B7>ɼ<EFBFBD>֡<EFBFBD><D6A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>֡<EFBFBD>ʵı<CAB5><C4B1><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD>ͼ<EFBFBD><CDBC>ȫ
|
||||
emit PlotSignal(-1);//<2F><EFBFBD>1<EFBFBD><EFBFBD><EFBFBD>ɼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɺ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD>λ<EFBFBD>ͼ<EFBFBD><EFBFBD><EFBFBD>Է<EFBFBD><EFBFBD>ɼ<EFBFBD>֡<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>֡<EFBFBD>ʵı<EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͼ<EFBFBD><EFBFBD>ȫ<EFBFBD><EFBFBD>2<EFBFBD><EFBFBD>ʹ<EFBFBD>û<EFBFBD>е<EFBFBD>۲ɼ<EFBFBD>ʱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֹͣ<EFBFBD>ɼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˲<EFBFBD>俪ʼ<EFBFBD>ɼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ᵼ<EFBFBD><EFBFBD><EFBFBD>ϴβɼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ĵ<EFBFBD><EFBFBD>źŵ<EFBFBD><EFBFBD>õIJۺ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD>˼<EFBFBD><EFBFBD>ݣ<EFBFBD>ע<EFBFBD>͵<EFBFBD>
|
||||
|
||||
if (m_iFrameCounter >= m_iFrameNumber)
|
||||
{
|
||||
@ -404,11 +401,7 @@ void ImagerOperationBase::WriteHdr()
|
||||
//write an ENVI compatible header file
|
||||
using namespace std;
|
||||
|
||||
|
||||
FileOperation* fileOperation = new FileOperation();
|
||||
string directory = fileOperation->getDirectoryFromString();
|
||||
|
||||
string hdrPath = directory + "\\" + m_FileName2Save + "_" + std::to_string(m_FileSavedCounter) + ".hdr";
|
||||
string hdrPath = removeFileExtension(m_FileName2Save2) + ".hdr";
|
||||
|
||||
std::ofstream outfile(hdrPath.c_str());
|
||||
outfile << "ENVI\n";
|
||||
|
||||
@ -66,6 +66,7 @@ protected:
|
||||
|
||||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڸ<EFBFBD><DAB8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӱ<EFBFBD><D3B0><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD>
|
||||
string m_FileName2Save;//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӱ<EFBFBD><D3B0><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD>
|
||||
string m_FileName2Save2;
|
||||
int m_FileSavedCounter;//<2F><><EFBFBD><EFBFBD><EFBFBD>˼<EFBFBD><CBBC><EFBFBD>Ӱ<EFBFBD><D3B0><EFBFBD>ļ<EFBFBD>
|
||||
|
||||
bool m_HasDark;//<2F><><EFBFBD>ɼ<EFBFBD><C9BC>˰<EFBFBD><CBB0><EFBFBD><EFBFBD><EFBFBD>֮<EFBFBD><D6AE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊtrue
|
||||
@ -93,7 +94,7 @@ public slots:
|
||||
virtual void record_dark();
|
||||
virtual void record_white();
|
||||
signals:
|
||||
void PlotSignal();//<2F><><EFBFBD><EFBFBD>Ӱ<EFBFBD><D3B0><EFBFBD>ź<EFBFBD>
|
||||
void PlotSignal(int);//<2F><><EFBFBD><EFBFBD>Ӱ<EFBFBD><D3B0><EFBFBD>źţ<EFBFBD>-1<><31><EFBFBD>˴βɼ<CEB2><C9BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD>λ<EFBFBD><CEBB><EFBFBD>
|
||||
void RecordFinishedSignal_WhenFrameNumberMeet();//<2F>ɼ<EFBFBD><C9BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>źţ<C5BA><C5A3><EFBFBD>Ҫ<EFBFBD>ɼ<EFBFBD><C9BC><EFBFBD><EFBFBD><EFBFBD>֡<EFBFBD><D6A1><EFBFBD><EFBFBD>m_iFrameNumber<65><72><EFBFBD>ɼ<EFBFBD><C9BC><EFBFBD><EFBFBD><EFBFBD>
|
||||
void RecordFinishedSignal_WhenFrameNumberNotMeet();//<2F>ɼ<EFBFBD><C9BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>źţ<C5BA><C5A3><EFBFBD>Ҫ<EFBFBD>ɼ<EFBFBD><C9BC><EFBFBD><EFBFBD><EFBFBD>֡<EFBFBD><D6A1><EFBFBD><EFBFBD>m_iFrameNumber<65><72>û<EFBFBD>вɼ<D0B2><C9BC><EFBFBD><EFBFBD>ɣ<EFBFBD><C9A3><EFBFBD>;ֹͣ<CDA3>ɼ<EFBFBD>
|
||||
void SpectralSignal(int);//<2F><><EFBFBD><EFBFBD>1<EFBFBD><31><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڵ<EFBFBD><DAB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƹ<EFBFBD><C6B9>ף<EFBFBD><D7A3><EFBFBD><EFBFBD><EFBFBD>0<EFBFBD><30>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɣ<EFBFBD>
|
||||
|
||||
133
HPPA/OneMotorControl.cpp
Normal file
133
HPPA/OneMotorControl.cpp
Normal file
@ -0,0 +1,133 @@
|
||||
#include "OneMotorControl.h"
|
||||
|
||||
OneMotorControl::OneMotorControl(QWidget* parent) : QDialog(parent)
|
||||
{
|
||||
ui.setupUi(this);
|
||||
|
||||
connect(this->ui.connect_btn, SIGNAL(pressed()), this, SLOT(onConnectMotor()));
|
||||
|
||||
}
|
||||
|
||||
OneMotorControl::~OneMotorControl()
|
||||
{
|
||||
m_motorThread.quit();
|
||||
m_motorThread.wait();
|
||||
}
|
||||
|
||||
void OneMotorControl::onConnectMotor()
|
||||
{
|
||||
try
|
||||
{
|
||||
FileOperation* fileOperation = new FileOperation();
|
||||
string directory = fileOperation->getDirectoryOfExe();
|
||||
QString configFilePath = QString::fromStdString(directory) + "\\oneMotorConfigFile.cfg";
|
||||
|
||||
m_multiAxisController = new IrisMultiMotorController(configFilePath);
|
||||
}
|
||||
catch (std::exception const& e)
|
||||
{
|
||||
QMessageBox msgBox;
|
||||
msgBox.setText(QString::fromLocal8Bit("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"));
|
||||
msgBox.exec();
|
||||
}
|
||||
|
||||
m_multiAxisController->moveToThread(&m_motorThread);
|
||||
m_motorThread.start();
|
||||
|
||||
connect(this->ui.right_btn, SIGNAL(pressed()), this, SLOT(onxMotorRight()));
|
||||
connect(this->ui.right_btn, SIGNAL(released()), this, SLOT(onxMotorStop()));
|
||||
connect(this->ui.left_btn, SIGNAL(pressed()), this, SLOT(onxMotorLeft()));
|
||||
connect(this->ui.left_btn, SIGNAL(released()), this, SLOT(onxMotorStop()));
|
||||
|
||||
connect(this->ui.move2loc_pushButton, SIGNAL(pressed()), this, SLOT(onxMove2Loc()));
|
||||
|
||||
connect(m_multiAxisController, SIGNAL(broadcastLocationSignal(std::vector<double>)), this, SLOT(display_x_loc(std::vector<double>)));
|
||||
|
||||
connect(this, SIGNAL(moveSignal(int, bool, double, int)), m_multiAxisController, SLOT(move(int, bool, double, int)));
|
||||
connect(this, SIGNAL(move2LocSignal(int, double, double, int)), m_multiAxisController, SLOT(moveTo(int, double, double, int)));
|
||||
connect(this, SIGNAL(stopSignal(int)), m_multiAxisController, SLOT(stop(int)));
|
||||
|
||||
connect(this->ui.zero_start_btn, SIGNAL(released()), this, SLOT(zeroStart()));
|
||||
connect(this, SIGNAL(zeroStartSignal(int)), m_multiAxisController, SLOT(zeroStart(int)));
|
||||
|
||||
connect(this->ui.rangeMeasurement_btn, SIGNAL(pressed()), this, SLOT(onx_rangeMeasurement()));
|
||||
connect(this, SIGNAL(rangeMeasurement(int, double, int)), m_multiAxisController, SLOT(rangeMeasurement(int, double, int)));
|
||||
|
||||
connect(this, SIGNAL(recordHyperSpecImgOneMotorSignal(int, double, double)), m_multiAxisController, SLOT(recordHyperSpecImgOneMotor(int, double, double)));
|
||||
|
||||
connect(m_multiAxisController, SIGNAL(startRecordLineSignal(int)), this, SIGNAL(startRecordLineSignal(int)));
|
||||
|
||||
connect(this, SIGNAL(testConnectivitySignal(int, int)), m_multiAxisController, SLOT(testConnectivity(int, int)));
|
||||
connect(m_multiAxisController, SIGNAL(broadcastConnectivity(std::vector<int>)), this, SLOT(display_motors_connectivity(std::vector<int>)));
|
||||
emit testConnectivitySignal(0, 1000);
|
||||
}
|
||||
|
||||
void OneMotorControl::display_x_loc(std::vector<double> loc)
|
||||
{
|
||||
double tmp = round(loc[0] * 100) / 100;
|
||||
this->ui.realTimeLoc_lineEdit->setText(QString::number(tmp));
|
||||
}
|
||||
|
||||
void OneMotorControl::display_motors_connectivity(std::vector<int> connectivity)
|
||||
{
|
||||
//std::cout << "-----------------------------------"<<connectivity.size()<< std::endl;
|
||||
if (connectivity[0])
|
||||
{
|
||||
this->ui.motor_state_label->setStyleSheet("QLabel{background-color:rgb(0,255,0);}");
|
||||
}
|
||||
else
|
||||
{
|
||||
this->ui.motor_state_label->setStyleSheet("QLabel{background-color:rgb(255,0,0);}");
|
||||
}
|
||||
}
|
||||
|
||||
void OneMotorControl::zeroStart()
|
||||
{
|
||||
zeroStartSignal(0);
|
||||
}
|
||||
|
||||
void OneMotorControl::onx_rangeMeasurement()
|
||||
{
|
||||
double s0 = ui.speed_lineEdit->text().toDouble();
|
||||
emit rangeMeasurement(0, s0, 1000);
|
||||
}
|
||||
|
||||
void OneMotorControl::onxMove2Loc()
|
||||
{
|
||||
double s = ui.speed_lineEdit->text().toDouble();
|
||||
double l = ui.move2loc_lineEdit->text().toDouble();
|
||||
|
||||
emit move2LocSignal(0, l, s, 1000);
|
||||
}
|
||||
|
||||
void OneMotorControl::onxMotorRight()
|
||||
{
|
||||
double s = ui.speed_lineEdit->text().toDouble();
|
||||
|
||||
emit moveSignal(0, false, s, 1000);
|
||||
}
|
||||
|
||||
void OneMotorControl::onxMotorLeft()
|
||||
{
|
||||
double s = ui.speed_lineEdit->text().toDouble();
|
||||
|
||||
emit moveSignal(0, true, s, 1000);
|
||||
}
|
||||
|
||||
void OneMotorControl::onxMotorStop()
|
||||
{
|
||||
emit stopSignal(0);
|
||||
}
|
||||
|
||||
void OneMotorControl::moveMotorAndRecordHyperSpecImg(int updateIntervalMs)
|
||||
{
|
||||
double runSpeed = ui.speed_lineEdit->text().toDouble();
|
||||
double returnSpeed = ui.return_speed_lineEdit->text().toDouble();
|
||||
|
||||
emit recordHyperSpecImgOneMotorSignal(updateIntervalMs, runSpeed, returnSpeed);
|
||||
}
|
||||
|
||||
void OneMotorControl::moveMotor2StartPosAndStopRecord()
|
||||
{
|
||||
m_multiAxisController->cancelRecord();
|
||||
}
|
||||
53
HPPA/OneMotorControl.h
Normal file
53
HPPA/OneMotorControl.h
Normal file
@ -0,0 +1,53 @@
|
||||
#pragma once
|
||||
#include <QThread>
|
||||
#include <QMessageBox>
|
||||
|
||||
#include "ui_oneMotorControl.h"
|
||||
|
||||
#include "IrisMultiMotorController.h"
|
||||
#include "fileOperation.h"
|
||||
|
||||
class OneMotorControl : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
OneMotorControl(QWidget* parent = nullptr);
|
||||
~OneMotorControl();
|
||||
|
||||
void moveMotorAndRecordHyperSpecImg(int updateIntervalMs);
|
||||
void moveMotor2StartPosAndStopRecord();
|
||||
|
||||
|
||||
public Q_SLOTS:
|
||||
void onConnectMotor();
|
||||
|
||||
void display_x_loc(std::vector<double> loc);
|
||||
void display_motors_connectivity(std::vector<int> connectivity);
|
||||
void onxMove2Loc();
|
||||
void zeroStart();
|
||||
void onx_rangeMeasurement();
|
||||
|
||||
void onxMotorRight();
|
||||
void onxMotorLeft();
|
||||
void onxMotorStop();
|
||||
|
||||
signals:
|
||||
void moveSignal(int, bool, double, int);
|
||||
void move2LocSignal(int, double, double, int);
|
||||
void move2LocSignal(const std::vector<double>, const std::vector<double>, int);
|
||||
void stopSignal(int);
|
||||
|
||||
void rangeMeasurement(int, double, int);
|
||||
void zeroStartSignal(int);
|
||||
void testConnectivitySignal(int, int);
|
||||
|
||||
void recordHyperSpecImgOneMotorSignal(int updateIntervalMs, double runSpeed, double returnSpeed);
|
||||
|
||||
void startRecordLineSignal(int);
|
||||
private:
|
||||
Ui::OneMotorControl_UI ui;
|
||||
|
||||
QThread m_motorThread;
|
||||
IrisMultiMotorController* m_multiAxisController;
|
||||
};
|
||||
@ -15,19 +15,19 @@
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_16">
|
||||
@ -349,12 +349,6 @@
|
||||
<widget class="QTableWidget" name="recordLine_tableWidget"/>
|
||||
</item>
|
||||
</layout>
|
||||
<zorder>layoutWidget</zorder>
|
||||
<zorder>layoutWidget_2</zorder>
|
||||
<zorder>recordLine_tableWidget</zorder>
|
||||
<zorder>layoutWidget_3</zorder>
|
||||
<zorder>layoutWidget_4</zorder>
|
||||
<zorder>label_7</zorder>
|
||||
</widget>
|
||||
<layoutdefault spacing="6" margin="11"/>
|
||||
<resources/>
|
||||
|
||||
@ -285,16 +285,13 @@ void ResononNirImager::start_record()
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
FileOperation* fileOperation = new FileOperation();
|
||||
string directory = fileOperation->getDirectoryFromString();
|
||||
string imgPath = directory + "\\" + m_FileName2Save + "_" + std::to_string(m_FileSavedCounter);
|
||||
|
||||
FILE* m_fImage = fopen((imgPath + ".bil").c_str(), "w+b");
|
||||
m_FileName2Save2 = m_FileName2Save + "_" + std::to_string(m_FileSavedCounter) + ".bil";
|
||||
FILE* m_fImage = fopen(m_FileName2Save2.c_str(), "w+b");
|
||||
|
||||
size_t x;
|
||||
double pixelValueTmp;
|
||||
|
||||
string timesFile = imgPath + ".times";
|
||||
string timesFile = removeFileExtension(m_FileName2Save2) + ".times";
|
||||
FILE* hTimesFile = fopen(timesFile.c_str(), "w+");
|
||||
|
||||
reConnectImage();//nir<69>ڶ<EFBFBD><DAB6>βɼ<CEB2>ʱ<EFBFBD><CAB1>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>imagerStartCollect()<29>ᱨ<EFBFBD><E1B1A8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
@ -356,7 +353,7 @@ void ResononNirImager::start_record()
|
||||
//ÿ<><C3BF>1s<31><73><EFBFBD><EFBFBD>һ<EFBFBD>ν<EFBFBD><CEBD><EFBFBD>ͼ<EFBFBD>λ<EFBFBD><CEBB><EFBFBD>
|
||||
if (m_iFrameCounter % (int)getFramerate() == 0)
|
||||
{
|
||||
emit PlotSignal();
|
||||
emit PlotSignal(m_iFrameCounter);
|
||||
}
|
||||
|
||||
if (m_iFrameCounter >= m_iFrameNumber)
|
||||
@ -374,7 +371,7 @@ void ResononNirImager::start_record()
|
||||
|
||||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD>λ<EFBFBD>ͼǰ<CDBC><C7B0>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
//m_RgbImage
|
||||
emit PlotSignal();//<2F>ɼ<EFBFBD><C9BC><EFBFBD><EFBFBD>ɺ<EFBFBD><C9BA><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD>λ<EFBFBD>ͼ<EFBFBD><CDBC><EFBFBD>Է<EFBFBD><D4B7>ɼ<EFBFBD>֡<EFBFBD><D6A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>֡<EFBFBD>ʵı<CAB5><C4B1><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD>ͼ<EFBFBD><CDBC>ȫ
|
||||
emit PlotSignal(-1);//<2F>ɼ<EFBFBD><C9BC><EFBFBD><EFBFBD>ɺ<EFBFBD><C9BA><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD>λ<EFBFBD>ͼ<EFBFBD><CDBC><EFBFBD>Է<EFBFBD><D4B7>ɼ<EFBFBD>֡<EFBFBD><D6A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>֡<EFBFBD>ʵı<CAB5><C4B1><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD>ͼ<EFBFBD><CDBC>ȫ
|
||||
|
||||
if (m_iFrameCounter >= m_iFrameNumber)
|
||||
{
|
||||
@ -395,11 +392,7 @@ void ResononNirImager::WriteHdr()
|
||||
//write an ENVI compatible header file
|
||||
using namespace std;
|
||||
|
||||
|
||||
FileOperation* fileOperation = new FileOperation();
|
||||
string directory = fileOperation->getDirectoryFromString();
|
||||
|
||||
string hdrPath = directory + "\\" + m_FileName2Save + "_" + std::to_string(m_FileSavedCounter) + ".hdr";
|
||||
string hdrPath = removeFileExtension(m_FileName2Save2) + ".hdr";
|
||||
|
||||
std::ofstream outfile(hdrPath.c_str());
|
||||
outfile << "ENVI\n";
|
||||
|
||||
@ -7,6 +7,7 @@
|
||||
#include "resonon_imager_allied.h"
|
||||
#include "image2display.h"
|
||||
#include "fileOperation.h"
|
||||
#include "utility_tc.h"
|
||||
|
||||
class ResononNirImager :public ImagerOperationBase
|
||||
{
|
||||
|
||||
639
HPPA/RobotArmControl.cpp
Normal file
639
HPPA/RobotArmControl.cpp
Normal file
@ -0,0 +1,639 @@
|
||||
#include "RobotArmControl.h"
|
||||
|
||||
RobotArmControl::RobotArmControl(QWidget* parent): QDialog(parent)
|
||||
{
|
||||
ui.setupUi(this);
|
||||
robotController = new RobotController(this);
|
||||
|
||||
connect(ui.get_task_list_btn, SIGNAL(clicked()), this, SLOT(getTaskList()));
|
||||
connect(ui.get_pose_btn, SIGNAL(clicked()), this, SLOT(getPose()));
|
||||
connect(ui.connect2arm_btn, SIGNAL(clicked()), this, SLOT(connectRobotArm()));
|
||||
|
||||
connect(ui.execute_task_btn, SIGNAL(clicked()), this, SLOT(executeTaskWithoutHyperImager()));
|
||||
connect(ui.pause_task_btn, SIGNAL(clicked()), this, SLOT(pauseTask()));
|
||||
connect(ui.continue_task_btn, SIGNAL(clicked()), this, SLOT(continueTask()));
|
||||
|
||||
robotMonitor = new EC8056;
|
||||
connect(robotMonitor, &EC8056::dataReceived, this, &RobotArmControl::monitorRobotArm);
|
||||
|
||||
|
||||
m_pModel = new QStringListModel(ui.taskList_listView);
|
||||
|
||||
ui.taskList_listView->setModel(m_pModel);
|
||||
}
|
||||
|
||||
RobotArmControl::~RobotArmControl()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void RobotArmControl::monitorRobotArm(const ECData& data)
|
||||
{
|
||||
double x = data.machinePose[0];
|
||||
double y = data.machinePose[1];
|
||||
double z = data.machinePose[2];
|
||||
|
||||
ui.pose_x_label->setText(QString::number(x));
|
||||
ui.pose_y_label->setText(QString::number(y));
|
||||
ui.pose_z_label->setText(QString::number(z));
|
||||
}
|
||||
|
||||
void RobotArmControl::onCommandResponse(QString str, const QJsonObject& response)
|
||||
{
|
||||
//qDebug() << "response:" << response;
|
||||
|
||||
QString re;
|
||||
if (response.contains("result"))
|
||||
{
|
||||
re = response["result"].toVariant().toString();
|
||||
ui.textEdit->append(str + " Result: " + re);
|
||||
}
|
||||
else if (response.contains("error"))
|
||||
{
|
||||
//auto delete11 = response["error"].toObject();
|
||||
//qDebug() << "response[\"error\"]:" << delete11;
|
||||
|
||||
auto errorStr = response["error"].toObject()["message"].toString();
|
||||
|
||||
ui.textEdit->append(str + " Error: " + errorStr);
|
||||
}
|
||||
}
|
||||
|
||||
void RobotArmControl::getTaskList()
|
||||
{
|
||||
FileOperation* fileOperation = new FileOperation();
|
||||
string directory = fileOperation->getDirectoryOfExe();
|
||||
|
||||
QString pythonScript = QString::fromStdString(directory) + "\\get_jbi_filename.py";
|
||||
|
||||
QProcess process;
|
||||
|
||||
process.start("python.exe", QStringList() << pythonScript);
|
||||
process.waitForFinished();
|
||||
QString output = process.readAllStandardOutput();
|
||||
|
||||
QStringList files;
|
||||
//files.append("tc20250324down.jbi");
|
||||
//files.append("tc20250324circle.jbi");
|
||||
//files.append("tc20250324side.jbi");
|
||||
QStringList lines = output.split('\n', QString::SkipEmptyParts);
|
||||
for (const QString& line : lines)
|
||||
{
|
||||
files.append(line.trimmed());
|
||||
}
|
||||
|
||||
////<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݣ<EFBFBD>Ȼ<EFBFBD><C8BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
//for (size_t i = 0; i < files.length(); i++)
|
||||
//{
|
||||
// int row = m_pModel->rowCount();
|
||||
// m_pModel->insertRow(row);
|
||||
// QModelIndex index = m_pModel->index(row);
|
||||
// m_pModel->setData(index, files[i]);
|
||||
//}
|
||||
|
||||
m_pModel->setStringList(files);
|
||||
}
|
||||
|
||||
void RobotArmControl::getPose()
|
||||
{
|
||||
QJsonObject response;
|
||||
bool x = robotController->getRobotPose(response);
|
||||
onCommandResponse("getPose", response);
|
||||
}
|
||||
|
||||
void RobotArmControl::connectRobotArm()
|
||||
{
|
||||
bool re = robotController->connectToRobot("192.168.1.100");
|
||||
robotMonitor->connectToHost("192.168.1.100");
|
||||
}
|
||||
|
||||
void RobotArmControl::executeTaskWithHyperImager()
|
||||
{
|
||||
QModelIndex index = ui.taskList_listView->currentIndex();
|
||||
if (-1 == index.row())
|
||||
{
|
||||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD>û<EFBFBD>ѡ<EFBFBD><D1A1><EFBFBD>ļ<EFBFBD>
|
||||
ui.textEdit->append("Please select file on the left!");
|
||||
return;
|
||||
}
|
||||
QString fileName = index.data(Qt::DisplayRole).toString();
|
||||
|
||||
QJsonObject response;
|
||||
bool x;
|
||||
|
||||
x = robotController->checkJbiExist(fileName, response);
|
||||
onCommandResponse("checkJbiExist", response);
|
||||
if (!x)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
x = robotController->setServoStatus(1, response);
|
||||
onCommandResponse("setServoStatus", response);
|
||||
if (!x)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
x = robotController->runJbi(fileName, response, true);
|
||||
onCommandResponse("runJbi", response);
|
||||
if (!x)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void RobotArmControl::executeTaskWithoutHyperImager()
|
||||
{
|
||||
QModelIndex index = ui.taskList_listView->currentIndex();
|
||||
if (-1 == index.row())
|
||||
{
|
||||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD>û<EFBFBD>ѡ<EFBFBD><D1A1><EFBFBD>ļ<EFBFBD>
|
||||
ui.textEdit->append("Please select file on the left!");
|
||||
return;
|
||||
}
|
||||
QString fileName = index.data(Qt::DisplayRole).toString();
|
||||
|
||||
QJsonObject response;
|
||||
bool x;
|
||||
|
||||
x = robotController->checkJbiExist(fileName, response);
|
||||
onCommandResponse("checkJbiExist", response);
|
||||
if (!x)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
x = robotController->setServoStatus(1, response);
|
||||
onCommandResponse("setServoStatus", response);
|
||||
if (!x)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
x = robotController->runJbi(fileName, response, false);
|
||||
onCommandResponse("runJbi", response);
|
||||
if (!x)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void RobotArmControl::pauseTask()
|
||||
{
|
||||
QJsonObject response;
|
||||
bool x;
|
||||
|
||||
x = robotController->pauseTask(response);
|
||||
onCommandResponse("pauseTask", response);
|
||||
}
|
||||
|
||||
void RobotArmControl::continueTask()
|
||||
{
|
||||
QJsonObject response;
|
||||
bool x;
|
||||
|
||||
x = robotController->continueTask(response);
|
||||
onCommandResponse("continueTask", response);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
RobotController::RobotController(QObject* parent) : QObject(parent), socket(new QTcpSocket(this))
|
||||
{
|
||||
//connect(socket, &QTcpSocket::readyRead, this, &RobotController::onReadyRead);
|
||||
|
||||
m_timer = new QTimer(this);
|
||||
connect(m_timer, SIGNAL(timeout()), this, SLOT(getPoint()));
|
||||
}
|
||||
|
||||
RobotController::~RobotController()
|
||||
{
|
||||
disconnectFromRobot();
|
||||
}
|
||||
|
||||
bool RobotController::connectToRobot(const QString& ip, quint16 port)
|
||||
{
|
||||
socket->setProxy(QNetworkProxy::NoProxy);
|
||||
|
||||
socket->connectToHost(ip, port);
|
||||
|
||||
if (!socket->waitForConnected(3000)) {
|
||||
qDebug() << "Connection failed:" << socket->errorString();
|
||||
return false;
|
||||
}
|
||||
qDebug() << "Connected successfully!";
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void RobotController::disconnectFromRobot()
|
||||
{
|
||||
if (socket->isOpen())
|
||||
{
|
||||
socket->close();
|
||||
}
|
||||
}
|
||||
|
||||
bool RobotController::processResponse(QJsonObject response, QString& result)
|
||||
{
|
||||
//qDebug() << "response:" << response;
|
||||
|
||||
if (response.contains("result"))
|
||||
{
|
||||
result = response["result"].toVariant().toString();
|
||||
|
||||
//qDebug() << "result1:" << result;
|
||||
|
||||
return true;
|
||||
}
|
||||
else if (response.contains("error"))
|
||||
{
|
||||
result = response["error"].toObject()["message"].toString();
|
||||
//qDebug() << "result2:" << result;
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool RobotController::processResponse_getJbiState(QJsonObject response, QString& result)
|
||||
{
|
||||
//qDebug() << "response:" << response;
|
||||
|
||||
if (response.contains("result"))
|
||||
{
|
||||
QString resultStr = response["result"].toString();
|
||||
|
||||
QJsonDocument resultDoc = QJsonDocument::fromJson(resultStr.toUtf8());
|
||||
QJsonObject resultObj = resultDoc.object();
|
||||
//qDebug() << "resultObj:" << resultObj;
|
||||
|
||||
int runState = resultObj["runState"].toInt();
|
||||
//qDebug() << "runState:" << runState;
|
||||
|
||||
result = QString::number(runState);
|
||||
//qDebug() << "result:" << result;
|
||||
|
||||
return true;
|
||||
}
|
||||
else if (response.contains("error"))
|
||||
{
|
||||
result = response["error"].toObject()["message"].toString();
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
void RobotController::getPoint()
|
||||
{
|
||||
QJsonObject response;
|
||||
getJbiState(response);//0 ֹͣ״̬,1 <20><>ͣ״̬,2 <20><>ͣ״̬,3 <20><><EFBFBD><EFBFBD>״̬,4 <20><><EFBFBD><EFBFBD>״̬
|
||||
QString result;
|
||||
bool x = processResponse_getJbiState(response, result);
|
||||
//qDebug() << "getJbiState:" << result;
|
||||
|
||||
if (result.toInt() != 3)
|
||||
{
|
||||
m_timer->stop();
|
||||
|
||||
m_iCurrentJbiJobLine = 0;
|
||||
m_iFileCounter = 0;
|
||||
|
||||
//<2F><><EFBFBD><EFBFBD><EFBFBD>źţ<C5BA><C5A3><EFBFBD><EFBFBD><EFBFBD>ֹͣ<CDA3>ɼ<EFBFBD>
|
||||
emit hsiRecordSignal(-1);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
QJsonObject response2;
|
||||
getCurrentJobLine(response2);
|
||||
QString result2;
|
||||
bool x2 = processResponse(response2, result2);
|
||||
|
||||
int m_iCurrentJbiJobLine_tmp = result2.toInt();
|
||||
|
||||
|
||||
if (m_iCurrentJbiJobLine_tmp != m_iCurrentJbiJobLine)
|
||||
{
|
||||
m_iFileCounter++;
|
||||
|
||||
qDebug() << "Changed! CurrentJobLine:" << m_iCurrentJbiJobLine_tmp;
|
||||
//<2F><><EFBFBD><EFBFBD><EFBFBD>źţ<C5BA><C5A3><EFBFBD><EFBFBD><EFBFBD>ֹͣ<CDA3>ɼ<EFBFBD>
|
||||
emit hsiRecordSignal(-1);
|
||||
|
||||
m_iCurrentJbiJobLine = m_iCurrentJbiJobLine_tmp;
|
||||
|
||||
//<2F><><EFBFBD><EFBFBD><EFBFBD>źţ<C5BA><C5A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD>ɼ<EFBFBD>
|
||||
emit hsiRecordSignal(m_iFileCounter);
|
||||
}
|
||||
}
|
||||
|
||||
void RobotController::sendCommand(const QString& cmd, const QJsonValue& params, int id)
|
||||
{
|
||||
QJsonObject request;
|
||||
request["method"] = cmd;
|
||||
request["params"] = params;
|
||||
request["jsonrpc"] = "2.0";
|
||||
request["id"] = id;
|
||||
|
||||
QJsonDocument doc(request);
|
||||
QByteArray data = doc.toJson(QJsonDocument::Compact) + "\n";
|
||||
//qDebug() << "send command:" << data.constData();
|
||||
|
||||
socket->write(data);
|
||||
socket->waitForBytesWritten();
|
||||
}
|
||||
|
||||
bool RobotController::onReadyRead(QJsonObject& re)
|
||||
{
|
||||
QByteArray data = socket->readAll();
|
||||
QJsonDocument doc = QJsonDocument::fromJson(data);
|
||||
if (!doc.isNull() && doc.isObject())
|
||||
{
|
||||
re = doc.object();
|
||||
//qDebug() << "Received all:" << re;
|
||||
|
||||
if (re.contains("result"))
|
||||
{
|
||||
//qDebug() << "Received result:" << re["result"].toVariant();
|
||||
return true;
|
||||
}
|
||||
else if (re.contains("error"))
|
||||
{
|
||||
//qDebug() << "Received error:" << re["error"];
|
||||
return false;
|
||||
}
|
||||
|
||||
//emit commandResponse(true, doc.object());
|
||||
}
|
||||
else
|
||||
{
|
||||
//emit commandResponse(false, QJsonObject());
|
||||
|
||||
re = QJsonObject();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool RobotController::getRobotPose(QJsonObject& re)
|
||||
{
|
||||
sendCommand("getRobotPose");
|
||||
socket->waitForReadyRead(m_iTimeout);
|
||||
|
||||
return onReadyRead(re);
|
||||
}
|
||||
|
||||
bool RobotController::getRobotState(QJsonObject& re)
|
||||
{
|
||||
sendCommand("getRobotState");
|
||||
socket->waitForReadyRead(m_iTimeout);
|
||||
|
||||
return onReadyRead(re);
|
||||
}
|
||||
|
||||
bool RobotController::getJbiState(QJsonObject& re)
|
||||
{
|
||||
sendCommand("getJbiState");
|
||||
socket->waitForReadyRead(m_iTimeout);
|
||||
|
||||
return onReadyRead(re);
|
||||
}
|
||||
|
||||
bool RobotController::getCurrentJobLine(QJsonObject& re)
|
||||
{
|
||||
sendCommand("getCurrentJobLine");
|
||||
socket->waitForReadyRead(m_iTimeout);
|
||||
|
||||
return onReadyRead(re);
|
||||
}
|
||||
|
||||
bool RobotController::getRobotMode(QJsonObject& re)
|
||||
{
|
||||
sendCommand("getRobotMode");
|
||||
socket->waitForReadyRead(m_iTimeout);
|
||||
|
||||
return onReadyRead(re);
|
||||
}
|
||||
|
||||
bool RobotController::checkJbiExist(const QString& jbiFilename, QJsonObject& re)
|
||||
{
|
||||
QJsonObject paramsRunJbi;
|
||||
paramsRunJbi["filename"] = jbiFilename;//ʹ<>ö<EFBFBD><C3B6><EFBFBD><EFBFBD>ṹ
|
||||
|
||||
sendCommand("checkJbiExist", paramsRunJbi);
|
||||
socket->waitForReadyRead(m_iTimeout);
|
||||
|
||||
return onReadyRead(re);
|
||||
}
|
||||
|
||||
bool RobotController::setServoStatus(int status, QJsonObject& re)
|
||||
{
|
||||
QJsonObject params_set_servo_status;
|
||||
params_set_servo_status["status"] = status;//ʹ<>ö<EFBFBD><C3B6><EFBFBD><EFBFBD>ṹ
|
||||
|
||||
sendCommand("set_servo_status", params_set_servo_status);
|
||||
socket->waitForReadyRead(m_iTimeout);
|
||||
|
||||
return onReadyRead(re);
|
||||
}
|
||||
|
||||
bool RobotController::runJbi(const QString& jbiFilename, QJsonObject& re, bool isRecordHsi)
|
||||
{
|
||||
QJsonObject paramsRunJbi;
|
||||
paramsRunJbi["filename"] = jbiFilename;//ʹ<>ö<EFBFBD><C3B6><EFBFBD><EFBFBD>ṹ
|
||||
|
||||
sendCommand("runJbi", paramsRunJbi);
|
||||
socket->waitForReadyRead(m_iTimeout);
|
||||
|
||||
if (isRecordHsi)
|
||||
{
|
||||
m_timer->start(1000);
|
||||
}
|
||||
|
||||
return onReadyRead(re);
|
||||
}
|
||||
|
||||
bool RobotController::pauseTask(QJsonObject& re)
|
||||
{
|
||||
sendCommand("pause");
|
||||
socket->waitForReadyRead(m_iTimeout);
|
||||
|
||||
return onReadyRead(re);
|
||||
}
|
||||
|
||||
bool RobotController::run(QJsonObject& re)
|
||||
{
|
||||
sendCommand("run");
|
||||
socket->waitForReadyRead(m_iTimeout);
|
||||
|
||||
return onReadyRead(re);
|
||||
}
|
||||
|
||||
bool RobotController::continueTask(QJsonObject& re)
|
||||
{
|
||||
sendCommand("run");
|
||||
socket->waitForReadyRead(m_iTimeout);
|
||||
|
||||
return onReadyRead(re);
|
||||
}
|
||||
|
||||
bool RobotController::setRobotPowerStatus(int status, QJsonObject& re)
|
||||
{
|
||||
sendCommand("set_robot_power_status", QJsonArray{ status });
|
||||
socket->waitForReadyRead(m_iTimeout);
|
||||
|
||||
return onReadyRead(re);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
EC8056::EC8056(QObject* parent) : QObject(parent), socket(new QTcpSocket(this))
|
||||
{
|
||||
connect(socket, &QTcpSocket::readyRead, this, &EC8056::onReadyRead);
|
||||
/*connect(socket, QOverload<QAbstractSocket::SocketError>::of(&QTcpSocket::errorOccurred),
|
||||
this, &EC8056::onSocketError);*/
|
||||
//connect(socket, SIGNAL(error(QAbstractSocket::SocketError)),
|
||||
// this, SLOT(onSocketError(QAbstractSocket::SocketError)));
|
||||
}
|
||||
|
||||
void EC8056::connectToHost(const QString& host, quint16 port)
|
||||
{
|
||||
socket->setProxy(QNetworkProxy::NoProxy);
|
||||
|
||||
socket->connectToHost(QHostAddress(host), port);
|
||||
|
||||
if (!socket->waitForConnected(3000)) {
|
||||
qDebug() << "Connection failed:" << socket->errorString();
|
||||
return;
|
||||
}
|
||||
qDebug() << "Connected successfully!";
|
||||
}
|
||||
|
||||
quint8 EC8056::readUInt8(const QByteArray& buf, int& offset)
|
||||
{
|
||||
return static_cast<quint8>(buf[offset++]);
|
||||
}
|
||||
|
||||
quint32 EC8056::readUInt32(const QByteArray& buf, int& offset)
|
||||
{
|
||||
quint32 val;
|
||||
memcpy(&val, buf.constData() + offset, sizeof(val));
|
||||
offset += sizeof(val);
|
||||
return qFromBigEndian(val);
|
||||
}
|
||||
|
||||
qint32 EC8056::readInt32(const QByteArray& buf, int& offset)
|
||||
{
|
||||
qint32 val;
|
||||
memcpy(&val, buf.constData() + offset, sizeof(val));
|
||||
offset += sizeof(val);
|
||||
return qFromBigEndian(val);
|
||||
}
|
||||
|
||||
quint64 EC8056::readUInt64(const QByteArray& buf, int& offset)
|
||||
{
|
||||
quint64 val;
|
||||
memcpy(&val, buf.constData() + offset, sizeof(val));
|
||||
offset += sizeof(val);
|
||||
return qFromBigEndian(val);
|
||||
}
|
||||
|
||||
double EC8056::readDouble(const QByteArray& buf, int& offset)
|
||||
{
|
||||
QByteArray b = buf.mid(offset, sizeof(double));
|
||||
offset += sizeof(double);
|
||||
if (QSysInfo::ByteOrder == QSysInfo::LittleEndian)
|
||||
std::reverse(b.begin(), b.end());
|
||||
|
||||
double val;
|
||||
memcpy(&val, b.constData(), sizeof(double));
|
||||
return val;
|
||||
}
|
||||
|
||||
void EC8056::onReadyRead()
|
||||
{
|
||||
buffer.append(socket->readAll());
|
||||
|
||||
if (buffer.size() < 1024)
|
||||
return;
|
||||
|
||||
int offset = 0;
|
||||
ECData data;
|
||||
|
||||
data.msgSize = readUInt32(buffer, offset);
|
||||
offset = 1020;
|
||||
data.matchingWord = readUInt32(buffer, offset);
|
||||
|
||||
if ((data.msgSize == 1024)/* && (data.matchingWord == 3967833836)*/)
|
||||
{
|
||||
offset = 0;
|
||||
|
||||
data.msgSize = readUInt32(buffer, offset);
|
||||
data.timeStamp = readUInt64(buffer, offset);
|
||||
data.auto_cycle = readUInt8(buffer, offset);
|
||||
|
||||
for (int i = 0; i < 8; ++i) data.machinePos[i] = readDouble(buffer, offset);
|
||||
for (int i = 0; i < 6; ++i) data.machinePose[i] = readDouble(buffer, offset);
|
||||
for (int i = 0; i < 6; ++i) data.machineUserPose[i] = readDouble(buffer, offset);
|
||||
for (int i = 0; i < 8; ++i) data.torque[i] = readDouble(buffer, offset);
|
||||
|
||||
data.robotState = readUInt32(buffer, offset);
|
||||
data.servoReady = readUInt32(buffer, offset);
|
||||
data.can_motor_run = readUInt32(buffer, offset);
|
||||
|
||||
for (int i = 0; i < 8; ++i) data.motor_speed[i] = readInt32(buffer, offset);
|
||||
|
||||
data.robotMode = readUInt32(buffer, offset);
|
||||
|
||||
for (int i = 0; i < 3; ++i) data.analog_ioInput[i] = readDouble(buffer, offset);
|
||||
for (int i = 0; i < 5; ++i) data.analog_ioOutput[i] = readDouble(buffer, offset);
|
||||
|
||||
data.digital_ioInput = readUInt64(buffer, offset);
|
||||
data.digital_ioOutput = readUInt64(buffer, offset);
|
||||
|
||||
data.collision = readUInt8(buffer, offset);
|
||||
|
||||
for (int i = 0; i < 6; ++i) data.machineFlangePose[i] = readDouble(buffer, offset);
|
||||
for (int i = 0; i < 6; ++i) data.machineUserFlangePose[i] = readDouble(buffer, offset);
|
||||
|
||||
data.emergencyStopState = readUInt8(buffer, offset);
|
||||
data.tcpSpeed = readDouble(buffer, offset);
|
||||
for (int i = 0; i < 8; ++i) data.joIntSpeed[i] = readDouble(buffer, offset);
|
||||
data.tcpAcc = readDouble(buffer, offset);
|
||||
for (int i = 0; i < 8; ++i) data.joIntAcc[i] = readDouble(buffer, offset);
|
||||
for (int i = 0; i < 6; ++i) data.joIntTemperature[i] = readDouble(buffer, offset);
|
||||
for (int i = 0; i < 6; ++i) data.joIntTorque[i] = readDouble(buffer, offset);
|
||||
for (int i = 0; i < 6; ++i) data.extJoIntTorques[i] = readDouble(buffer, offset);
|
||||
for (int i = 0; i < 6; ++i) data.exTcpForceIntool[i] = readDouble(buffer, offset);
|
||||
|
||||
data.dragState = readUInt8(buffer, offset);
|
||||
data.sensor_connected_state = readUInt8(buffer, offset);
|
||||
data.reserved = readUInt8(buffer, offset);
|
||||
data.matchingWord = readUInt32(buffer, offset);
|
||||
|
||||
/*if (data.msgSize != 1024 || data.matchingWord != 0xec8056ec) {
|
||||
buffer.clear();
|
||||
emit errorOccurred("Invalid packet received");
|
||||
return;
|
||||
}*/
|
||||
|
||||
emit dataReceived(data);
|
||||
}
|
||||
|
||||
|
||||
buffer.clear();
|
||||
}
|
||||
|
||||
void EC8056::onSocketError(QAbstractSocket::SocketError socketError)
|
||||
{
|
||||
Q_UNUSED(socketError)
|
||||
emit errorOccurred(socket->errorString());
|
||||
}
|
||||
164
HPPA/RobotArmControl.h
Normal file
164
HPPA/RobotArmControl.h
Normal file
@ -0,0 +1,164 @@
|
||||
#pragma once
|
||||
#include <qdialog.h>
|
||||
#include <QTcpSocket>
|
||||
#include <QJsonDocument>
|
||||
#include <QJsonObject>
|
||||
#include <QJsonArray>
|
||||
#include <QDebug>
|
||||
#include <QThread>
|
||||
#include <QNetworkProxy>
|
||||
#include <QtEndian>
|
||||
#include <QNetworkAccessManager>
|
||||
#include <QNetworkReply>
|
||||
#include <QAuthenticator>
|
||||
#include <QDebug>
|
||||
#include <QRegularExpression>
|
||||
#include <QProcess>
|
||||
#include <QStringListModel>
|
||||
#include <QTimer>
|
||||
|
||||
#include "ui_RobotArmControl.h"
|
||||
#include "fileOperation.h"
|
||||
|
||||
|
||||
struct ECData
|
||||
{
|
||||
quint32 msgSize;
|
||||
quint64 timeStamp;
|
||||
quint8 auto_cycle;
|
||||
double machinePos[8];//<2F>ؽ<EFBFBD><D8BD><EFBFBD><EFBFBD><EFBFBD>
|
||||
double machinePose[6];//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
double machineUserPose[6];//<2F>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD>
|
||||
double torque[8];//<2F>ؽڶ<DAB6><EEB6A8><EFBFBD>ذٷֱ<D9B7>
|
||||
quint32 robotState;//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>״̬
|
||||
quint32 servoReady;//<2F>ŷ<EFBFBD>ʹ<EFBFBD><CAB9>״̬
|
||||
quint32 can_motor_run;//ͬ<><CDAC>״̬
|
||||
qint32 motor_speed[8];//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ת<EFBFBD><D7AA>
|
||||
quint32 robotMode;//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ģʽ
|
||||
double analog_ioInput[3];//ģ<><C4A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
double analog_ioOutput[5];//ģ<><C4A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
quint64 digital_ioInput;//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݵĶ<DDB5><C4B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ
|
||||
quint64 digital_ioOutput;//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݵĶ<DDB5><C4B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ
|
||||
quint8 collision;//<2F><>ײ<EFBFBD><D7B2><EFBFBD><EFBFBD>״̬
|
||||
double machineFlangePose[6];//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵ<EFBFBD>µķ<C2B5><C4B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><CEBB>
|
||||
double machineUserFlangePose[6];//<2F>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD>ϵ<EFBFBD>µķ<C2B5><C4B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><CEBB>
|
||||
quint8 emergencyStopState;//<2F><>ǰ<EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD>ڼ<EFBFBD>ͣ״̬
|
||||
double tcpSpeed;//tcp<63>˶<EFBFBD><CBB6>ٶ<EFBFBD>
|
||||
double joIntSpeed[8];//<2F>ؽ<EFBFBD><D8BD>˶<EFBFBD><CBB6>¸<EFBFBD><C2B8>ؽ<EFBFBD><D8BD>˶<EFBFBD><CBB6>ٶ<EFBFBD>
|
||||
double tcpAcc;//tcp<63><70><EFBFBD>ٶ<EFBFBD>
|
||||
double joIntAcc[8];//<2F>ؽ<EFBFBD><D8BD>˶<EFBFBD><CBB6>¸<EFBFBD><C2B8>ؽڼ<D8BD><DABC>ٶ<EFBFBD>
|
||||
double joIntTemperature[6];//<2F>¶<EFBFBD>
|
||||
double joIntTorque[6];//<2F><><EFBFBD><EFBFBD>Ť<EFBFBD><C5A4>
|
||||
double extJoIntTorques[6];//<2F>ⲿ<EFBFBD>ؽ<EFBFBD>Ť<EFBFBD><C5A4>ֵ
|
||||
double exTcpForceIntool[6];//<2F><>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵ<EFBFBD>µ<EFBFBD><C2B5>ⲿĩ<E2B2BF><C4A9><EFBFBD><EFBFBD>/<2F><><EFBFBD>ع<EFBFBD><D8B9><EFBFBD>ֵ
|
||||
quint8 dragState;//<2F>϶<EFBFBD>ʹ<EFBFBD><CAB9>״̬
|
||||
quint8 sensor_connected_state;//<2F><><EFBFBD>ش<EFBFBD><D8B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>״̬
|
||||
quint8 reserved;
|
||||
quint32 matchingWord;
|
||||
};
|
||||
|
||||
class EC8056 : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit EC8056(QObject* parent = nullptr);
|
||||
void connectToHost(const QString& host, quint16 port= 8056);
|
||||
|
||||
signals:
|
||||
void dataReceived(const ECData& data);
|
||||
void errorOccurred(const QString& error);
|
||||
|
||||
private slots:
|
||||
void onReadyRead();
|
||||
void onSocketError(QAbstractSocket::SocketError socketError);
|
||||
|
||||
private:
|
||||
QTcpSocket* socket;
|
||||
QByteArray buffer;
|
||||
|
||||
double readDouble(const QByteArray& buf, int& offset);
|
||||
quint64 readUInt64(const QByteArray& buf, int& offset);
|
||||
quint32 readUInt32(const QByteArray& buf, int& offset);
|
||||
qint32 readInt32(const QByteArray& buf, int& offset);
|
||||
quint8 readUInt8(const QByteArray& buf, int& offset);
|
||||
};
|
||||
|
||||
class RobotController : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit RobotController(QObject* parent = nullptr);
|
||||
~RobotController();
|
||||
|
||||
bool connectToRobot(const QString& ip, quint16 port = 8055);
|
||||
void disconnectFromRobot();
|
||||
void sendCommand(const QString& cmd, const QJsonValue& params = QJsonArray(), int id = 1);
|
||||
bool processResponse(QJsonObject response, QString& re);
|
||||
bool processResponse_getJbiState(QJsonObject response, QString& result);
|
||||
|
||||
bool getRobotPose(QJsonObject& re);
|
||||
bool getRobotState(QJsonObject& re);//ֹͣ״̬ 0<><30><EFBFBD><EFBFBD>ͣ״̬ 1<><31><EFBFBD><EFBFBD>ͣ״̬ 2<><32><EFBFBD><EFBFBD><EFBFBD><EFBFBD>״̬ 3<><33><EFBFBD><EFBFBD><EFBFBD><EFBFBD>״̬ 4<><34><EFBFBD><EFBFBD>ײ״̬ 5
|
||||
bool getJbiState(QJsonObject& re);//0 ֹͣ״̬,1 <20><>ͣ״̬,2 <20><>ͣ״̬,3 <20><><EFBFBD><EFBFBD>״̬,4 <20><><EFBFBD><EFBFBD>״̬
|
||||
bool getCurrentJobLine(QJsonObject& re);
|
||||
bool getRobotMode(QJsonObject& re);//ʾ<><CABE>ģʽ 0<><30><EFBFBD>Զ<EFBFBD>ģʽ 1<><31>Զ<EFBFBD><D4B6>ģʽ 2
|
||||
bool checkJbiExist(const QString& jbiFilename, QJsonObject& re);
|
||||
bool setServoStatus(int status, QJsonObject& re);
|
||||
bool runJbi(const QString& jbiFilename, QJsonObject& re, bool isRecordHsi);
|
||||
bool pauseTask(QJsonObject& re);
|
||||
bool run(QJsonObject& re);
|
||||
bool continueTask(QJsonObject& re);
|
||||
bool setRobotPowerStatus(int status, QJsonObject& re);
|
||||
|
||||
bool onReadyRead(QJsonObject& re);
|
||||
|
||||
private:
|
||||
QTcpSocket* socket;
|
||||
|
||||
QTimer* m_timer;
|
||||
int m_iTimeout = 3000;
|
||||
int m_iCurrentJbiJobLine = 0;
|
||||
int m_iFileCounter = 0;
|
||||
|
||||
signals:
|
||||
void commandResponse(bool success, const QJsonObject& response);
|
||||
void hsiRecordSignal(int);
|
||||
|
||||
private slots:
|
||||
void getPoint();
|
||||
};
|
||||
|
||||
class RobotArmControl : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
RobotArmControl(QWidget* parent = nullptr);
|
||||
~RobotArmControl();
|
||||
RobotController* robotController;
|
||||
|
||||
void onCommandResponse(QString str, const QJsonObject& response);
|
||||
|
||||
public Q_SLOTS:
|
||||
|
||||
void getTaskList();
|
||||
void getPose();
|
||||
|
||||
void connectRobotArm();
|
||||
void executeTaskWithHyperImager();
|
||||
void executeTaskWithoutHyperImager();
|
||||
void pauseTask();
|
||||
void continueTask();
|
||||
|
||||
void monitorRobotArm(const ECData& data);
|
||||
|
||||
signals:
|
||||
//void Opened();
|
||||
//void Closed();
|
||||
|
||||
private:
|
||||
Ui::RobotArmControl_UI ui;
|
||||
|
||||
EC8056* robotMonitor;
|
||||
QStringListModel* m_pModel;
|
||||
};
|
||||
138
HPPA/RobotArmControl.ui
Normal file
138
HPPA/RobotArmControl.ui
Normal file
@ -0,0 +1,138 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>RobotArmControl_UI</class>
|
||||
<widget class="QDialog" name="RobotArmControl_UI">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>424</width>
|
||||
<height>364</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Dialog</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_3">
|
||||
<item row="2" column="1">
|
||||
<widget class="QPushButton" name="pause_task_btn">
|
||||
<property name="text">
|
||||
<string>暂停任务</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QPushButton" name="connect2arm_btn">
|
||||
<property name="text">
|
||||
<string>连接机械臂</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QPushButton" name="execute_task_btn">
|
||||
<property name="text">
|
||||
<string>执行任务</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QPushButton" name="get_pose_btn">
|
||||
<property name="text">
|
||||
<string>获取pose</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QPushButton" name="continue_task_btn">
|
||||
<property name="text">
|
||||
<string>继续任务</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<widget class="QTextEdit" name="textEdit"/>
|
||||
</item>
|
||||
<item row="0" column="0" rowspan="6">
|
||||
<widget class="QFrame" name="frame_2">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="horizontalSpacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QPushButton" name="get_task_list_btn">
|
||||
<property name="text">
|
||||
<string>获取任务列表</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QListView" name="taskList_listView"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0" colspan="2">
|
||||
<widget class="QFrame" name="frame">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="2">
|
||||
<widget class="QLabel" name="pose_z_label">
|
||||
<property name="text">
|
||||
<string>z</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="pose_x_label">
|
||||
<property name="text">
|
||||
<string>x</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLabel" name="pose_y_label">
|
||||
<property name="text">
|
||||
<string>y</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
@ -9,7 +9,7 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>523</width>
|
||||
<width>629</width>
|
||||
<height>463</height>
|
||||
</rect>
|
||||
</property>
|
||||
@ -25,7 +25,7 @@
|
||||
<rect>
|
||||
<x>90</x>
|
||||
<y>250</y>
|
||||
<width>341</width>
|
||||
<width>434</width>
|
||||
<height>134</height>
|
||||
</rect>
|
||||
</property>
|
||||
@ -70,7 +70,7 @@
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>版本:1.8.6</string>
|
||||
<string>版本:1.9.0</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_4">
|
||||
|
||||
@ -17,7 +17,7 @@ public:
|
||||
~FileOperation();
|
||||
|
||||
string getDirectoryOfExe();//getDirectoryOfExe
|
||||
string getDirectoryFromString(string directory="C:/HPPA_image");
|
||||
string getDirectoryFromString(string directory="C:\\HPPA_image");
|
||||
|
||||
|
||||
|
||||
|
||||
@ -397,3 +397,529 @@ bool Configfile::updateConfigFile()
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
CorningConfigfile::CorningConfigfile()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void CorningConfigfile::setConfigfilePath(string configfilePath)
|
||||
{
|
||||
m_configfilePath = configfilePath;
|
||||
}
|
||||
|
||||
bool CorningConfigfile::isConfigfileExist()
|
||||
{
|
||||
QFileInfo info(QString::fromStdString(m_configfilePath));
|
||||
|
||||
return info.exists();
|
||||
}
|
||||
|
||||
bool CorningConfigfile::parseConfigfile()
|
||||
{
|
||||
// Read the file. If there is an error, report it and exit.
|
||||
try
|
||||
{
|
||||
cfg.readFile(m_configfilePath);
|
||||
|
||||
return true;
|
||||
}
|
||||
catch (const FileIOException& fioex)
|
||||
{
|
||||
std::cerr << "I/O error while reading file." << std::endl;
|
||||
return false;
|
||||
}
|
||||
catch (const ParseException& pex)
|
||||
{
|
||||
std::cerr << "Parse error at " << pex.getFile() << ":" << pex.getLine()
|
||||
<< " - " << pex.getError() << std::endl;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool CorningConfigfile::getSpectralBin(int& spectralBin)
|
||||
{
|
||||
try
|
||||
{
|
||||
spectralBin = cfg.lookup("spectralBin");
|
||||
|
||||
return true;
|
||||
}
|
||||
catch (const SettingNotFoundException& nfex)
|
||||
{
|
||||
cerr << "No 'spectralBin' setting in configuration file." << endl;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool CorningConfigfile::getspatialBin(int& spatialBin)
|
||||
{
|
||||
try
|
||||
{
|
||||
spatialBin = cfg.lookup("spatialBin");
|
||||
|
||||
return true;
|
||||
}
|
||||
catch (const SettingNotFoundException& nfex)
|
||||
{
|
||||
cerr << "No 'spatialBin' setting in configuration file." << endl;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool CorningConfigfile::getEffectiveWindow(int& width, int& offsetx, int& height, int& offsety)
|
||||
{
|
||||
const Setting& root = cfg.getRoot();
|
||||
|
||||
try
|
||||
{
|
||||
int spatialBin;
|
||||
int spectralBin;
|
||||
getspatialBin(spatialBin);
|
||||
getSpectralBin(spectralBin);
|
||||
|
||||
string spatialBinString;
|
||||
if (spatialBin == 1)
|
||||
{
|
||||
spatialBinString = "bin1";
|
||||
}
|
||||
else
|
||||
{
|
||||
spatialBinString = "bin2";
|
||||
}
|
||||
const Setting& spatialArgument = root["effective_window"][spatialBinString]["spatial"];
|
||||
if (!(spatialArgument.lookupValue("width", width)
|
||||
&& spatialArgument.lookupValue("offsetx", offsetx)))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
string spectralBinString;
|
||||
if (spectralBin == 1)
|
||||
{
|
||||
spectralBinString = "bin1";
|
||||
}
|
||||
else
|
||||
{
|
||||
spectralBinString = "bin2";
|
||||
}
|
||||
const Setting& spectralArgument = root["effective_window"][spectralBinString]["spectral"];
|
||||
if (!(spectralArgument.lookupValue("height", height)
|
||||
&& spectralArgument.lookupValue("offsety", offsety)))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
catch (const SettingNotFoundException& nfex)
|
||||
{
|
||||
// Ignore.
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CorningConfigfile::getEffectiveWindowRoi(int& width, int& offsetx)
|
||||
{
|
||||
const Setting& root = cfg.getRoot();
|
||||
|
||||
try
|
||||
{
|
||||
const Setting& effective_window = root["effective_window_roi"];
|
||||
int count = effective_window.getLength();
|
||||
|
||||
int spatialBin;
|
||||
getspatialBin(spatialBin);
|
||||
|
||||
string spatialBinString;
|
||||
if (spatialBin == 1)
|
||||
{
|
||||
spatialBinString = "spatialBin1";
|
||||
}
|
||||
else
|
||||
{
|
||||
spatialBinString = "spatialBin2";
|
||||
}
|
||||
|
||||
const Setting& window = effective_window[spatialBinString];
|
||||
string name = window.getName();
|
||||
|
||||
if (!(window.lookupValue("width", width)
|
||||
&& window.lookupValue("offsetx", offsetx)
|
||||
))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
catch (const SettingNotFoundException& nfex)
|
||||
{
|
||||
// Ignore.
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CorningConfigfile::getPushFlowParam(int& flowSwitch, int& rgbHeight, int& framerateVideo)
|
||||
{
|
||||
Setting& root = cfg.getRoot();
|
||||
|
||||
if (!root.exists("push_flow_param"))
|
||||
{
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EEB2BB><EFBFBD>ڣ<EFBFBD><DAA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
Setting& push_flow_param = root.add("push_flow_param", Setting::TypeGroup);
|
||||
|
||||
push_flow_param.add("flow_switch", Setting::TypeInt) = 0;
|
||||
push_flow_param.add("rgb_height", Setting::TypeInt) = 720;
|
||||
push_flow_param.add("framerate_video", Setting::TypeInt) = 5;
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD>ĺ<DEB8><C4BA><EFBFBD><EFBFBD><EFBFBD><EFBFBD>õ<EFBFBD><C3B5>ļ<EFBFBD>
|
||||
try
|
||||
{
|
||||
QList<QString> fileInfo = getFileInfo(QString::fromStdString(m_configfilePath));
|
||||
bool ret = createDir(fileInfo[0]);
|
||||
|
||||
cfg.writeFile(m_configfilePath.c_str());
|
||||
std::cout << "Config item 'push_flow_param' added." << std::endl;
|
||||
|
||||
flowSwitch = 0;
|
||||
rgbHeight = 720;
|
||||
framerateVideo = 5;
|
||||
|
||||
return true;
|
||||
}
|
||||
catch (const libconfig::FileIOException& fioex)
|
||||
{
|
||||
std::cerr << "I/O error while writing file." << std::endl;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
try
|
||||
{
|
||||
const Setting& push_flow_param = root["push_flow_param"];
|
||||
|
||||
if (!(push_flow_param.lookupValue("rgb_height", rgbHeight)
|
||||
&& push_flow_param.lookupValue("framerate_video", framerateVideo)
|
||||
&& push_flow_param.lookupValue("flow_switch", flowSwitch)
|
||||
))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
catch (const SettingNotFoundException& nfex)
|
||||
{
|
||||
// Ignore.
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
bool CorningConfigfile::getWindowOffsety_HeightOfSpectral(int& offsety, int& height, string spectralBinString)
|
||||
{
|
||||
const Setting& root = cfg.getRoot();
|
||||
|
||||
try
|
||||
{
|
||||
const Setting& spectralArgument = root["effective_window"][spectralBinString]["spectral"];
|
||||
if (!(spectralArgument.lookupValue("height", height)
|
||||
&& spectralArgument.lookupValue("offsety", offsety)))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
catch (const SettingNotFoundException& nfex)
|
||||
{
|
||||
// Ignore.
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CorningConfigfile::getGainOffset(float& gain, float& offset)
|
||||
{
|
||||
const Setting& root = cfg.getRoot();
|
||||
|
||||
try
|
||||
{
|
||||
const Setting& gainOffset = root["gainOffset"];
|
||||
int count = gainOffset.getLength();
|
||||
|
||||
int spectralBin;
|
||||
getSpectralBin(spectralBin);
|
||||
|
||||
string spectralBinString;
|
||||
if (spectralBin == 1)
|
||||
{
|
||||
spectralBinString = "spectralBin1";
|
||||
}
|
||||
else
|
||||
{
|
||||
spectralBinString = "spectralBin2";
|
||||
}
|
||||
|
||||
const Setting& gainOffsetSetting = gainOffset[spectralBinString];
|
||||
string name = gainOffsetSetting.getName();
|
||||
|
||||
if (!(gainOffsetSetting.lookupValue("gain", gain)
|
||||
&& gainOffsetSetting.lookupValue("offset", offset)))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
catch (const SettingNotFoundException& nfex)
|
||||
{
|
||||
// Ignore.
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CorningConfigfile::getGainOffsetOfSpectralBin1(float& gain, float& offset)
|
||||
{
|
||||
const Setting& root = cfg.getRoot();
|
||||
|
||||
try
|
||||
{
|
||||
const Setting& gainOffset = root["gainOffset"];
|
||||
int count = gainOffset.getLength();
|
||||
|
||||
string spectralBinString = "spectralBin1";
|
||||
|
||||
const Setting& gainOffsetSetting = gainOffset[spectralBinString];
|
||||
string name = gainOffsetSetting.getName();
|
||||
|
||||
if (!(gainOffsetSetting.lookupValue("gain", gain)
|
||||
&& gainOffsetSetting.lookupValue("offset", offset)))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
catch (const SettingNotFoundException& nfex)
|
||||
{
|
||||
// Ignore.
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CorningConfigfile::getSN(QString& SN)
|
||||
{
|
||||
try
|
||||
{
|
||||
std::string SN_tem = cfg.lookup("SN");
|
||||
SN = QString::fromStdString(SN_tem);
|
||||
|
||||
return true;
|
||||
}
|
||||
catch (const SettingNotFoundException& nfex)
|
||||
{
|
||||
cerr << "No 'spectralBin' setting in configuration file." << endl;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool CorningConfigfile::getBufferPolicy(int& bufferPolicy)
|
||||
{
|
||||
const Setting& root = cfg.getRoot();
|
||||
const Setting& ximeadll = root["ximeadll"];
|
||||
|
||||
try
|
||||
{
|
||||
if (!(ximeadll.lookupValue("buffer_policy", bufferPolicy)
|
||||
))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
catch (const SettingNotFoundException& nfex)
|
||||
{
|
||||
cerr << "No 'spectralBin' setting in configuration file." << endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CorningConfigfile::getAcqBufferSize(int& acqBufferSize)
|
||||
{
|
||||
const Setting& root = cfg.getRoot();
|
||||
const Setting& ximeadll = root["ximeadll"];
|
||||
|
||||
try
|
||||
{
|
||||
if (!(ximeadll.lookupValue("acq_buffer_size", acqBufferSize)
|
||||
))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
catch (const SettingNotFoundException& nfex)
|
||||
{
|
||||
cerr << "No 'spectralBin' setting in configuration file." << endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CorningConfigfile::createConfigFile()
|
||||
{
|
||||
using namespace std;
|
||||
using namespace libconfig;
|
||||
|
||||
Config cfg;
|
||||
|
||||
Setting& root = cfg.getRoot();
|
||||
|
||||
// Add some settings to the configuration.
|
||||
Setting& SN = root.add("SN", Setting::TypeString) = "0098";
|
||||
Setting& spatialBin = root.add("spatialBin", Setting::TypeInt) = 2;
|
||||
Setting& SpectralBin = root.add("spectralBin", Setting::TypeInt) = 2;
|
||||
|
||||
Setting& effective_window = root.add("effective_window", Setting::TypeGroup);
|
||||
Setting& effective_window_Bin1 = effective_window.add("bin1", Setting::TypeGroup);
|
||||
Setting& effective_window_Bin1_spatial = effective_window_Bin1.add("spatial", Setting::TypeGroup);
|
||||
Setting& effective_window_Bin1_Spectral = effective_window_Bin1.add("spectral", Setting::TypeGroup);
|
||||
Setting& effective_window_Bin2 = effective_window.add("bin2", Setting::TypeGroup);
|
||||
Setting& effective_window_Bin2_spatial = effective_window_Bin2.add("spatial", Setting::TypeGroup);
|
||||
Setting& effective_window_Bin2_Spectral = effective_window_Bin2.add("spectral", Setting::TypeGroup);
|
||||
|
||||
effective_window_Bin1_spatial.add("width", Setting::TypeInt) = 1368;
|
||||
effective_window_Bin1_spatial.add("offsetx", Setting::TypeInt) = 288;
|
||||
effective_window_Bin1_Spectral.add("height", Setting::TypeInt) = 300;
|
||||
effective_window_Bin1_Spectral.add("offsety", Setting::TypeInt) = 348;
|
||||
|
||||
effective_window_Bin2_spatial.add("width", Setting::TypeInt) = 688;
|
||||
effective_window_Bin2_spatial.add("offsetx", Setting::TypeInt) = 144;
|
||||
effective_window_Bin2_Spectral.add("height", Setting::TypeInt) = 150;
|
||||
effective_window_Bin2_Spectral.add("offsety", Setting::TypeInt) = 174;
|
||||
|
||||
Setting& effective_window_roi = root.add("effective_window_roi", Setting::TypeGroup);
|
||||
Setting& effective_window_roi_spatialBin1 = effective_window_roi.add("spatialBin1", Setting::TypeGroup);
|
||||
Setting& effective_window_roi_spatialBin2 = effective_window_roi.add("spatialBin2", Setting::TypeGroup);
|
||||
|
||||
effective_window_roi_spatialBin1.add("width", Setting::TypeInt) = 1364;
|
||||
effective_window_roi_spatialBin1.add("offsetx", Setting::TypeInt) = 14;
|
||||
// effective_window_roi_Bin1.add("height", Setting::TypeInt) = 300;
|
||||
// effective_window_roi_Bin1.add("offsety", Setting::TypeInt) = 348;
|
||||
|
||||
effective_window_roi_spatialBin2.add("width", Setting::TypeInt) = 682;
|
||||
effective_window_roi_spatialBin2.add("offsetx", Setting::TypeInt) = 15;
|
||||
// effective_window_roi_Bin2.add("height", Setting::TypeInt) = 151;
|
||||
// effective_window_roi_Bin2.add("offsety", Setting::TypeInt) = 174;
|
||||
|
||||
Setting& gainOffset = root.add("gainOffset", Setting::TypeGroup);
|
||||
Setting& gainOffsetSpectralBin1 = gainOffset.add("spectralBin1", Setting::TypeGroup);
|
||||
Setting& gainOffsetSpectralBin2 = gainOffset.add("spectralBin2", Setting::TypeGroup);
|
||||
|
||||
gainOffsetSpectralBin1.add("gain", Setting::TypeFloat) = 2.00313433;
|
||||
gainOffsetSpectralBin1.add("offset", Setting::TypeFloat) = -300.46283157590585;
|
||||
|
||||
gainOffsetSpectralBin2.add("gain", Setting::TypeFloat) = 4.00626868;
|
||||
gainOffsetSpectralBin2.add("offset", Setting::TypeFloat) = -299.46126663407176;
|
||||
|
||||
|
||||
Setting& ximeadll = root.add("ximeadll", Setting::TypeGroup);
|
||||
ximeadll.add("buffer_policy", Setting::TypeInt) = 0;
|
||||
ximeadll.add("acq_buffer_size", Setting::TypeInt) = 400;
|
||||
|
||||
Setting& push_flow_param = root.add("push_flow_param", Setting::TypeGroup);
|
||||
push_flow_param.add("flow_switch", Setting::TypeInt) = 1;
|
||||
push_flow_param.add("rgb_height", Setting::TypeInt) = 720;
|
||||
push_flow_param.add("framerate_video", Setting::TypeInt) = 5;
|
||||
|
||||
// Write out the new configuration.
|
||||
try
|
||||
{
|
||||
cfg.writeFile(m_configfilePath.c_str());
|
||||
cerr << "New configuration successfully written to: " << m_configfilePath.c_str() << endl;
|
||||
|
||||
}
|
||||
catch (const FileIOException& fioex)
|
||||
{
|
||||
cerr << "I/O error while writing configuration file: " << m_configfilePath.c_str() << endl;
|
||||
return true;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CorningConfigfile::updateConfigFile()
|
||||
{
|
||||
using namespace std;
|
||||
using namespace libconfig;
|
||||
|
||||
static const char* output_file = "updated.cfg";
|
||||
|
||||
Config cfg;
|
||||
|
||||
cfg.setOptions(Config::OptionFsync
|
||||
| Config::OptionSemicolonSeparators
|
||||
| Config::OptionColonAssignmentForGroups
|
||||
| Config::OptionOpenBraceOnSeparateLine);
|
||||
|
||||
// Read the file. If there is an error, report it and exit.
|
||||
try
|
||||
{
|
||||
cfg.readFile("example.cfg");
|
||||
}
|
||||
catch (const FileIOException& fioex)
|
||||
{
|
||||
std::cerr << "I/O error while reading file." << std::endl;
|
||||
return false;
|
||||
}
|
||||
catch (const ParseException& pex)
|
||||
{
|
||||
std::cerr << "Parse error at " << pex.getFile() << ":" << pex.getLine()
|
||||
<< " - " << pex.getError() << std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
// Find the 'movies' setting. Add intermediate settings if they don't yet
|
||||
// exist.
|
||||
Setting& root = cfg.getRoot();
|
||||
|
||||
if (!root.exists("inventory"))
|
||||
root.add("inventory", Setting::TypeGroup);
|
||||
|
||||
Setting& inventory = root["inventory"];
|
||||
|
||||
if (!inventory.exists("movies"))
|
||||
inventory.add("movies", Setting::TypeList);
|
||||
|
||||
Setting& movies = inventory["movies"];
|
||||
|
||||
// Create the new movie entry.
|
||||
Setting& movie = movies.add(Setting::TypeGroup);
|
||||
|
||||
movie.add("title", Setting::TypeString) = "Buckaroo Banzai";
|
||||
movie.add("media", Setting::TypeString) = "DVD";
|
||||
movie.add("price", Setting::TypeFloat) = 12.99;
|
||||
movie.add("qty", Setting::TypeInt) = 20;
|
||||
|
||||
// Write out the updated configuration.
|
||||
try
|
||||
{
|
||||
cfg.writeFile(output_file);
|
||||
cerr << "Updated configuration successfully written to: " << output_file
|
||||
<< endl;
|
||||
|
||||
}
|
||||
catch (const FileIOException& fioex)
|
||||
{
|
||||
cerr << "I/O error while writing file: " << output_file << endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -45,6 +45,36 @@ public:
|
||||
bool createConfigFile();
|
||||
bool updateConfigFile();
|
||||
|
||||
private:
|
||||
string m_configfilePath;
|
||||
Config cfg;
|
||||
};
|
||||
|
||||
class CorningConfigfile
|
||||
{
|
||||
public:
|
||||
CorningConfigfile();
|
||||
void setConfigfilePath(string configfilePath);
|
||||
bool isConfigfileExist();
|
||||
bool parseConfigfile();
|
||||
|
||||
bool getSpectralBin(int& spectralBin);
|
||||
bool getspatialBin(int& spatialBin);
|
||||
bool getEffectiveWindow(int& width, int& offsetx, int& height, int& offsety);
|
||||
bool getEffectiveWindowRoi(int& width, int& offsetx);
|
||||
bool getWindowOffsety_HeightOfSpectral(int& offsety, int& height, string spectralBinString);//spectralBinString = "bin1"<22><><EFBFBD>ߡ<EFBFBD>bin2<6E><32>
|
||||
bool getGainOffset(float& gain, float& offset);
|
||||
bool getGainOffsetOfSpectralBin1(float& gain, float& offset);
|
||||
bool getSN(QString& SN);
|
||||
|
||||
bool getBufferPolicy(int& bufferPolicy);
|
||||
bool getAcqBufferSize(int& acqBufferSize);
|
||||
|
||||
bool getPushFlowParam(int& flowSwitch, int& rgbHeight, int& framerateVideo);
|
||||
|
||||
bool createConfigFile();
|
||||
bool updateConfigFile();
|
||||
|
||||
private:
|
||||
string m_configfilePath;
|
||||
Config cfg;
|
||||
|
||||
@ -172,7 +172,7 @@ void CImage::FillFocusGrayQImage(unsigned short * datacube)
|
||||
}
|
||||
}
|
||||
|
||||
m_qimageFocusGrayImage->save("D:/delete/2222222222/test.bmp");
|
||||
//m_qimageFocusGrayImage->save("D:/delete/2222222222/test.bmp");
|
||||
|
||||
|
||||
|
||||
|
||||
165
HPPA/imager_base.cpp
Normal file
165
HPPA/imager_base.cpp
Normal file
@ -0,0 +1,165 @@
|
||||
#include "imager_base.h"
|
||||
Iris::ImagerBase::ImagerBase()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
Iris::ImagerBase::~ImagerBase()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void Iris::ImagerBase::set_spectral_bin(int new_spectral_bin)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
int Iris::ImagerBase::get_spectral_bin()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
int Iris::ImagerBase::get_min_spectral_bin()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
int Iris::ImagerBase::get_max_spectral_bin()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
int Iris::ImagerBase::get_start_band()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
void Iris::ImagerBase::set_start_band(int band)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
int Iris::ImagerBase::get_min_start_band()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
int Iris::ImagerBase::get_max_start_band()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
int Iris::ImagerBase::get_inc_start_band()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
int Iris::ImagerBase::get_end_band()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
void Iris::ImagerBase::set_end_band(int band)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
int Iris::ImagerBase::get_min_end_band()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
int Iris::ImagerBase::get_max_end_band()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
int Iris::ImagerBase::get_inc_end_band()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
int Iris::ImagerBase::get_start_sample()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
void Iris::ImagerBase::set_start_sample(int sample)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
int Iris::ImagerBase::get_min_start_sample()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
int Iris::ImagerBase::get_max_start_sample()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
int Iris::ImagerBase::get_inc_start_sample()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
int Iris::ImagerBase::get_end_sample()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
void Iris::ImagerBase::set_end_sample(int sample)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
int Iris::ImagerBase::get_min_end_sample()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
int Iris::ImagerBase::get_max_end_sample()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
int Iris::ImagerBase::get_inc_end_sample()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
void Iris::ImagerBase::set_gain(const double gain)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
double Iris::ImagerBase::get_gain()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
double Iris::ImagerBase::get_min_gain()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
double Iris::ImagerBase::get_max_gain()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
void Iris::ImagerBase::set_internal_trigger()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void Iris::ImagerBase::set_external_trigger(unsigned int signal_line, bool rising_edge)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
bool Iris::ImagerBase::is_trigger_external()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
93
HPPA/imager_base.h
Normal file
93
HPPA/imager_base.h
Normal file
@ -0,0 +1,93 @@
|
||||
/*
|
||||
* Iris API
|
||||
*
|
||||
* By using this API, the user agrees to the terms and conditions as stated in the
|
||||
* document "Terms of Use", located on the Resonon website
|
||||
* at: http://www.resonon.com/downloads/Resonon_API_Terms_of_Use.pdf.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#ifndef __GUARD_Iris_IMAGER_BASE_H
|
||||
#define __GUARD_Iris_IMAGER_BASE_H
|
||||
|
||||
#include <stdexcept>
|
||||
#include <cstdint>
|
||||
//#include "irisximeaimager_global.h"
|
||||
|
||||
/**
|
||||
* The Iris namespace contains all public classes.
|
||||
*/
|
||||
namespace Iris
|
||||
{
|
||||
/**
|
||||
* An abstract base class which provides a common interface for all imagers.
|
||||
*/
|
||||
class ImagerBase
|
||||
{
|
||||
public:
|
||||
ImagerBase();
|
||||
virtual ~ImagerBase();
|
||||
|
||||
|
||||
virtual void connect(const char * camera_sn=NULL)=0;
|
||||
virtual void disconnect()=0;
|
||||
virtual void start()=0;
|
||||
virtual void stop()=0;
|
||||
virtual void get_imager_type(char *buffer, int buffer_size)=0;
|
||||
virtual void get_serial_number(char *buffer, int buffer_size)=0;
|
||||
virtual void get_camera_serial_number(char *buffer, int buffer_size)=0;
|
||||
virtual void generate_configuration_report(char *buffer, int buffer_size)=0;
|
||||
virtual float get_coeff_a()=0;
|
||||
virtual float get_coeff_b()=0;
|
||||
virtual float get_coeff_c()=0;
|
||||
virtual double get_wavelength_at_band(const int band)=0;
|
||||
int get_nearest_band_to_wavelength(const double wavelength);
|
||||
virtual int get_frame_buffer_size_in_bytes()=0;
|
||||
virtual unsigned short* get_frame(unsigned short* buffer)=0;
|
||||
virtual std::uint64_t get_last_timestamp()=0;
|
||||
virtual std::uint64_t ticks_per_second()=0;
|
||||
virtual void set_spectral_bin(int new_spectral_bin);
|
||||
virtual int get_spectral_bin();
|
||||
virtual int get_min_spectral_bin();
|
||||
virtual int get_max_spectral_bin();
|
||||
virtual int get_band_count()=0;
|
||||
virtual int get_start_band();
|
||||
virtual void set_start_band(int band);
|
||||
virtual int get_min_start_band();
|
||||
virtual int get_max_start_band();
|
||||
virtual int get_inc_start_band();
|
||||
virtual int get_end_band();
|
||||
virtual void set_end_band(int band);
|
||||
virtual int get_min_end_band();
|
||||
virtual int get_max_end_band();
|
||||
virtual int get_inc_end_band();
|
||||
virtual int get_sample_count()=0;
|
||||
virtual int get_start_sample();
|
||||
virtual void set_start_sample(int sample);
|
||||
virtual int get_min_start_sample();
|
||||
virtual int get_max_start_sample();
|
||||
virtual int get_inc_start_sample();
|
||||
virtual int get_end_sample();
|
||||
virtual void set_end_sample(int sample);
|
||||
virtual int get_min_end_sample();
|
||||
virtual int get_max_end_sample();
|
||||
virtual int get_inc_end_sample();
|
||||
virtual void set_framerate(const double frames_per_second)=0;
|
||||
virtual double get_framerate()=0;
|
||||
virtual double get_min_framerate()=0;
|
||||
virtual double get_max_framerate()=0;
|
||||
virtual double get_min_integration_time()=0;
|
||||
virtual double get_max_integration_time()=0;
|
||||
virtual void set_integration_time(const double milliseconds)=0;
|
||||
virtual double get_integration_time()=0;
|
||||
virtual void set_gain(const double gain);
|
||||
virtual double get_gain();
|
||||
virtual double get_min_gain();
|
||||
virtual double get_max_gain();
|
||||
virtual void set_internal_trigger();
|
||||
virtual void set_external_trigger(unsigned int signal_line, bool rising_edge=true);
|
||||
virtual bool is_trigger_external();
|
||||
};
|
||||
} //end namespace Iris
|
||||
#endif //end ifndef __GUARD_Iris_IMAGER_BASE_H
|
||||
565
HPPA/irisximeaimager.cpp
Normal file
565
HPPA/irisximeaimager.cpp
Normal file
@ -0,0 +1,565 @@
|
||||
#include "irisximeaimager.h"
|
||||
using namespace Iris;
|
||||
|
||||
void Iris::IrisXimeaImager::setGainOffset(float gain, float offset)
|
||||
{
|
||||
m_fGain = gain;
|
||||
m_fOffset = offset;
|
||||
}
|
||||
|
||||
bool Iris::IrisXimeaImager::setSpectralBin(int spectralBin)
|
||||
{
|
||||
CE(xiSetParamInt(m_xiH, XI_PRM_BINNING_SELECTOR, XI_BIN_SELECT_HOST_CPU));//用:XI_BIN_SELECT_HOST_CPU;默认为XI_BIN_SELECT_SENSOR(会报错),不可用:XI_BIN_SELECT_DEVICE_FPGA
|
||||
CE(xiSetParamInt(m_xiH, XI_PRM_BINNING_VERTICAL_MODE, XI_BIN_MODE_AVERAGE));
|
||||
CE(xiSetParamInt(m_xiH, XI_PRM_BINNING_VERTICAL, spectralBin));
|
||||
printf("Iris::IrisXimeaImager::setSpectralBin----2 设置bin模式为XI_PRM_BINNING_SELECTOR XI_BIN_MODE_AVERAGE !\n");
|
||||
|
||||
|
||||
// CE(xiSetParamInt(m_xiH, XI_PRM_DECIMATION_SELECTOR, XI_DEC_SELECT_SENSOR));
|
||||
// CE(xiSetParamInt(m_xiH, XI_PRM_DECIMATION_VERTICAL, spectralBin));
|
||||
|
||||
|
||||
m_iSpectralBin = spectralBin;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Iris::IrisXimeaImager::setSpatialBin(int spatialBin)
|
||||
{
|
||||
CE(xiSetParamInt(m_xiH, XI_PRM_BINNING_SELECTOR, XI_BIN_SELECT_HOST_CPU));//用:XI_BIN_SELECT_HOST_CPU;默认为XI_BIN_SELECT_SENSOR(会报错),不可用:XI_BIN_SELECT_DEVICE_FPGA
|
||||
CE(xiSetParamInt(m_xiH, XI_PRM_BINNING_HORIZONTAL_MODE, XI_BIN_MODE_AVERAGE));
|
||||
CE(xiSetParamInt(m_xiH, XI_PRM_BINNING_HORIZONTAL, spatialBin));
|
||||
printf("Iris::IrisXimeaImager::setSpatialBin----2 设置bin模式为XI_PRM_BINNING_SELECTOR XI_BIN_MODE_AVERAGE !\n");
|
||||
|
||||
|
||||
// CE(xiSetParamInt(m_xiH, XI_PRM_DECIMATION_SELECTOR, XI_DEC_SELECT_SENSOR));
|
||||
// CE(xiSetParamInt(m_xiH, XI_PRM_DECIMATION_HORIZONTAL, spatialBin));
|
||||
|
||||
m_iSpatialBin = spatialBin;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
int Iris::IrisXimeaImager::getSpectralBin()
|
||||
{
|
||||
int spectralBin = 0;
|
||||
CE(xiGetParamInt(m_xiH, XI_PRM_BINNING_VERTICAL, &spectralBin));
|
||||
|
||||
// CE(xiGetParamInt(m_xiH, XI_PRM_DECIMATION_VERTICAL, &spectralBin));
|
||||
|
||||
return spectralBin;
|
||||
}
|
||||
|
||||
int Iris::IrisXimeaImager::getSpatialBin()
|
||||
{
|
||||
int spatialBin = 0;
|
||||
CE(xiGetParamInt(m_xiH, XI_PRM_BINNING_HORIZONTAL, &spatialBin));
|
||||
|
||||
// CE(xiGetParamInt(m_xiH, XI_PRM_DECIMATION_HORIZONTAL, &spatialBin));
|
||||
|
||||
return spatialBin;
|
||||
}
|
||||
|
||||
void Iris::IrisXimeaImager::setEffectiveWindow(int OffsetX, int width, int OffsetY, int height)
|
||||
{
|
||||
CE(xiSetParamInt(m_xiH, XI_PRM_WIDTH, width));
|
||||
CE(xiSetParamInt(m_xiH, XI_PRM_OFFSET_X, OffsetX));
|
||||
|
||||
CE(xiSetParamInt(m_xiH, XI_PRM_HEIGHT, height));
|
||||
CE(xiSetParamInt(m_xiH, XI_PRM_OFFSET_Y, OffsetY));
|
||||
|
||||
m_iEffectiveWindow_OffsetX = OffsetX;
|
||||
m_iEffectiveWindow_width = width;
|
||||
m_iEffectiveWindow_OffsetY = OffsetY;
|
||||
m_iEffectiveWindow_height = height;
|
||||
}
|
||||
|
||||
void Iris::IrisXimeaImager::setEffectiveWindowRoi(int OffsetX, int width)
|
||||
{
|
||||
m_iEffectiveWindowRoi_OffsetX = OffsetX;
|
||||
m_iEffectiveWindowRoi_width = width;
|
||||
}
|
||||
|
||||
int Iris::IrisXimeaImager::getBufferSizeOfOneFrame()
|
||||
{
|
||||
// if(m_xiH==NULL)
|
||||
// return 0;
|
||||
//
|
||||
// start();
|
||||
//
|
||||
// //清空image缓存
|
||||
// memset(&m_image, 0, sizeof(m_image));
|
||||
// m_image.size = sizeof(XI_IMG);
|
||||
//
|
||||
// CE(xiGetImage(m_xiH, 5000, &m_image)); // getting next image from the camera opened
|
||||
//
|
||||
// stop();
|
||||
//
|
||||
// return static_cast<int>(m_image.bp_size);
|
||||
|
||||
// //比实际大小(m_iEffectiveWindow_height * m_iEffectiveWindow_width * 2)大,why?
|
||||
// int value = 0;
|
||||
// xiGetParamInt(m_xiH, XI_PRM_IMAGE_PAYLOAD_SIZE, &value);
|
||||
|
||||
|
||||
return m_iEffectiveWindow_height * m_iEffectiveWindow_width * 2;
|
||||
}
|
||||
|
||||
float Iris::IrisXimeaImager::getTemperature()
|
||||
{
|
||||
float temperature = 0.0;
|
||||
CE(xiGetParamFloat(m_xiH, XI_PRM_TEMP, &temperature));
|
||||
|
||||
return temperature;
|
||||
}
|
||||
|
||||
void Iris::IrisXimeaImager::setBufferPolicy(int bufferPolicy)
|
||||
{
|
||||
if (bufferPolicy==0)
|
||||
{
|
||||
xiSetParamInt(m_xiH, XI_PRM_BUFFER_POLICY, XI_BP_UNSAFE);
|
||||
printf("Iris::IrisXimeaImager::connect---- XI_PRM_BUFFER_POLICY: XI_BP_UNSAFE\n");
|
||||
}
|
||||
else if (bufferPolicy==1)
|
||||
{
|
||||
xiSetParamInt(m_xiH, XI_PRM_BUFFER_POLICY, XI_BP_SAFE);
|
||||
printf("Iris::IrisXimeaImager::connect---- XI_PRM_BUFFER_POLICY: XI_BP_SAFE\n");
|
||||
}
|
||||
}
|
||||
|
||||
void Iris::IrisXimeaImager::setAcqBufferSize(int acqBufferSize)
|
||||
{
|
||||
XI_RETURN stat = XI_OK;
|
||||
|
||||
// set unit to 1 MiB
|
||||
xiSetParamInt(m_xiH, XI_PRM_ACQ_BUFFER_SIZE_UNIT, 1024*1024);
|
||||
int value = 0;
|
||||
xiGetParamInt(m_xiH, XI_PRM_ACQ_BUFFER_SIZE, &value);
|
||||
printf("Iris::IrisXimeaImager::connect---- XI_PRM_ACQ_BUFFER_SIZE: %d MiB.\n", value);
|
||||
|
||||
xiSetParamInt(m_xiH, XI_PRM_ACQ_BUFFER_SIZE, acqBufferSize);
|
||||
|
||||
xiGetParamInt(m_xiH, XI_PRM_ACQ_BUFFER_SIZE, &value);
|
||||
printf("Iris::IrisXimeaImager::connect---- XI_PRM_ACQ_BUFFER_SIZE: %d MiB.\n", value);
|
||||
|
||||
// set maximum number of queue
|
||||
int number_of_field_buffers = 0;
|
||||
xiGetParamInt(m_xiH, XI_PRM_BUFFERS_QUEUE_SIZE XI_PRM_INFO_MAX, &number_of_field_buffers);
|
||||
printf("Iris::IrisXimeaImager::connect---- XI_PRM_BUFFERS_QUEUE_SIZE XI_PRM_INFO_MAX: %d.\n", number_of_field_buffers);
|
||||
HandleResult(stat,"xiGetParam (number_of_field_buffers maximum)");
|
||||
xiSetParamInt(m_xiH, XI_PRM_BUFFERS_QUEUE_SIZE, number_of_field_buffers);
|
||||
HandleResult(stat,"xiSetParam (number_of_field_buffers)");
|
||||
}
|
||||
|
||||
Iris::IrisXimeaImager::IrisXimeaImager()
|
||||
{
|
||||
m_xiH=NULL;
|
||||
|
||||
//std::cout<<"ximeaControlDll 版本:"<< "21." <<std::endl;
|
||||
}
|
||||
|
||||
Iris::IrisXimeaImager::~IrisXimeaImager()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void Iris::IrisXimeaImager::connect(const char *camera_serial_number)
|
||||
{
|
||||
printf("Iris::IrisXimeaImager::connect----1 打开相机(xiOpenDevice)\n");
|
||||
CE(xiOpenDevice(0, &m_xiH));//没有插上ximea相机,这句代码都过不去
|
||||
|
||||
//add-----------------------------------------------------------------------------------------------------------------------
|
||||
XI_RETURN stat = XI_OK;
|
||||
|
||||
int payload=0;
|
||||
stat = xiGetParamInt(m_xiH, XI_PRM_IMAGE_PAYLOAD_SIZE, &payload);
|
||||
HandleResult(stat,"xiGetParam (payload)");
|
||||
|
||||
int transport_buffer_size_default = 0;
|
||||
int transport_buffer_size_increment = 0;
|
||||
int transport_buffer_size_minimum = 0;
|
||||
// get default transport buffer size - that should be OK on all controllers
|
||||
stat = xiGetParamInt(m_xiH, XI_PRM_ACQ_TRANSPORT_BUFFER_SIZE, &transport_buffer_size_default);
|
||||
HandleResult(stat,"xiGetParamInt (transport buffer size)");
|
||||
stat = xiGetParamInt(m_xiH, XI_PRM_ACQ_TRANSPORT_BUFFER_SIZE XI_PRM_INFO_INCREMENT, &transport_buffer_size_increment);
|
||||
HandleResult(stat,"xiGetParamInt (transport buffer size increment)");
|
||||
stat = xiGetParamInt(m_xiH, XI_PRM_ACQ_TRANSPORT_BUFFER_SIZE XI_PRM_INFO_MIN, &transport_buffer_size_minimum);
|
||||
HandleResult(stat,"xiGetParamInt (transport buffer size minimum)");
|
||||
|
||||
// check if payload size is less than default transport buffer size
|
||||
if(payload < transport_buffer_size_default + transport_buffer_size_increment)
|
||||
{
|
||||
// use optimized transport buffer size, as nearest increment to payload
|
||||
int transport_buffer_size = payload;
|
||||
if (transport_buffer_size_increment)
|
||||
{
|
||||
// round up to nearest increment
|
||||
int remainder = transport_buffer_size % transport_buffer_size_increment;
|
||||
if (remainder)
|
||||
transport_buffer_size += transport_buffer_size_increment - remainder;
|
||||
}
|
||||
// check the minimum
|
||||
if (transport_buffer_size < transport_buffer_size_minimum)
|
||||
transport_buffer_size = transport_buffer_size_minimum;
|
||||
stat = xiSetParamInt(m_xiH, XI_PRM_ACQ_TRANSPORT_BUFFER_SIZE, transport_buffer_size);
|
||||
HandleResult(stat,"xiSetParam (transport buffer size)");
|
||||
}
|
||||
//add---------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
// set unit to 1 MiB
|
||||
xiSetParamInt(m_xiH, XI_PRM_ACQ_BUFFER_SIZE_UNIT, 1024*1024);
|
||||
int value = 0;
|
||||
xiGetParamInt(m_xiH, XI_PRM_ACQ_BUFFER_SIZE, &value);
|
||||
printf("Iris::IrisXimeaImager::connect---- XI_PRM_ACQ_BUFFER_SIZE: %d MiB.\n", value);
|
||||
|
||||
|
||||
int NUM_THREADS = 0;
|
||||
xiGetParamInt(m_xiH, XI_PRM_PROC_NUM_THREADS, &NUM_THREADS);
|
||||
printf("Iris::IrisXimeaImager::connect---- XI_PRM_PROC_NUM_THREADS默认值为%d\n", NUM_THREADS);
|
||||
xiSetParamInt(m_xiH, XI_PRM_PROC_NUM_THREADS, 8);
|
||||
|
||||
//设置数据格式
|
||||
printf("Iris::IrisXimeaImager::connect----2 设置数据格式(xiSetParamInt)\n");
|
||||
CE(xiSetParamInt(m_xiH, XI_PRM_IMAGE_DATA_FORMAT, XI_RAW16));//Default value: XI_MONO8
|
||||
// //设置packing, 使用xiGetImage接收影像时不执行unpacking
|
||||
// CE(xiSetParamInt(m_xiH, XI_PRM_OUTPUT_DATA_BIT_DEPTH, 12));//set 12 bit transport data width
|
||||
// CE(xiSetParamInt(m_xiH, XI_PRM_OUTPUT_DATA_PACKING, XI_ON));//enable packing
|
||||
// //使用xiGetImage接收影像时不执行unpacking
|
||||
// CE(xiSetParamInt(m_xiH, XI_PRM_IMAGE_DATA_FORMAT, XI_FRM_TRANSPORT_DATA));//in this case, the function xiGetImage just set pointer to transport-buffer without any processing
|
||||
|
||||
//判断数据格式设置是否成功
|
||||
int dataFortmat;
|
||||
CE(xiGetParamInt(m_xiH, XI_PRM_IMAGE_DATA_FORMAT, &dataFortmat));
|
||||
if(dataFortmat==XI_RAW16)
|
||||
{
|
||||
printf("Iris::IrisXimeaImager::connect----当前数据格式设置成功, 设置为: XI_RAW16\n");
|
||||
}
|
||||
else if(dataFortmat==XI_FRM_TRANSPORT_DATA)
|
||||
{
|
||||
printf("Iris::IrisXimeaImager::connect----当前数据格式设置成功, 设置为: XI_FRM_TRANSPORT_DATA\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("Iris::IrisXimeaImager::connect----2 数据格式设置失败!\n");
|
||||
printf("Iris::IrisXimeaImager::connect----当前数据格式为:%d\n",dataFortmat);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void Iris::IrisXimeaImager::disconnect()
|
||||
{
|
||||
printf("Closing camera...\n");
|
||||
CE(xiCloseDevice(m_xiH));
|
||||
|
||||
m_xiH=NULL;
|
||||
}
|
||||
|
||||
void Iris::IrisXimeaImager::start()
|
||||
{
|
||||
CE(xiStartAcquisition(m_xiH));
|
||||
}
|
||||
|
||||
void Iris::IrisXimeaImager::stop()
|
||||
{
|
||||
//printf("Stopping acquisition...\n");
|
||||
CE(xiStopAcquisition(m_xiH));
|
||||
}
|
||||
|
||||
void Iris::IrisXimeaImager::get_imager_type(char *buffer, int buffer_size)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void Iris::IrisXimeaImager::get_serial_number(char *buffer, int buffer_size)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void Iris::IrisXimeaImager::get_camera_serial_number(char *buffer, int buffer_size)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void Iris::IrisXimeaImager::generate_configuration_report(char *buffer, int buffer_size)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
float Iris::IrisXimeaImager::get_coeff_a()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
float Iris::IrisXimeaImager::get_coeff_b()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
float Iris::IrisXimeaImager::get_coeff_c()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
double Iris::IrisXimeaImager::get_wavelength_at_band(const int band)
|
||||
{
|
||||
//sn008
|
||||
float a=1.999564;
|
||||
float b=-279.893;
|
||||
//
|
||||
float wavelength=band*m_fGain + m_fOffset;
|
||||
return wavelength;
|
||||
}
|
||||
|
||||
int Iris::IrisXimeaImager::get_frame_buffer_size_in_bytes()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
unsigned short *Iris::IrisXimeaImager::get_frame(unsigned short *buffer)
|
||||
{
|
||||
//清空image缓存
|
||||
memset(&m_image, 0, sizeof(m_image));
|
||||
m_image.size = sizeof(XI_IMG);
|
||||
|
||||
CE(xiGetImage(m_xiH, 5000, &m_image)); // getting next image from the camera opened
|
||||
|
||||
//方法1:memcpy
|
||||
memcpy(buffer,m_image.bp,m_image.bp_size);
|
||||
// //方法2:此做法是错误的,虽然是指针,也是传值!
|
||||
// buffer = (unsigned short *)m_image.bp;
|
||||
|
||||
// for(int i=0;i<m_iEffectiveWindow_height;i++)
|
||||
// {
|
||||
// memcpy(buffer+i*m_iEffectiveWindowRoi_width, (unsigned short *)m_image.bp + i*m_iEffectiveWindow_width + m_iEffectiveWindowRoi_OffsetX, m_iEffectiveWindowRoi_width*2);
|
||||
// }
|
||||
|
||||
//强制将指针从高精度(uint64_t*)转换到低精度(unsigned short *),会有精度降低的问题???????????????????????????????????????????????????
|
||||
return (unsigned short *)&m_timestampOfCamera;
|
||||
}
|
||||
|
||||
uint64_t Iris::IrisXimeaImager::get_last_timestamp()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint64_t Iris::IrisXimeaImager::ticks_per_second()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void Iris::IrisXimeaImager::set_spectral_bin(int new_spectral_bin)
|
||||
{
|
||||
}
|
||||
|
||||
int Iris::IrisXimeaImager::get_spectral_bin()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int Iris::IrisXimeaImager::get_min_spectral_bin()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int Iris::IrisXimeaImager::get_max_spectral_bin()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int Iris::IrisXimeaImager::get_band_count()
|
||||
{
|
||||
return m_iEffectiveWindow_height;
|
||||
}
|
||||
|
||||
int Iris::IrisXimeaImager::get_start_band()
|
||||
{
|
||||
int WindowStartLine;
|
||||
CE(xiGetParamInt(m_xiH, XI_PRM_OFFSET_Y, &WindowStartLine));
|
||||
|
||||
return WindowStartLine;
|
||||
}
|
||||
|
||||
void Iris::IrisXimeaImager::set_start_band(int band)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
int Iris::IrisXimeaImager::get_min_start_band()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int Iris::IrisXimeaImager::get_max_start_band()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int Iris::IrisXimeaImager::get_inc_start_band()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int Iris::IrisXimeaImager::get_end_band()
|
||||
{
|
||||
int height;
|
||||
CE(xiGetParamInt(m_xiH, XI_PRM_HEIGHT, &height));
|
||||
return get_start_band()+height;
|
||||
}
|
||||
|
||||
void Iris::IrisXimeaImager::set_end_band(int band)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
int Iris::IrisXimeaImager::get_min_end_band()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int Iris::IrisXimeaImager::get_max_end_band()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int Iris::IrisXimeaImager::get_inc_end_band()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int Iris::IrisXimeaImager::get_sample_count()
|
||||
{
|
||||
return m_iEffectiveWindow_width;
|
||||
}
|
||||
|
||||
int Iris::IrisXimeaImager::get_start_sample()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void Iris::IrisXimeaImager::set_start_sample(int sample)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
int Iris::IrisXimeaImager::get_min_start_sample()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int Iris::IrisXimeaImager::get_max_start_sample()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int Iris::IrisXimeaImager::get_inc_start_sample()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int Iris::IrisXimeaImager::get_end_sample()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void Iris::IrisXimeaImager::set_end_sample(int sample)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
int Iris::IrisXimeaImager::get_min_end_sample()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int Iris::IrisXimeaImager::get_max_end_sample()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int Iris::IrisXimeaImager::get_inc_end_sample()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void Iris::IrisXimeaImager::set_framerate(const double frames_per_second)
|
||||
{
|
||||
CE(xiSetParamInt(m_xiH, XI_PRM_ACQ_TIMING_MODE, XI_ACQ_TIMING_MODE_FRAME_RATE_LIMIT));
|
||||
|
||||
CE(xiSetParamFloat(m_xiH, XI_PRM_FRAMERATE, frames_per_second));
|
||||
}
|
||||
|
||||
double Iris::IrisXimeaImager::get_framerate()
|
||||
{
|
||||
float framerate;
|
||||
CE(xiGetParamFloat(m_xiH, XI_PRM_FRAMERATE, &framerate));
|
||||
return framerate;
|
||||
}
|
||||
|
||||
double Iris::IrisXimeaImager::get_min_framerate()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
double Iris::IrisXimeaImager::get_max_framerate()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
double Iris::IrisXimeaImager::get_min_integration_time()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
double Iris::IrisXimeaImager::get_max_integration_time()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void Iris::IrisXimeaImager::set_integration_time(const double microsecond)
|
||||
{
|
||||
CE(xiSetParamInt(m_xiH, XI_PRM_EXPOSURE, microsecond));//time_in_us(microseconds)
|
||||
}
|
||||
|
||||
double Iris::IrisXimeaImager::get_integration_time()
|
||||
{
|
||||
float exposureTime;
|
||||
CE(xiGetParamFloat(m_xiH, XI_PRM_EXPOSURE, &exposureTime));//time_in_us(microseconds)
|
||||
return exposureTime;
|
||||
}
|
||||
|
||||
void Iris::IrisXimeaImager::set_gain(const double gain)
|
||||
{
|
||||
CE(xiSetParamFloat(m_xiH, XI_PRM_GAIN, gain));//gain_in_db
|
||||
}
|
||||
|
||||
double Iris::IrisXimeaImager::get_gain()
|
||||
{
|
||||
float gain;
|
||||
CE(xiGetParamFloat(m_xiH, XI_PRM_GAIN, &gain));
|
||||
return gain;
|
||||
}
|
||||
|
||||
double Iris::IrisXimeaImager::get_min_gain()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
double Iris::IrisXimeaImager::get_max_gain()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void Iris::IrisXimeaImager::set_internal_trigger()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void Iris::IrisXimeaImager::set_external_trigger(unsigned int signal_line, bool rising_edge)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
bool Iris::IrisXimeaImager::is_trigger_external()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
123
HPPA/irisximeaimager.h
Normal file
123
HPPA/irisximeaimager.h
Normal file
@ -0,0 +1,123 @@
|
||||
#ifndef IRISXIMEAIMAGER_H
|
||||
#define IRISXIMEAIMAGER_H
|
||||
|
||||
#include <memory.h>
|
||||
#include <exception>
|
||||
#include <iostream>
|
||||
|
||||
//#include "irisximeaimager_global.h"
|
||||
#include "imager_base.h"
|
||||
#ifdef WIN32
|
||||
#include <xiApi.h> // Windows
|
||||
#else
|
||||
#include <m3api/xiApi.h> // Linux, OSX
|
||||
#endif
|
||||
|
||||
#define CE(func) {XI_RETURN stat = (func); if (XI_OK!=stat) {printf("Error:%d returned from function:"#func"\n",stat);throw stat;}}
|
||||
#define HandleResult(res,place) if (res!=XI_OK) {printf("Error after %s (%d)\n",place,res);}
|
||||
|
||||
namespace Iris
|
||||
{
|
||||
class IrisXimeaImager:public ImagerBase
|
||||
{
|
||||
public:
|
||||
HANDLE m_xiH;
|
||||
void setGainOffset(float gain, float offset);
|
||||
bool setSpectralBin(int spectralBin);
|
||||
bool setSpatialBin(int spatialBin);
|
||||
int getSpectralBin();
|
||||
int getSpatialBin();
|
||||
void setEffectiveWindow(int OffsetX, int width, int OffsetY, int height);
|
||||
void setEffectiveWindowRoi(int OffsetX, int width);
|
||||
int getBufferSizeOfOneFrame();
|
||||
float getTemperature();
|
||||
|
||||
XI_IMG m_image; // image buffer
|
||||
|
||||
void setBufferPolicy(int bufferPolicy);//0:XI_BP_UNSAFE; 1:XI_BP_SAFE;
|
||||
void setAcqBufferSize(int acqBufferSize);//单位MiB
|
||||
|
||||
public:
|
||||
//继承基类的
|
||||
IrisXimeaImager();//11111111111111111111
|
||||
virtual ~IrisXimeaImager();
|
||||
|
||||
void connect(const char * camera_serial_number=NULL);//111111111111111111111111111111111
|
||||
void disconnect();//111111111111111111111111111111
|
||||
void start();//111111111111111111111
|
||||
void stop();//1111111111111111111111
|
||||
void get_imager_type(char *buffer, int buffer_size);
|
||||
void get_serial_number(char *buffer, int buffer_size);
|
||||
void get_camera_serial_number(char *buffer, int buffer_size);
|
||||
void generate_configuration_report(char *buffer, int buffer_size);
|
||||
float get_coeff_a();
|
||||
float get_coeff_b();
|
||||
float get_coeff_c();
|
||||
double get_wavelength_at_band(const int band);//11111111111111111111
|
||||
int get_frame_buffer_size_in_bytes();
|
||||
unsigned short* get_frame(unsigned short* buffer);//11111111111111111111111
|
||||
std::uint64_t get_last_timestamp();
|
||||
std::uint64_t ticks_per_second();
|
||||
void set_spectral_bin(int new_spectral_bin);//11111111111111111111111111111111
|
||||
int get_spectral_bin();
|
||||
int get_min_spectral_bin();
|
||||
int get_max_spectral_bin();
|
||||
int get_band_count();//11111111111111111111
|
||||
int get_start_band();//对应上一版本api的函数:get_window_start_band
|
||||
void set_start_band(int band);
|
||||
int get_min_start_band();
|
||||
int get_max_start_band();
|
||||
int get_inc_start_band();
|
||||
int get_end_band();//对应上一版本api的函数:get_window_end_band
|
||||
void set_end_band(int band);
|
||||
int get_min_end_band();
|
||||
int get_max_end_band();
|
||||
int get_inc_end_band();
|
||||
int get_sample_count();//11111111111111111
|
||||
int get_start_sample();
|
||||
void set_start_sample(int sample);
|
||||
int get_min_start_sample();
|
||||
int get_max_start_sample();
|
||||
int get_inc_start_sample();
|
||||
int get_end_sample();
|
||||
void set_end_sample(int sample);
|
||||
int get_min_end_sample();
|
||||
int get_max_end_sample();
|
||||
int get_inc_end_sample();
|
||||
void set_framerate(const double frames_per_second);//11111111111111111111111111111111
|
||||
double get_framerate();//1111111111111111111111
|
||||
double get_min_framerate();
|
||||
double get_max_framerate();
|
||||
double get_min_integration_time();
|
||||
double get_max_integration_time();
|
||||
void set_integration_time(const double microsecond);//111111111111111111111
|
||||
double get_integration_time();//1111111111111111111111111111111
|
||||
void set_gain(const double gain);//111111111111
|
||||
double get_gain();//111111111111
|
||||
double get_min_gain();
|
||||
double get_max_gain();
|
||||
void set_internal_trigger();
|
||||
void set_external_trigger(unsigned int signal_line, bool rising_edge=true);
|
||||
bool is_trigger_external();
|
||||
protected:
|
||||
private:
|
||||
uint64_t m_timestampOfCamera;
|
||||
|
||||
int m_iSpectralBin;
|
||||
int m_iSpatialBin;
|
||||
|
||||
int m_iEffectiveWindow_OffsetX;
|
||||
int m_iEffectiveWindow_width;
|
||||
int m_iEffectiveWindow_OffsetY;
|
||||
int m_iEffectiveWindow_height;
|
||||
|
||||
int m_iEffectiveWindowRoi_OffsetX;
|
||||
int m_iEffectiveWindowRoi_width;
|
||||
|
||||
float m_fGain;
|
||||
float m_fOffset;
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
#endif // IRISXIMEAIMAGER_H
|
||||
285
HPPA/oneMotorControl.ui
Normal file
285
HPPA/oneMotorControl.ui
Normal file
@ -0,0 +1,285 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>OneMotorControl_UI</class>
|
||||
<widget class="QDialog" name="OneMotorControl_UI">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>544</width>
|
||||
<height>346</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>一轴马达控制</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>实时位置</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="text">
|
||||
<string>运行速度</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_7">
|
||||
<property name="text">
|
||||
<string>返回速度</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<widget class="QLineEdit" name="realTimeLoc_lineEdit">
|
||||
<property name="text">
|
||||
<string>0</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="speed_lineEdit">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">background-color: rgb(255, 255, 255);</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>0.1</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="return_speed_lineEdit">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">background-color: rgb(255, 255, 255);</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>2</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="move2loc_lineEdit">
|
||||
<property name="text">
|
||||
<string>0</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<item>
|
||||
<widget class="QPushButton" name="connect_btn">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>连接</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="zero_start_btn">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>归零</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="rangeMeasurement_btn">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>量程测量</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="move2loc_pushButton">
|
||||
<property name="text">
|
||||
<string>移动至</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>161</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QPushButton" name="left_btn">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>←0</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="right_btn">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>→</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="motor_state_label">
|
||||
<property name="text">
|
||||
<string>马达状态</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>191</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
@ -101,6 +101,17 @@ bool createDir(QString fullPath)
|
||||
}
|
||||
}
|
||||
|
||||
std::string removeFileExtension(std::string filename)
|
||||
{
|
||||
size_t lastDot = filename.find_last_of(".");
|
||||
if (lastDot == std::string::npos) {
|
||||
// 如果没有找到后缀,返回原字符串
|
||||
return filename;
|
||||
}
|
||||
return filename.substr(0, lastDot);
|
||||
|
||||
}
|
||||
|
||||
QList<QString> getFileInfo(QString file)
|
||||
{
|
||||
QFileInfo fileInfo = QFileInfo(file);
|
||||
|
||||
@ -3,6 +3,7 @@
|
||||
|
||||
#include <iostream>
|
||||
#include <ctime>
|
||||
#include <string>
|
||||
|
||||
#include <QString>
|
||||
#include <QDebug>
|
||||
@ -18,6 +19,7 @@ void bubbleSort(unsigned short * a, int n);
|
||||
void swap(unsigned short * a, unsigned short * b);
|
||||
|
||||
bool createDir(QString fullPath);
|
||||
std::string removeFileExtension(std::string filename);
|
||||
|
||||
QList<QString> getFileInfo(QString file);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user