From 52516d2f548e0924d4371506bb8b9f62f17789b7 Mon Sep 17 00:00:00 2001 From: tangchao0503 <735056338@qq.com> Date: Mon, 22 Sep 2025 15:32:42 +0800 Subject: [PATCH] =?UTF-8?q?1=E3=80=811=E8=BD=B4/2=E8=BD=B4=EF=BC=9A?= =?UTF-8?q?=E9=87=87=E9=9B=86=E7=99=BD=E6=9D=BF=E5=92=8C=E6=9A=97=E7=94=B5?= =?UTF-8?q?=E6=B5=81=E6=97=B6=EF=BC=8C=E7=A7=BB=E5=8A=A8=E9=A9=AC=E8=BE=BE?= =?UTF-8?q?=EF=BC=9B=202=E3=80=81=E7=A7=BB=E9=99=A4=E4=BB=A5=E5=89=8D?= =?UTF-8?q?=E7=9A=84=E9=87=87=E9=9B=86=E9=80=BB=E8=BE=91=EF=BC=8C=E9=A9=AC?= =?UTF-8?q?=E8=BE=BE=E6=8E=A7=E5=88=B6=E5=85=A8=E7=94=A8=E5=A4=9A=E8=BD=B4?= =?UTF-8?q?=E6=8E=A7=E5=88=B6=E5=99=A8=EF=BC=8C=E9=87=87=E9=9B=86=E9=80=BB?= =?UTF-8?q?=E8=BE=91=E5=85=A8=E6=94=BE=E5=88=B0=E9=87=87=E9=9B=86=E9=80=BB?= =?UTF-8?q?=E8=BE=91=E6=8E=A7=E5=88=B6=E5=99=A8=E9=87=8C=EF=BC=9B=203?= =?UTF-8?q?=E3=80=81=E5=88=A0=E9=99=A4=E4=BA=86=E5=A4=9A=E4=BD=99=E6=96=87?= =?UTF-8?q?=E4=BB=B6=EF=BC=9B=204=E3=80=81=E6=B7=BB=E5=8A=A0=E4=BA=86?= =?UTF-8?q?=E8=BE=90=E4=BA=AE=E5=BA=A6=E5=92=8C=E5=8F=8D=E5=B0=84=E7=8E=87?= =?UTF-8?q?=E7=95=8C=E9=9D=A2=EF=BC=8C=E5=B9=B6=E6=B2=A1=E6=9C=89=E5=AE=9E?= =?UTF-8?q?=E7=8E=B0=E5=8A=9F=E8=83=BD=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 5 + HPPA/CaptureCoordinator.cpp | 113 +++ HPPA/CaptureCoordinator.h | 43 +- HPPA/HPPA.cpp | 1231 +-------------------------------- HPPA/HPPA.h | 108 --- HPPA/HPPA.ui | 770 +-------------------- HPPA/HPPA.vcxproj | 15 +- HPPA/HPPA.vcxproj.filters | 30 +- HPPA/OneMotorControl.cpp | 24 + HPPA/OneMotorControl.h | 6 + HPPA/PathPlan.cpp | 308 --------- HPPA/PathPlan.h | 37 - HPPA/RadianceConversion.ui | 167 +++++ HPPA/ReflectanceConversion.ui | 167 +++++ HPPA/TwoMotorControl.cpp | 24 + HPPA/TwoMotorControl.h | 6 + HPPA/about.ui | 2 +- 17 files changed, 627 insertions(+), 2429 deletions(-) delete mode 100644 HPPA/PathPlan.cpp delete mode 100644 HPPA/PathPlan.h create mode 100644 HPPA/RadianceConversion.ui create mode 100644 HPPA/ReflectanceConversion.ui diff --git a/.gitignore b/.gitignore index b31d297..068f79b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,10 @@ # tc GeneratedFiles/ +ResononAPISetup-3.12-64bit.exe +gdal202.dll +*.rej +HPPA类图.drawio +HPPA - 副本.ui ## Ignore Visual Studio temporary files, build results, and ## files generated by popular Visual Studio add-ons. diff --git a/HPPA/CaptureCoordinator.cpp b/HPPA/CaptureCoordinator.cpp index 062a09f..596d5f9 100644 --- a/HPPA/CaptureCoordinator.cpp +++ b/HPPA/CaptureCoordinator.cpp @@ -601,3 +601,116 @@ void OneMotionCaptureCoordinator::handleError(const QString& error) m_isRunning = false; emit errorOccurred(error); } + +DarkAndWhiteCaptureCoordinator::DarkAndWhiteCaptureCoordinator( + int model, + IrisMultiMotorController* motorCtrl, + ImagerOperationBase* cameraCtrl, + QObject* parent) + : QObject(parent) + , m_model(model) + , m_motorCtrl(motorCtrl) + , m_cameraCtrl(cameraCtrl) + , m_isRunning(false) +{ + connect(this, SIGNAL(moveTo(int, double, double, int)), + m_motorCtrl, SLOT(moveTo(int, double, double, int))); + connect(this, SIGNAL(moveSignal(int, bool, double, int)), m_motorCtrl, SLOT(move(int, bool, double, int))); + connect(this, &DarkAndWhiteCaptureCoordinator::stopMotorSignal, m_motorCtrl, &IrisMultiMotorController::stop); + + connect(m_motorCtrl, &IrisMultiMotorController::motorStopSignal, + this, &DarkAndWhiteCaptureCoordinator::handleMotorStoped); + + if (m_model == 0)//dark + { + connect(this, &DarkAndWhiteCaptureCoordinator::startRecordHSISignal, + m_cameraCtrl, &ImagerOperationBase::record_dark); + connect(m_cameraCtrl, &ImagerOperationBase::RecordDarlFinishSignal, + this, &DarkAndWhiteCaptureCoordinator::handleCaptureCompleteWhenFrameNumberMeet); + } + else if(m_model == 1)//white + { + connect(this, &DarkAndWhiteCaptureCoordinator::startRecordHSISignal, + m_cameraCtrl, &ImagerOperationBase::record_white); + connect(m_cameraCtrl, &ImagerOperationBase::RecordWhiteFinishSignal, + this, &DarkAndWhiteCaptureCoordinator::handleCaptureCompleteWhenFrameNumberMeet); + } + +} + +DarkAndWhiteCaptureCoordinator::~DarkAndWhiteCaptureCoordinator() +{ + +} + +void DarkAndWhiteCaptureCoordinator::startStepMotion(double speed) +{ + QMutexLocker locker(&m_dataMutex); + + if (m_isRunning) + { + return; + } + + m_isRunning = true; + + m_speed = speed; + + getLocBeforeStart(); + + //移动马达并开始采集高光谱 + emit moveSignal(0, false, m_speed, 1000); + emit startRecordHSISignal(); +} + +void DarkAndWhiteCaptureCoordinator::handleCaptureCompleteWhenFrameNumberMeet() +{ + emit stopMotorSignal(0); +} + +void DarkAndWhiteCaptureCoordinator::getLocBeforeStart() +{ + QEventLoop loop; + bool received = false; + + QTimer timer; + timer.setSingleShot(true); + connect(&timer, &QTimer::timeout, &loop, &QEventLoop::quit); + + QMetaObject::Connection conn = QObject::connect(m_motorCtrl, &IrisMultiMotorController::locationSignal, + [&](std::vector pos) { + m_locBeforeStart = pos; + received = true; + loop.quit(); + }); + + QMetaObject::invokeMethod(m_motorCtrl, "getLoc", Qt::QueuedConnection); + timer.start(3000); + + loop.exec(); + + disconnect(conn); +} + +void DarkAndWhiteCaptureCoordinator::move2LocBeforeStart() +{ + std::cout << "\nmove2LocBeforeStart." << std::endl; + + emit moveTo(0, m_locBeforeStart[0], m_speed, 1000); + + m_isRunning = false; +} + +void DarkAndWhiteCaptureCoordinator::handleMotorStoped(int motorID, double pos) +{ + QMutexLocker locker(&m_dataMutex); + + if (!m_isRunning) return; + + move2LocBeforeStart(); +} + +void DarkAndWhiteCaptureCoordinator::handleCaptureComplete(double index) +{ + QMutexLocker locker(&m_dataMutex); +} diff --git a/HPPA/CaptureCoordinator.h b/HPPA/CaptureCoordinator.h index 3b35f15..801dfb0 100644 --- a/HPPA/CaptureCoordinator.h +++ b/HPPA/CaptureCoordinator.h @@ -166,4 +166,45 @@ private: std::vector m_locBeforeStart; void getLocBeforeStart(); void move2LocBeforeStart(); -}; \ No newline at end of file +}; + +class DarkAndWhiteCaptureCoordinator : public QObject +{ + Q_OBJECT +public: + DarkAndWhiteCaptureCoordinator(int model, IrisMultiMotorController* motorCtrl, + ImagerOperationBase* cameraCtrl, + QObject* parent = nullptr); + ~DarkAndWhiteCaptureCoordinator(); + +public slots: + void startStepMotion(double speed); + + void handleCaptureCompleteWhenFrameNumberMeet(); + +signals: + void sequenceComplete(int); + void moveTo(int, double, double, int); + void moveSignal(int, bool, double, int); + void stopMotorSignal(int axis); + + void startRecordHSISignal(); + +private slots: + void handleMotorStoped(int motorID, double pos); + void handleCaptureComplete(double index); + +private: + IrisMultiMotorController* m_motorCtrl; + ImagerOperationBase* m_cameraCtrl; + mutable QMutex m_dataMutex; + + bool m_isRunning; + + double m_speed; + int m_model;//0:dark,1:white + + std::vector m_locBeforeStart; + void getLocBeforeStart(); + void move2LocBeforeStart(); +}; diff --git a/HPPA/HPPA.cpp b/HPPA/HPPA.cpp index b6a1914..bc516a6 100644 --- a/HPPA/HPPA.cpp +++ b/HPPA/HPPA.cpp @@ -17,8 +17,6 @@ HPPA::HPPA(QWidget *parent) QCoreApplication::setOrganizationDomain("iris.com"); QCoreApplication::setApplicationName("HPPA"); - - //ļûУʹļ string HPPACfgFile = getPathofEXE() + "\\HPPA.cfg"; mConfigfile.setConfigfilePath(HPPACfgFile); @@ -51,12 +49,12 @@ HPPA::HPPA(QWidget *parent) mConfigfile.getYMotorParm(StepAnglemar_y, Lead_y, SubdivisionMultiples_y, ScaleFactor_y);*/ //״̬ - xmotor_state_label1 = new QLabel(); - ymotor_state_label1 = new QLabel(); - xmotor_state_label1->setText("xMotor"); - ymotor_state_label1->setText("yMotor"); - ui.statusBar->addPermanentWidget(xmotor_state_label1); - ui.statusBar->addPermanentWidget(ymotor_state_label1); + //xmotor_state_label1 = new QLabel(); + //ymotor_state_label1 = new QLabel(); + //xmotor_state_label1->setText("xMotor"); + //ymotor_state_label1->setText("yMotor"); + //ui.statusBar->addPermanentWidget(xmotor_state_label1); + //ui.statusBar->addPermanentWidget(ymotor_state_label1); connect(this->ui.action_exit, SIGNAL(triggered()), this, SLOT(onExit())); @@ -129,111 +127,19 @@ HPPA::HPPA(QWidget *parent) ui.IntegratioinTimeSlider->setEnabled(false); ui.GainSlider->setEnabled(false); - - - - m_xMotor = nullptr; - m_yMotor = nullptr; - - - - //m_TestXmotorStausThread = new MotorWorkerThread(m_xMotor); - //m_TestXmotorStausThread->start(); - startTimer(1000); - - m_lManualSpeedOfXMotor = 6000 * 4 * 2; - m_lManualSpeedOfYMotor = 6000 * 4;//ϺũԺ20000 - - connect(this->ui.motor_reset_btn, SIGNAL(clicked()), this, SLOT(onMotorReset())); - - connect(this->ui.xmotor_left_btn, SIGNAL(pressed()), this, SLOT(onxMotorLeft())); - connect(this->ui.xmotor_left_btn, SIGNAL(released()), this, SLOT(onxMotorStop())); - connect(this->ui.xmotor_right_btn, SIGNAL(pressed()), this, SLOT(onxMotorRight())); - connect(this->ui.xmotor_right_btn, SIGNAL(released()), this, SLOT(onxMotorStop())); - - connect(this->ui.ymotor_forward_btn, SIGNAL(pressed()), this, SLOT(onyMotorForward())); - connect(this->ui.ymotor_forward_btn, SIGNAL(released()), this, SLOT(onyMotorStop())); - connect(this->ui.ymotor_backward_btn, SIGNAL(pressed()), this, SLOT(onyMotorBackward())); - connect(this->ui.ymotor_backward_btn, SIGNAL(released()), this, SLOT(onyMotorStop())); - - //ٶ - //QRegExp rx("\\d{0,3}.[1-9]$"); - QRegExp rx("^\\d+(\\.\\d+)?$"); - ui.xmotor_speed_lineEdit->setValidator(new QRegExpValidator(rx)); - - //ȡļ - float lead;// - float stepAnglemar;// - float scaleFactor;//еװõԭ - int subdivisionMultiples;//ϸ - float maxRange; - mConfigfile.getXMotorParm(stepAnglemar, lead, subdivisionMultiples, scaleFactor, maxRange); - - ui.xmotor_speed_slider->setMultiplier(lead, stepAnglemar, scaleFactor, subdivisionMultiples); - ui.xmotor_speed_slider->setRange(0, 3);//5.2734375cm/s=10000 - ui.xmotor_speed_slider->setValue(1); - connect(this->ui.xmotor_speed_lineEdit, SIGNAL(editingFinished()), this, SLOT(OnXmotorSpeedLineeditEditingFinished())); - //connect(this->ui.xmotor_speed_lineEdit, SIGNAL(editingFinished()), this, SLOT(OnXmotorSpeedEditingFinished()));//ͨ˷ʽΪٶȣÿεɼ󣬶ȡٶȣȻ - connect(this->ui.xmotor_speed_slider, SIGNAL(valueChanged(double)), this, SLOT(OnXmotorSpeedSliderChanged(double))); - - connect(this->ui.xmotor_location_lineEdit, SIGNAL(editingFinished()), this, SLOT(OnXmotorLocationLineeditEditingFinished())); - connect(this->ui.xmotor_location_slider, SIGNAL(valueChanged(double)), this, SLOT(OnXmotorLocationSliderChanged(double))); - connect(this->ui.xmotor_location_slider, SIGNAL(sliderReleased()), this, SLOT(OnXmotorLocationSliderReleased())); - ui.xmotor_location_slider->setMultiplier(lead, stepAnglemar, scaleFactor, subdivisionMultiples); - ui.xmotor_location_slider->setValue(0); - - mConfigfile.getYMotorParm(stepAnglemar, lead, subdivisionMultiples, scaleFactor, maxRange); - connect(this->ui.ymotor_location_lineEdit, SIGNAL(editingFinished()), this, SLOT(OnYmotorLocationLineeditEditingFinished())); - connect(this->ui.ymotor_location_slider, SIGNAL(valueChanged(double)), this, SLOT(OnYmotorLocationSliderChanged(double))); - connect(this->ui.ymotor_location_slider, SIGNAL(sliderReleased()), this, SLOT(OnYmotorLocationSliderReleased())); - ui.ymotor_location_slider->setMultiplier(lead, stepAnglemar, scaleFactor, subdivisionMultiples); - ui.ymotor_location_slider->setValue(0); - - - - m_timerLocationFeedBackOfMotor_x_y = new QTimer(); - connect(m_timerLocationFeedBackOfMotor_x_y, SIGNAL(timeout()), this, SLOT(ontimerLocationFeedBackOfMotor_x_y())); - - m_timerYmotorLocationFeedBackAfterRecord = new QTimer(); - connect(m_timerYmotorLocationFeedBackAfterRecord, SIGNAL(timeout()), this, SLOT(ontimerYmotorLocationFeedBackAfterRecord())); - - //̲ - connect(this->ui.test_range_btn, SIGNAL(clicked()), this, SLOT(ontestRangeOfMotor_x_y())); - m_timerTestRangeOfxMotor = new QTimer(); - connect(m_timerTestRangeOfxMotor, SIGNAL(timeout()), this, SLOT(ontimerTestRangeOfxMotor())); - m_timerTestRangeOfyMotor = new QTimer(); - connect(m_timerTestRangeOfyMotor, SIGNAL(timeout()), this, SLOT(ontimerTestRangeOfyMotor())); - widthScale = 1; heightScale = 1; //λģ connect(ui.graphicsView->imager, SIGNAL(leftMouseButtonPressed(int, int)), this, SLOT(onimagerSimulatorMove(int, int))); - // - m_ForLoopControlThread = new QThread(); - m_ForLoopControl = new ForLoopControl(); - m_ForLoopControl->moveToThread(m_ForLoopControlThread); - m_ForLoopControlThread->start(); - - - //connect(this->ui.action_start_recording, SIGNAL(triggered()), m_ForLoopControl, SLOT(startLoop()));//ںonconnect - connect(m_ForLoopControl, SIGNAL(recordSignal(int)), this, SLOT(onStartRecordStep2(int))); - - - - m_timerMoveXmotor = new QTimer(); - connect(m_timerMoveXmotor, SIGNAL(timeout()), this, SLOT(ontimerMoveXmotor())); - m_timerMoveYmotor = new QTimer(); - connect(m_timerMoveYmotor, SIGNAL(timeout()), this, SLOT(ontimerMoveYmotor())); // ui.ImageViewerTabWidget->clear();//ǰ棬ɾеtab //ui.ImageViewerTabWidget->setTabsClosable(true);//ÿҳйرհť - connect(m_ForLoopControl, SIGNAL(recordSignal(int)), this, SLOT(onCreateTab(int)));//tabWidget½һtabʾͼ connect(ui.ImageViewerTabWidget, SIGNAL(currentChanged(int)), this, SLOT(onTabWidgetCurrentChanged(int))); // @@ -258,15 +164,6 @@ HPPA::HPPA(QWidget *parent) //QLineSeries *series = new QLineSeries(); //QChart *chart = new QChart(); mPanelMenu->addAction(ui.mDockWidgetSpectralViewer->toggleViewAction()); - - //켣滮 - m_pathPlan = new PathPlan(m_xMotor, m_yMotor, ui.xmotor_location_slider, ui.ymotor_location_slider); - QDockWidget* dock_pathPlan = new QDockWidget(QString::fromLocal8Bit("켣滮"), this); - 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()); //dock adjustTable* adt = new adjustTable(); @@ -275,7 +172,7 @@ HPPA::HPPA(QWidget *parent) dock_adt->setObjectName("mDockAdjustTable"); dock_adt->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea); dock_adt->setWidget(adt); - tabifyDockWidget(dock_pathPlan, dock_adt); + tabifyDockWidget(ui.mDockWidgetSpectrometer, dock_adt); mPanelMenu->addAction(dock_adt->toggleViewAction()); //Դ @@ -287,8 +184,6 @@ HPPA::HPPA(QWidget *parent) dock_pc->setWidget(pc); tabifyDockWidget(dock_adt, dock_pc); mPanelMenu->addAction(dock_pc->toggleViewAction()); - connect(pc, &PowerControl::powerOpened, this, &HPPA::newMotor); - connect(pc, &PowerControl::powerClosed, this, &HPPA::deleteMotor); //еۿ rac = new RobotArmControl(); @@ -413,7 +308,6 @@ 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); moveplatformActionGroup->addAction(ui.mAction_2AxisMotor_new); @@ -427,10 +321,6 @@ void HPPA::createMoveplatformActionGroup() { 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); @@ -468,24 +358,10 @@ HPPA::~HPPA() //m_Imager->~ResononNirImager();//ͷԴ delete m_Imager; } - - if (m_xMotor != nullptr && m_yMotor != nullptr) - { - if (isMotorConnected(m_xMotor)) - { - m_xMotor->StopMotormove(); - } - if (isMotorConnected(m_yMotor)) - { - m_yMotor->StopMotormove(); - } - } } void HPPA::initPanelToolbar() { - tabifyDockWidget(ui.mDockWidgetSpectrometer, ui.mDockWidgetLinearStage); - mPanelMenu = new QMenu(QString::fromLocal8Bit(""), this);//create panel menu mPanelMenu->setObjectName(QStringLiteral("mPanelMenu")); mToolbarMenu = new QMenu(QString::fromLocal8Bit(""), this);//create toolbar menu @@ -496,7 +372,6 @@ void HPPA::initPanelToolbar() ui.mWindowsMenu->addMenu(mToolbarMenu); mPanelMenu->addAction(ui.mDockWidgetSpectrometer->toggleViewAction()); - mPanelMenu->addAction(ui.mDockWidgetLinearStage->toggleViewAction()); mPanelMenu->addAction(ui.mDockWidgetRGBCamera->toggleViewAction()); mPanelMenu->addAction(ui.mDockWidgetSimulator->toggleViewAction()); @@ -649,78 +524,6 @@ void HPPA::onStartRecordStep1() } return; } - else if (checkedName == "mAction_2AxisMotor") - { - //ȷxλ С xɼλ - 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("ʾ"), QString::fromLocal8Bit("켣xλ")); - return; - } - - //ȷɼߴ - if (m_pathPlan->getRecordLineTableWidget()->rowCount() <= 0) - { - QMessageBox::information(this, QString::fromLocal8Bit("ʾ"), QString::fromLocal8Bit("ɹ켣")); - return; - } - - //ʼɼ - m_RecordState += 1; - - if (m_RecordState % 2 == 1) - { - // - operateWidget = QObject::sender()->objectName(); - - //ɾtab - ui.ImageViewerTabWidget->clear(); - - m_hTimesFile = fopen(x_location.c_str(), "w+"); - - m_Imager->setFileName2Save(imgPath); - - //ʼѭ - m_ForLoopControl->setLoopCount(m_pathPlan->getRecordLineTableWidget()->rowCount());//Ϊѭ߳ѭ - emit StartLoopSignal(); - - - //Ϊɫ - 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("ֹͣɼ")); - ui.mainToolBar->widgetForAction(ui.action_start_recording)->setStyleSheet("QWidget{background-color:rgb(255,0,0);}"); - } - else - { - m_Imager->setRecordControlState(false);//ֹͣɼ - - m_ForLoopControl->m_boolQuitLoop = true;//ѭֹͣ - - ui.action_start_recording->setText(QString::fromLocal8Bit("ɼ")); - ui.mainToolBar->widgetForAction(ui.action_start_recording)->setStyleSheet("QWidget{background-color:rgb(0,255,0);}"); - } - - return; - } else if (checkedName == "mAction_2AxisMotor_new") { m_RecordState += 1; @@ -761,60 +564,6 @@ void HPPA::onStartRecordStep1() } } -void HPPA::onStartRecordStep2(int lineNumber) -{ - if (m_xMotor == nullptr && m_yMotor == nullptr) - { - return; - } - - if (lineNumber >= 0) - { - m_numberOfRecording = lineNumber; - } - - if (lineNumber >= 0) - { - //ʼƶyxƶ͹DzɼĴҲ - double pos = m_pathPlan->getRecordLineTableWidget()->item(lineNumber, 0)->text().toDouble(); - m_yMotor->SettingSpeed(m_lManualSpeedOfYMotor); - m_yMotor->MoveToLocation(ui.ymotor_location_slider->getPositionPulse(pos)); - m_timerMoveYmotor->start(500); - - //ڲɼΪɫ - for (size_t i = 0; i < m_pathPlan->getRecordLineTableWidget()->columnCount(); i++) - { - m_pathPlan->getRecordLineTableWidget()->item(lineNumber, i)->setBackgroundColor(QColor(255, 0, 0)); - } - } - else if (lineNumber == -1) - { - std::cout << "Զֹɼ" << std::endl; - m_RecordState += 1; - - ui.action_start_recording->setText(QString::fromLocal8Bit("ɼ")); - ui.mainToolBar->widgetForAction(ui.action_start_recording)->setStyleSheet("QWidget{background-color:rgb(0,255,0);}"); - - //yƶһɼߵλ - double ymotorPositionOfLine1Tmp = m_pathPlan->getRecordLineTableWidget()->item(0, 0)->text().toDouble(); - long ymotorPositionOfLine1 = ui.ymotor_location_slider->getPositionPulse(ymotorPositionOfLine1Tmp); - m_yMotor->SettingSpeed(m_lManualSpeedOfYMotor); - m_yMotor->MoveToLocation(ymotorPositionOfLine1); - m_timerYmotorLocationFeedBackAfterRecord->start(500); - - fclose(m_hTimesFile); - } - else if (lineNumber == -2) - { - std::cout << "ֶֹɼ" << std::endl; - - //ֹͣy˶ - m_yMotor->StopMotormove(); - - fclose(m_hTimesFile); - } -} - void HPPA::onCreateTab(int trackNumber) { if (trackNumber >= 0) @@ -1029,275 +778,6 @@ void HPPA::onLeftMouseButtonPressed(int x, int y) void HPPA::timerEvent(QTimerEvent *event) { - try - { - if (m_xMotor == nullptr || m_yMotor == nullptr) - { - //qDebug() << "Motor pointer is null!!!!!"; - - xmotor_state_label1->setStyleSheet("QLabel{background-color:rgb(255,0,0);}"); - SetXMotorWidgetEnable(false); - - ymotor_state_label1->setStyleSheet("QLabel{background-color:rgb(255,0,0);}"); - SetYMotorWidgetEnable(false); - - return; - } - - if (!m_xMotor->IsMotorInit) - { - //return; - - } - ByteBack xMotorState = m_xMotor->GetState();//ִ - - //std::cout << "------------------------------------------xٶȣ" << xMotorState.Speed << std::endl; - - if (xMotorState.Speed == -1000000) - { - xmotor_state_label1->setStyleSheet("QLabel{background-color:rgb(255,0,0);}"); - SetXMotorWidgetEnable(false); - //std::cout << "xMotor: false" << std::endl; - } - else - { - m_xConnectCount++; - if (m_xConnectCount == 1)//һõ - { - m_xMotor->SendCommandtoMotor("cfg crn=3\n"); - } - - xmotor_state_label1->setStyleSheet("QLabel{background-color:rgb(0,255,0);}"); - SetXMotorWidgetEnable(true); - //std::cout << "xMotor: ok" << std::endl; - } - - - ByteBack yMotorState = m_yMotor->GetState(); - - //std::cout << "------------------------------------------ٶȣ" << x.Speed << std::endl; - - if (yMotorState.Speed == -1000000) - { - ymotor_state_label1->setStyleSheet("QLabel{background-color:rgb(255,0,0);}"); - SetYMotorWidgetEnable(false); - //std::cout << "yMotor: false" << std::endl; - } - else - { - m_yConnectCount++; - if (m_yConnectCount == 1)//һõ - { - m_yMotor->SendCommandtoMotor("cfg crn=2\n"); - } - - ymotor_state_label1->setStyleSheet("QLabel{background-color:rgb(0,255,0);}"); - SetYMotorWidgetEnable(true); - //std::cout << "yMotor: ok" << std::endl; - } - - - } - catch (...) - { - - } -} - -void HPPA::onxMotorLeft() -{ - m_timerLocationFeedBackOfMotor_x_y->start(500); - if (isMotorConnected(m_xMotor)) - { - return; - } - - m_xMotor->EnableMotro(); - m_xMotor->SettingSpeed(m_lManualSpeedOfXMotor); - //m_xMotor->SettingSpeed(ui.xmotor_speed_lineEdit->text().toLong()); - m_xMotor->MoveMotar(false); -} - -void HPPA::onxMotorRight() -{ - m_timerLocationFeedBackOfMotor_x_y->start(500); - if (isMotorConnected(m_xMotor)) - { - return; - } - - m_xMotor->EnableMotro(); - m_xMotor->SettingSpeed(m_lManualSpeedOfXMotor); - //m_xMotor->SettingSpeed(ui.xmotor_speed_lineEdit->text().toLong()); - m_xMotor->MoveMotar(true); -} - -void HPPA::onxMotorStop() -{ - if (isMotorConnected(m_xMotor)) - { - return; - } - - m_timerLocationFeedBackOfMotor_x_y->stop(); - m_xMotor->StopMotormove(); -} - -void HPPA::onyMotorForward() -{ - operateWidget = QObject::sender()->objectName(); - - m_timerLocationFeedBackOfMotor_x_y->start(500); - if (isMotorConnected(m_yMotor)) - { - return; - } - - m_yMotor->EnableMotro(); - m_yMotor->SettingSpeed(m_lManualSpeedOfYMotor); - //m_yMotor->SettingSpeed(ui.xmotor_speed_lineEdit->text().toLong()); - m_yMotor->MoveMotar(true); -} - -void HPPA::onyMotorBackward() -{ - operateWidget = QObject::sender()->objectName(); - - m_timerLocationFeedBackOfMotor_x_y->start(500); - if (isMotorConnected(m_yMotor)) - { - return; - } - - m_yMotor->EnableMotro(); - m_yMotor->SettingSpeed(m_lManualSpeedOfYMotor); - //m_yMotor->SettingSpeed(ui.xmotor_speed_lineEdit->text().toLong()); - m_yMotor->MoveMotar(false); -} - -void HPPA::onyMotorStop() -{ - if (isMotorConnected(m_yMotor)) - { - return; - } - - m_timerLocationFeedBackOfMotor_x_y->stop(); - m_yMotor->StopMotormove(); -} - -void HPPA::onMotorReset() -{ - setMotorRange(); - - if (isMotorConnected(m_xMotor)) - { - return; - } - if (isMotorConnected(m_yMotor)) - { - return; - } - - m_xMotor->SettingZeroLocation(); - m_yMotor->SettingZeroLocation(); - - -} - -void HPPA::OnXmotorSpeedEditingFinished() -{ - if (isMotorConnected(m_xMotor)) - { - return; - } - - m_xMotor->SettingSpeed(ui.xmotor_speed_lineEdit->text().toLong()); -} - - -bool HPPA::isMotorConnected(VinceControl *motor) -{ - ByteBack x = motor->GetState(); - - //std::cout << "------------------------------------------ٶȣ" << x.Speed << std::endl; - - if (x.Speed == -1000000) - { - return true; - } - else - { - return false; - } -} - -void HPPA::SetXMotorWidgetEnable(bool enable) -{ - ui.test_range_btn->setEnabled(enable); - ui.motor_reset_btn->setEnabled(enable); - - ui.xmotor_left_btn->setEnabled(enable); - ui.xmotor_right_btn->setEnabled(enable); - ui.xmotor_speed_lineEdit->setEnabled(enable); - ui.xmotor_speed_slider->setEnabled(enable); - ui.xmotor_location_lineEdit->setEnabled(enable); - ui.xmotor_location_slider->setEnabled(enable); -} - -void HPPA::SetYMotorWidgetEnable(bool enable) -{ - ui.test_range_btn->setEnabled(enable); - ui.motor_reset_btn->setEnabled(enable); - - ui.ymotor_forward_btn->setEnabled(enable); - ui.ymotor_backward_btn->setEnabled(enable); - ui.ymotor_location_lineEdit->setEnabled(enable); - ui.ymotor_location_slider->setEnabled(enable); -} - -void HPPA::setMotorRange() -{ - try - { - //x̼¼ļԱʹ ÿζ̣˷ʱ - float xMotorRange; - float yMotorRange; - - float lead;// - float stepAnglemar;// - float scaleFactor;//еװõԭ - int subdivisionMultiples;//ϸ - - mConfigfile.getXMotorParm(stepAnglemar, lead, subdivisionMultiples, scaleFactor, xMotorRange); - mConfigfile.getYMotorParm(stepAnglemar, lead, subdivisionMultiples, scaleFactor, yMotorRange); - - - //std::cout << "xMotorRange" << xMotorRange << std::endl; - //std::cout << "yMotorRange" << yMotorRange << std::endl; - - - //xﷶΧ - ui.xmotor_location_slider->setMaximum(xMotorRange); - ui.xmotor_max_location_label->setText(QString::number(ui.xmotor_location_slider->maximum())); - //yﷶΧ - ui.ymotor_location_slider->setMaximum(yMotorRange); - ui.ymotor_max_location_label->setText(QString::number(ui.ymotor_location_slider->maximum())); - - - QRectF rect = ui.graphicsView->viewport()->rect(); - widthScale = rect.width() / xMotorRange;//sceneRectĿϵx - heightScale = rect.height() / yMotorRange;//sceneRectĸ߶ϵy - - - ui.graphicsView->setSceneRect(); - } - catch (...) - { - QMessageBox msgBox; - msgBox.setText(QString::fromLocal8Bit("̲")); - msgBox.exec(); - } } void HPPA::setImagerSimulationPos(double x, double y) @@ -1307,435 +787,8 @@ void HPPA::setImagerSimulationPos(double x, double y) ui.graphicsView->imager->setPos(x, y); } -void HPPA::ontimerLocationFeedBackOfMotor_x_y() -{ - //std::cout << "------------------------------------------" << std::endl; - if (isMotorConnected(m_xMotor)) - { - return; - } - - ByteBack xMotorState = m_xMotor->GetState(); - - //1ֶ/ɼx˶ʱ/ңԶĵλslider - if (xMotorState.Speed != 0) - { - double newPos = ui.xmotor_location_slider->getDistanceFromPulse(xMotorState.Location); - - ui.xmotor_location_slider->setValue(newPos, false); - setImagerSimulationPos(newPos, ui.ymotor_location_slider->value()); - - - QApplication::processEvents(); - } - - - - if (isMotorConnected(m_yMotor)) - { - return; - } - - ByteBack yMotorState = m_yMotor->GetState(); - - //2ֶy˶ʱǰ/󣩣Զĵλslider - if (yMotorState.Speed != 0) - { - double newPos = ui.ymotor_location_slider->getDistanceFromPulse(yMotorState.Location); - - ui.ymotor_location_slider->setValue(newPos, false); - setImagerSimulationPos(ui.xmotor_location_slider->value(), newPos); - - QApplication::processEvents(); - } - -} - -void HPPA::ontimerYmotorLocationFeedBackAfterRecord() -{ - if (isMotorConnected(m_yMotor)) - { - return; - } - - ByteBack yMotorState = m_yMotor->GetState(); - - //λ÷slider - if (yMotorState.Speed != 0) - { - double newPos = ui.ymotor_location_slider->getDistanceFromPulse(yMotorState.Location); - - ui.ymotor_location_slider->setValue(newPos, false); - setImagerSimulationPos(ui.xmotor_location_slider->value(), newPos); - - QApplication::processEvents(); - } - else//ô˺ܾȷķزɼǰλãҪͨɼǰ¼ľȷλ - { - m_timerYmotorLocationFeedBackAfterRecord->stop(); - - double ymotorPositionOfLine1Tmp = m_pathPlan->getRecordLineTableWidget()->item(0, 0)->text().toDouble();//ymotorPositionOfLine1 - - ui.ymotor_location_slider->setValue(ymotorPositionOfLine1Tmp, false); - setImagerSimulationPos(ui.xmotor_location_slider->value(), ymotorPositionOfLine1Tmp); - } -} - -void HPPA::OnXmotorSpeedLineeditEditingFinished() -{ - ui.xmotor_speed_slider->setValue(ui.xmotor_speed_lineEdit->text().toDouble()); -} - -void HPPA::OnXmotorSpeedSliderChanged(double speed) -{ - ui.xmotor_speed_lineEdit->setText(QString::number(speed)); -} - -void HPPA::OnXmotorLocationLineeditEditingFinished() -{ - if (isMotorConnected(m_xMotor)) - { - return; - } - - ui.xmotor_location_slider->setValue(ui.xmotor_location_lineEdit->text().toDouble()); - - setImagerSimulationPos(ui.xmotor_location_slider->value(), ui.ymotor_location_slider->value()); - - m_xMotor->MoveToLocation(ui.xmotor_location_slider->OriginalValue()); -} - -void HPPA::OnXmotorLocationSliderChanged(double location) -{ - ui.xmotor_location_lineEdit->setText(QString::number(location)); -} - -void HPPA::OnXmotorLocationSliderReleased() -{ - if (isMotorConnected(m_xMotor)) - { - return; - } - - m_xMotor->SettingSpeed(m_lManualSpeedOfXMotor); - m_xMotor->MoveToLocation(ui.xmotor_location_slider->OriginalValue()); - - setImagerSimulationPos(ui.xmotor_location_slider->value(), ui.ymotor_location_slider->value()); -} - -void HPPA::OnYmotorLocationLineeditEditingFinished() -{ - if (isMotorConnected(m_yMotor)) - { - return; - } - - ui.ymotor_location_slider->setValue(ui.ymotor_location_lineEdit->text().toDouble()); - - setImagerSimulationPos(ui.xmotor_location_slider->value(), ui.ymotor_location_slider->value()); - - m_yMotor->MoveToLocation(ui.ymotor_location_slider->OriginalValue()); -} - -void HPPA::OnYmotorLocationSliderChanged(double location) -{ - ui.ymotor_location_lineEdit->setText(QString::number(location)); -} - -void HPPA::OnYmotorLocationSliderReleased() -{ - if (isMotorConnected(m_yMotor)) - { - return; - } - - m_yMotor->SettingSpeed(m_lManualSpeedOfYMotor); - m_yMotor->MoveToLocation(ui.ymotor_location_slider->OriginalValue()); - - setImagerSimulationPos(ui.xmotor_location_slider->value(), ui.ymotor_location_slider->value()); -} - -void HPPA::ontestRangeOfMotor_x_y() -{ - //x - if (isMotorConnected(m_xMotor)) - { - return; - } - - m_xMotor->SettingZeroLocation();//ƶ0λõĽӽأλΪ0 - m_timerTestRangeOfxMotor->start(500); - - //y - if (isMotorConnected(m_yMotor)) - { - return; - } - - m_yMotor->SettingZeroLocation(); - m_timerTestRangeOfyMotor->start(500); -} - -void HPPA::ontimerTestRangeOfxMotor() -{ - if (isMotorConnected(m_xMotor)) - { - qDebug() << "x TestRangeOfxMotor: x motor is bad+++++++++++++++++++++++++++++++++++++++++++"; - return; - } - //qDebug() << "x TestRangeOfxMoto: start+++++++++++++++++++++++++++++++++++++++++++"; - - ByteBack MotorState = m_xMotor->GetState(); - //std::cout << "xٶȣ" << MotorState.Speed << std::endl; - - - if (MotorState.Speed == 0 && MotorState.Location == 0)//λΪ0ĵط - { - qDebug() << "x TestRangeOfxMotor: speed is 0reach to original point+++++++++++++++++++++++++++++++++++++++++++"; - - m_xMotor->EnableMotro(); - m_xMotor->SettingSpeed(m_lManualSpeedOfXMotor); - m_xMotor->MoveMotar(true);//ƶ - } - - if (MotorState.Speed == 0 && MotorState.Location != 0)//λĵط - { - qDebug() << "x TestRangeOfxMotor: speed is 0, reach to most far point, completed+++++++++++++++++++++++++++++++++++++++++++"; - - double maxDistance = ui.xmotor_location_slider->getDistanceFromPulse(MotorState.Location); - - m_xMotor->MoveToLocation(0); - m_timerTestRangeOfxMotor->stop(); - - mConfigfile.setMaxRange(maxDistance, "x"); - - ui.xmotor_location_slider->setMaximum(maxDistance); - ui.xmotor_max_location_label->setText(QString::number(ui.xmotor_location_slider->maximum())); - - //sceneRectĿϵx - QRectF rect = ui.graphicsView->viewport()->rect(); - widthScale = rect.width() / maxDistance; - ui.graphicsView->setSceneRect(); - } -} - -void HPPA::ontimerTestRangeOfyMotor() -{ - if (isMotorConnected(m_yMotor)) - { - qDebug() << "y TestRangeOfxMotor: y motor is bad+++++++++++++++++++++++++++++++++++++++++++"; - return; - } - - ByteBack MotorState = m_yMotor->GetState(); - int a = 1; - //qDebug() << "y TestRangeOfyMoto: start"; - - if (MotorState.Speed == 0 && MotorState.Location == 0)//λΪ0ĵط - { - qDebug() << "y TestRangeOfyMotor: speed is 0reach to original point+++++++++++++++++++++++++++++++++++++++++++"; - - m_yMotor->EnableMotro(); - m_yMotor->SettingSpeed(m_lManualSpeedOfYMotor); - m_yMotor->MoveMotar(true);//ǰƶ - } - - if (MotorState.Speed == 0 && MotorState.Location != 0)//λĵط - { - qDebug() << "y TestRangeOfyMotor: speed is 0, reach to most far point, completed+++++++++++++++++++++++++++++++++++++++++++"; - - double maxDistance = ui.ymotor_location_slider->getDistanceFromPulse(MotorState.Location); - - m_yMotor->MoveToLocation(0); - m_timerTestRangeOfyMotor->stop(); - - //y̼¼ļԱʹ ÿζ̣˷ʱ - mConfigfile.setMaxRange(maxDistance, "y"); - - ui.ymotor_location_slider->setMaximum(maxDistance); - ui.ymotor_max_location_label->setText(QString::number(ui.ymotor_location_slider->maximum())); - - //sceneRectĸ߶ϵy - QRectF rect = ui.graphicsView->viewport()->rect(); - heightScale = rect.height() / maxDistance; - ui.graphicsView->setSceneRect(); - } -} - -void HPPA::ontimerMoveXmotor() -{ - //std::cout << "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" << std::endl; - if (isMotorConnected(m_xMotor)) - { - return; - } - - ByteBack MotorState = m_xMotor->GetState(); - //ȡϵͳʱxλã - long long timeOs = getNanosecondsSinceMidnight(); - BroadcastXMotorPosSignal(timeOs, MotorState.Location); - fprintf(m_hTimesFile, "%lld,%d\n", timeOs, MotorState.Location); - - //xλ÷slider - if (MotorState.Speed != 0) - { - double newPos = ui.xmotor_location_slider->getDistanceFromPulse(MotorState.Location); - - ui.xmotor_location_slider->setValue(newPos, false); - setImagerSimulationPos(newPos, ui.ymotor_location_slider->value()); - - QApplication::processEvents(); - } - - //ɼxﷵسʼλãʼɼǰ¼λãm_lXmotorLocationOfStartRecord - if (MotorState.Speed == 0 && MotorState.Location != m_lXmotorLocationOfStartRecord)//xλôֵӽأ֡ûвɼ - { - //ֹͣɼ - m_Imager->setRecordControlState(false); - - //xﷵزɼǰλ - m_xMotor->SettingSpeed(m_lManualSpeedOfXMotor); - m_xMotor->MoveToLocation(m_lXmotorLocationOfStartRecord); - - //qDebug() << "xλûԭxλôֵӽأ֡ûвɼֹ꣬ͣɼ"; - qDebug() << "11111111111111111111111111111111111111111111111111"; - } - if (!m_Imager->getRecordControlState())//ֹͣɼҪϻصʼλã1ֹͣɼ2֡ɼˣﻹ˶ - { - //xﷵزɼǰλ - m_xMotor->SettingSpeed(m_lManualSpeedOfXMotor); - m_xMotor->MoveToLocation(m_lXmotorLocationOfStartRecord); - - //qDebug() << "xλûԭ1ֹͣɼ2֡ɼˣﻹ˶"; - qDebug() << "222222222222222222222222222222222222222222222222222222"; - } - - - - //һɼߵIJɼ - if (MotorState.Speed == 0 && MotorState.Location == m_lXmotorLocationOfStartRecord//xﷵسʼλ - || MotorState.Location - m_lXmotorLocationOfStartRecord < 300)//ɼǰλΪ0ʱҪ - { - //ֹͣ - m_timerMoveXmotor->stop(); - - //ɼɵΪɫ - for (size_t j = 0; j < m_pathPlan->getRecordLineTableWidget()->columnCount(); j++) - { - m_pathPlan->getRecordLineTableWidget()->item(m_numberOfRecording, j)->setBackgroundColor(QColor(0, 255, 0)); - } - - //׼ȷxsliderλ - double pos = ui.xmotor_location_slider->getDistanceFromPulse(m_lXmotorLocationOfStartRecord); - ui.xmotor_location_slider->setValue(pos, false); - setImagerSimulationPos(pos, ui.ymotor_location_slider->value()); - - //ִһ - m_ForLoopControl->m_boolRecordNextLine = true; - } - - //std::cout << "ʼλΪ" << m_lXmotorLocationOfStartRecord << std::endl; - //std::cout << "Ϊ" << MotorState.Location - m_lXmotorLocationOfStartRecord << std::endl; -} - -void HPPA::ontimerMoveYmotor() -{ - //std::cout << "yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy" << std::endl; - if (isMotorConnected(m_yMotor)) - { - return; - } - - ByteBack MotorState = m_yMotor->GetState(); - - //yλ÷slider - if (MotorState.Speed != 0) - { - double newPos = ui.ymotor_location_slider->getDistanceFromPulse(MotorState.Location); - //std::cout << "yλã" << newPos << std::endl; - - ui.ymotor_location_slider->setValue(newPos, false); - setImagerSimulationPos(ui.xmotor_location_slider->value(), newPos); - - QApplication::processEvents(); - } - else if (MotorState.Speed == 0) - { - //ֹͣñ - m_timerMoveYmotor->stop(); - - //׼ȷysliderλ - double pos = m_pathPlan->getRecordLineTableWidget()->item(m_numberOfRecording, 0)->text().toDouble(); - ui.ymotor_location_slider->setValue(pos, false); - setImagerSimulationPos(ui.xmotor_location_slider->value(), pos); - - //ʼɼ󣬵yǰһɼߵ;Уֹͣɼ - if (m_RecordState % 2 == 0) - { - // - for (size_t j = 0; j < m_pathPlan->getRecordLineTableWidget()->columnCount(); j++) - { - m_pathPlan->getRecordLineTableWidget()->item(m_numberOfRecording, j)->setBackgroundColor(QColor(240, 240, 240)); - } - - return; - } - - //ƶx - if (isMotorConnected(m_xMotor)) - { - return; - } - m_xMotor->EnableMotro(); - m_lXmotorLocationOfStartRecord = m_xMotor->GetLocationNow();//¼ǰλ - m_xMotor->SettingSpeed(ui.xmotor_speed_slider->OriginalValue());//ʼɼʱùٶ ŵ㣺˲ɼʱٶȺٶ - - - double xMaxPositionTmp = m_pathPlan->getRecordLineTableWidget()->item(m_numberOfRecording, 1)->text().toDouble(); - long xMaxPosition = ui.xmotor_location_slider->getPositionPulse(xMaxPositionTmp); - m_xMotor->MoveToLocation(xMaxPosition); - m_timerMoveXmotor->start(500); - - - //ʼɼӰ - m_Imager->setFrameNumber(this->frame_number->text().toInt()); - - emit StartRecordSignal();//俪ʼɼź - } -} - void HPPA::onimagerSimulatorMove(int x, int y) { - if (isMotorConnected(m_xMotor)) - { - return; - } - - //std::cout << "xϵ+++++++++++++++++++++++++++++++++++++++++++" << std::endl; - - double xLocatioin = abs(x) / widthScale;//λΪcmʵ - ui.xmotor_location_slider->setValue(xLocatioin, false); - - double xx = ui.xmotor_location_slider->OriginalValue();//λΪʵ - m_xMotor->MoveToLocation(xx); - - - if (isMotorConnected(m_yMotor)) - { - return; - } - - //std::cout << "yϵ+++++++++++++++++++++++++++++++++++++++++++" << std::endl; - - double yLocatioin = abs(y) / heightScale;//λΪcmʵ - ui.ymotor_location_slider->setValue(yLocatioin, false); - - double yy = ui.ymotor_location_slider->OriginalValue();//λΪʵ - - //std::cout << "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" << std::endl; - m_yMotor->MoveToLocation(yy); - //std::cout << "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb" << std::endl; - } void HPPA::OnSendLogToCallClass(QString str) @@ -1784,122 +837,6 @@ void HPPA::getRequest(QString str) QNetworkReply* reply = naManager->get(request); } -void HPPA::newMotor() -{ - QAction* checked = moveplatformActionGroup->checkedAction(); - QString checkedName = checked->objectName(); - if (checkedName != "mAction_2AxisMotor") - { - return; - } - - if (m_xMotor != nullptr && m_yMotor != nullptr) - { - return; - } - - // - m_xMotor = new VinceControl(NETTCP, 6002);// - m_yMotor = new VinceControl(NETTCP, 6001);//ԭ6001ԣ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*))); - connect(m_yMotor, SIGNAL(newTCPConnection(VinceControl*)), this, SLOT(setMotorParamMicroscope(VinceControl*))); - } - - connect(m_xMotor, SIGNAL(newTCPConnection(VinceControl*)), this, SLOT(setXMotorParamFromCfgFile(VinceControl*))); - connect(m_yMotor, SIGNAL(newTCPConnection(VinceControl*)), this, SLOT(setYMotorParamFromCfgFile(VinceControl*))); - - m_xConnectCount = 0; - m_yConnectCount = 0; - - - //connect(m_xMotor, SIGNAL(SendLogToCallClass(QString)), this, SLOT(OnSendLogToCallClass(QString))); - //connect(m_yMotor, SIGNAL(SendLogToCallClass(QString)), this, SLOT(OnSendLogToCallClass(QString))); -} - -void HPPA::setMotorParamMicroscope(VinceControl* motor) -{ - //΢nir - QString commonstr; - QByteArray buf; - - commonstr = "cfg msr=2\n"; - motor->SendCommandtoMotor(commonstr, "non"); - motor->GetCommonRetrun(buf); - commonstr = "cfg msv=1\n"; - motor->SendCommandtoMotor(commonstr, "non"); - motor->GetCommonRetrun(buf); - - commonstr = "cfg psr=1\n"; - motor->SendCommandtoMotor(commonstr, "non"); - motor->GetCommonRetrun(buf); - commonstr = "cfg psv=1\n"; - motor->SendCommandtoMotor(commonstr, "non"); - motor->GetCommonRetrun(buf); - - commonstr = "cfg zsd=-3000\n";//ùٶȺͷ - motor->SendCommandtoMotor(commonstr, "non"); - motor->GetCommonRetrun(buf); - - commonstr = "cfg snr=1\n";//ù㴫 - motor->SendCommandtoMotor(commonstr, "non"); - motor->GetCommonRetrun(buf); -} - -void HPPA::setXMotorParamFromCfgFile(VinceControl* motor) -{ - float lead; - float stepAnglemar; - float scaleFactor; - int subdivisionMultiples; - float maxRange; - mConfigfile.getXMotorParm(stepAnglemar, lead, subdivisionMultiples, scaleFactor, maxRange); - - QString commonstr; - QByteArray buf; - - commonstr = "cfg mcs=" + QString::number(subdivisionMultiples) + "\n"; - std::string tmp = commonstr.toStdString(); - motor->SendCommandtoMotor(commonstr, "non"); - motor->GetCommonRetrun(buf); -} - -void HPPA::setYMotorParamFromCfgFile(VinceControl* motor) -{ - float lead; - float stepAnglemar; - float scaleFactor; - int subdivisionMultiples; - float maxRange; - mConfigfile.getYMotorParm(stepAnglemar, lead, subdivisionMultiples, scaleFactor, maxRange); - - QString commonstr; - QByteArray buf; - - commonstr = "cfg mcs=" + QString::number(subdivisionMultiples) + "\n"; - motor->SendCommandtoMotor(commonstr, "non"); - motor->GetCommonRetrun(buf); -} - -void HPPA::deleteMotor() -{ - disconnect(m_xMotor, SIGNAL(SendLogToCallClass(QString)), this, SLOT(OnSendLogToCallClass(QString))); - disconnect(m_yMotor, SIGNAL(SendLogToCallClass(QString)), this, SLOT(OnSendLogToCallClass(QString))); - - delete m_xMotor; - delete m_yMotor; - - m_xMotor = nullptr; - m_yMotor = nullptr; - - xmotor_state_label1->setStyleSheet("QLabel{background-color:rgb(255,0,0);}"); - ymotor_state_label1->setStyleSheet("QLabel{background-color:rgb(255,0,0);}"); -} - void HPPA::requestFinished(QNetworkReply* reply) { // ȡhttp״̬ QVariant statusCode = reply->attribute(QNetworkRequest::HttpStatusCodeAttribute); @@ -1976,9 +913,6 @@ void HPPA::onconnect() connect(m_Imager, SIGNAL(SpectralSignal(int)), this, SLOT(PlotSpectral(int))); //connect(m_Imager, SIGNAL(testImagerStatus()), this, SLOT(testImagerStatus())); - newMotor();//ݲͬͣΪƽ̨òͬIJ󴴽 - - //ļ m_CopyFileThread = new QThread(); m_FileOperation = new FileOperation(); @@ -1999,7 +933,6 @@ void HPPA::onconnect() connect(this->ui.action_reference, SIGNAL(triggered()), this, SLOT(onReference())); connect(this->ui.action_start_recording, SIGNAL(triggered()), this, SLOT(onStartRecordStep1())); - connect(this, SIGNAL(StartLoopSignal()), m_ForLoopControl, SLOT(startLoop())); connect(this, SIGNAL(StartRecordSignal()), m_Imager, SLOT(start_record())); connect(this, SIGNAL(RecordWhiteSignal()), m_Imager, SLOT(record_white())); connect(this, SIGNAL(RecordDarlSignal()), m_Imager, SLOT(record_dark())); @@ -2133,39 +1066,28 @@ void HPPA::onDark() msgBox.setText(QString::fromLocal8Bit("ɼȷͷǸϣ")); msgBox.exec(); - bool isMotorEnable = this->ui.mAction_2AxisMotor->isChecked(); - if (isMotorEnable) + QAction* checked = moveplatformActionGroup->checkedAction(); + QString checkedName = checked->objectName(); + if (checkedName == "mAction_is_no_motor" || checkedName == "mAction_RobotArm") { - //ƶx - 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(); + } + else if (checkedName == "mAction_1AxisMotor") + { + omc->setImager(m_Imager); + omc->record_dark(); + } + else if (checkedName == "mAction_2AxisMotor_new") + { + tmc->setImager(m_Imager); + tmc->record_dark(); + return; } - - 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) - { - //ƶx - if (!isMotorConnected(m_xMotor)) - { - //xﷵزɼǰλ - m_xMotor->SettingSpeed(m_lManualSpeedOfXMotor); - m_xMotor->MoveToLocation(m_lXmotorLocationOfStartRecord); - } - } } void HPPA::onReference() @@ -2174,39 +1096,28 @@ void HPPA::onReference() msgBox.setText(QString::fromLocal8Bit("ȷװȷ")); msgBox.exec(); - bool isMotorEnable = this->ui.mAction_2AxisMotor->isChecked(); - if (isMotorEnable) + QAction* checked = moveplatformActionGroup->checkedAction(); + QString checkedName = checked->objectName(); + if (checkedName == "mAction_is_no_motor" || checkedName == "mAction_RobotArm") { - //ƶx - 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 RecordWhiteSignal(); + } + else if (checkedName == "mAction_1AxisMotor") + { + omc->setImager(m_Imager); + omc->record_white(); + } + else if (checkedName == "mAction_2AxisMotor_new") + { + tmc->setImager(m_Imager); + tmc->record_white(); + return; } - - emit RecordWhiteSignal(); } void HPPA::recordWhiteFinish() { ui.mainToolBar->widgetForAction(ui.action_reference)->setStyleSheet("QWidget{background-color:rgb(0,255,0);}"); - - bool isMotorEnable = this->ui.mAction_2AxisMotor->isChecked(); - if (isMotorEnable) - { - //ƶx - if (!isMotorConnected(m_xMotor)) - { - //xﷵزɼǰλ - m_xMotor->SettingSpeed(m_lManualSpeedOfXMotor); - m_xMotor->MoveToLocation(m_lXmotorLocationOfStartRecord); - } - } } void HPPA::onPlotHyperspectralImageRgbImage(int fileNumber, int frameNumber) @@ -2337,10 +1248,6 @@ void HPPA::onRecordFinishedSignal_WhenFrameNumberMeet() { QAction* checked = moveplatformActionGroup->checkedAction(); QString checkedName = checked->objectName(); - if (checkedName == "mAction_2AxisMotor")//жɼߣмijɼɺ󲻴ɼ - { - return; - } std::cout << "ֹͣɼԭ֡ɼˡ" << std::endl; @@ -2359,11 +1266,6 @@ void HPPA::onRecordFinishedSignal_WhenFrameNumberNotMeet() { return; } - - if (checkedName == "mAction_2AxisMotor")//жɼߣмijɼɺ󲻴ɼ - { - return; - } if (checkedName == "mAction_2AxisMotor_new")//жɼߣмijɼɺ󲻴ɼ { @@ -2386,65 +1288,6 @@ void HPPA::onsequenceComplete() m_RecordState++; } -ForLoopControl::ForLoopControl() -{ - -} - -ForLoopControl::~ForLoopControl() -{ - -} - -void ForLoopControl::setLoopCount(int loopCount) -{ - m_loopCount = loopCount; -} - -int ForLoopControl::getLoopCount() const -{ - return m_loopCount; -} - -void ForLoopControl::startLoop() -{ - //std::cout << "" << m_loopCount << "ѭ" << std::endl; - for (size_t i = 0; i < m_loopCount; i++) - { - //std::cout << "" << i << "ѭ" << std::endl; - - emit recordSignal(i); - - m_boolRecordNextLine = false; - m_boolQuitLoop = false; - while (!m_boolRecordNextLine) - { - Sleep(500); - - if (m_boolQuitLoop) - { - break; - } - } - - if (m_boolQuitLoop) - { - break; - } - } - - if (m_boolQuitLoop == false) - { - emit recordSignal(-1);//ɼкߣԶֹͣ - } - else if (m_boolQuitLoop == true) - { - emit recordSignal(-2);//ֶֹͣɼ - } - - //std::cout << "˳ѭ" << std::endl; -} - WorkerThread3::WorkerThread3(CFocusMotorControl * ctrlFocusMotor) { m_ctrlFocusMotor = ctrlFocusMotor; diff --git a/HPPA/HPPA.h b/HPPA/HPPA.h index fed2af2..9668898 100644 --- a/HPPA/HPPA.h +++ b/HPPA/HPPA.h @@ -32,7 +32,6 @@ #include "aboutWindow.h" #include "adjustTable.h" #include "PowerControl.h" -#include "PathPlan.h" #include "RobotArmControl.h" #include "OneMotorControl.h" #include "TwoMotorControl.h" @@ -124,36 +123,6 @@ signals: void threadSignal(QString s); }; - -class ForLoopControl :public QObject -{ - Q_OBJECT - -public: - ForLoopControl(); - ~ForLoopControl(); - - void setLoopCount(int loopCount); - int getLoopCount() const; - - bool m_boolRecordNextLine; - bool m_boolQuitLoop; - -protected: -private: - int m_loopCount; - - -public slots: - void startLoop(); - -signals: - //Ӱźţ - //źŷֵʱintֵòɼڼɼˣ - //źŷ为ֵʱ-1ɼɣֶֹɼ-2ֶֹɼ - void recordSignal(int); -}; - class HPPA : public QMainWindow { Q_OBJECT @@ -181,12 +150,10 @@ private: Configfile mConfigfile; - ForLoopControl * m_ForLoopControl; ImagerOperationBase* m_Imager;// int m_RecordState;//ɼ̣ȡ21 ڲɼ0 ֹͣɼ - QThread * m_ForLoopControlThread;// QThread * m_RecordThread;//Ӱɼ߳ QThread * m_RgbCameraThread;//rgbȡͼ߳ QThread * m_CopyFileThread;//Ӱļ߳ @@ -197,34 +164,8 @@ private: //QLineSeries *series; //QChart *chart; - // - VinceControl *m_yMotor; - VinceControl *m_xMotor; - - long m_lXmotorLocationOfStartRecord;//ʼɼǰxλ - long m_lYmotorLocationOfStartRecord;//ʼɼǰyλ - - unsigned long m_lManualSpeedOfXMotor;//X˶ٶȣͨʾֶ+X̲ʹٶȣ12000*0.00052734375=6.328125cm/s - unsigned long m_lManualSpeedOfYMotor;//YXΪͬĻYлеװãʵYٶ=Xٶ/5 - - int m_xConnectCount;//ʾ״̬0Ͽ1Ͽһӡ1ʾӣΪ״̬Ϊ1ʱĵ - int m_yConnectCount; - - QTimer *m_timerMoveXmotor; - QTimer *m_timerMoveYmotor; - - QTimer *m_timerTestRangeOfxMotor;//ڲx - QTimer *m_timerTestRangeOfyMotor;//ڲy - QTimer *m_timerLocationFeedBackOfMotor_x_y;//ֶƣx/y˶ʱλԶķslider - QTimer *m_timerYmotorLocationFeedBackAfterRecord;//ɼӰɺ󣬽λʵʱصslider - QString operateWidget;//ǰĿؼ - bool isMotorConnected(VinceControl *motor);//жǷϿϿtrue򷵻false - void SetXMotorWidgetEnable(bool enable); - void SetYMotorWidgetEnable(bool enable); - void setMotorRange();//̷Χ - //ģλ double widthScale;//QGraphicsViewviewportʵwidthScale = rect.width() / maxDistance; double heightScale;//QGraphicsViewviewportߺʵheightScale = rect.height() / maxDistance; @@ -253,9 +194,6 @@ private: TwoMotorControl* tmc; QDockWidget* dock_tmc; - - PathPlan* m_pathPlan; - FILE* m_hTimesFile; public Q_SLOTS: @@ -277,7 +215,6 @@ public Q_SLOTS: void onReference(); void recordWhiteFinish(); void onStartRecordStep1(); - void onStartRecordStep2(int lineNumber); void onCreateTab(int trackNumber); void onTabWidgetCurrentChanged(int index); void onActionOpenDirectory(); @@ -293,50 +230,7 @@ public Q_SLOTS: void onLeftMouseButtonPressed(int x, int y);//ӰԪʾ - // - void deleteMotor(); - void newMotor(); void timerEvent(QTimerEvent *event); - void setMotorParamMicroscope(VinceControl* motor); - void setXMotorParamFromCfgFile(VinceControl* motor); - void setYMotorParamFromCfgFile(VinceControl* motor); - - - void onxMotorLeft(); - void onxMotorRight(); - void onxMotorStop(); - - void onyMotorForward(); - void onyMotorBackward(); - void onyMotorStop(); - - void onMotorReset(); - - void OnXmotorSpeedEditingFinished(); - - void ontimerLocationFeedBackOfMotor_x_y(); - void ontimerYmotorLocationFeedBackAfterRecord(); - - void OnXmotorSpeedLineeditEditingFinished(); - void OnXmotorSpeedSliderChanged(double speed); - void OnXmotorLocationLineeditEditingFinished(); - void OnXmotorLocationSliderChanged(double location); - void OnXmotorLocationSliderReleased(); - - - void OnYmotorLocationLineeditEditingFinished(); - void OnYmotorLocationSliderChanged(double location); - void OnYmotorLocationSliderReleased(); - - - - void ontestRangeOfMotor_x_y(); - void ontimerTestRangeOfxMotor(); - void ontimerTestRangeOfyMotor(); - - void ontimerMoveXmotor(); - void ontimerMoveYmotor(); - // void onimagerSimulatorMove(int x, int y); void OnSendLogToCallClass(QString str); @@ -354,10 +248,8 @@ public Q_SLOTS: void createOneMotorScenario(); signals: void StartFocusSignal(); - void StartLoopSignal(); void StartRecordSignal(); void CopyFileThreadSignal(QString, QString); - void BroadcastXMotorPosSignal(long long, int); void RecordWhiteSignal(); void RecordDarlSignal(); diff --git a/HPPA/HPPA.ui b/HPPA/HPPA.ui index a1eb60f..23a0843 100644 --- a/HPPA/HPPA.ui +++ b/HPPA/HPPA.ui @@ -182,7 +182,6 @@ color:white; - @@ -726,768 +725,6 @@ QDockWidget::title { - - - /* 标题设置 */ -QDockWidget::title { - text-align: left; - background-color: rgb(240, 240, 240); - /*padding-left: 35px;*/ -} - - - false - - - Qt::AllDockWidgetAreas - - - 线性平台 - - - 2 - - - - - 9 - - - 9 - - - 9 - - - 9 - - - 6 - - - - - - 0 - 0 - - - - QGroupBox{border:none} - - - - - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - Qt::Horizontal - - - - 84 - 19 - - - - - - - - Qt::Horizontal - - - - 84 - 19 - - - - - - - - - 0 - 0 - - - - ↓0 - - - - - - - Qt::Horizontal - - - - 84 - 19 - - - - - - - - - 0 - 0 - - - - - - - - - - - Qt::Horizontal - - - - 84 - 20 - - - - - - - - - 0 - 0 - - - - 量程检测 - - - - - - - Qt::Horizontal - - - - 66 - 20 - - - - - - - - - 0 - 0 - - - - ←0 - - - - - - - Qt::Horizontal - - - - 84 - 20 - - - - - - - - - 0 - 0 - - - - 归零 - - - - - - - - 0 - 0 - - - - - - - - - - - - - - - 0 - 0 - - - - #QGroupBox{border:none} - - - x马达 - - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - - - - 0 - 0 - - - - - 0 - 20 - - - - - 100 - 20 - - - - 速度 - - - Qt::AlignCenter - - - - - - - - 0 - 0 - - - - - 0 - 0 - - - - - 16777215 - 16777215 - - - - background-color: rgb(255, 255, 255); - - - 1 - - - Qt::AlignCenter - - - - - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 100 - 20 - - - - - - - - - 0 - 0 - - - - Qt::Horizontal - - - - - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 100 - 17 - - - - - - - - 0 - - - Qt::AlignCenter - - - - - - - Qt::Horizontal - - - - 37 - 17 - - - - - - - - - 16777215 - 33 - - - - 3 - - - Qt::AlignCenter - - - - - - - - - - - - 0 - 0 - - - - - 100 - 0 - - - - - 100 - 20 - - - - 位置 - - - Qt::AlignCenter - - - - - - - - 0 - 0 - - - - - 0 - 20 - - - - - 16777215 - 33 - - - - background-color: rgb(255, 255, 255); - - - 0 - - - Qt::AlignCenter - - - - - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 100 - 14 - - - - - - - - - 0 - 0 - - - - Qt::Horizontal - - - QSlider::NoTicks - - - - - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 100 - 17 - - - - - - - - 0 - - - Qt::AlignCenter - - - - - - - Qt::Horizontal - - - - 128 - 17 - - - - - - - - nan - - - Qt::AlignCenter - - - - - - - - - - - - - 0 - 0 - - - - - - - y马达 - - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - - - - 0 - 0 - - - - - 100 - 0 - - - - 位置 - - - Qt::AlignCenter - - - - - - - - 0 - 0 - - - - - 0 - 21 - - - - - 16777215 - 33 - - - - background-color: rgb(255, 255, 255); - - - 0 - - - Qt::AlignCenter - - - - - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 100 - 20 - - - - - - - - - 0 - 0 - - - - Qt::Horizontal - - - QSlider::NoTicks - - - - - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 100 - 20 - - - - - - - - 0 - - - Qt::AlignCenter - - - - - - - Qt::Horizontal - - - - 146 - 20 - - - - - - - - nan - - - Qt::AlignCenter - - - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - - 退出 @@ -1727,7 +964,7 @@ QDockWidget::title { true - 2 轴线性马达_new + 2 轴线性马达 @@ -1738,11 +975,6 @@ QDockWidget::title { QSlider
qdoubleslider.h
- - QMotorDoubleSlider - QSlider -
qmotordoubleslider.h
-
ImagerPositionSimulation QGraphicsView diff --git a/HPPA/HPPA.vcxproj b/HPPA/HPPA.vcxproj index 3e3c9df..279d264 100644 --- a/HPPA/HPPA.vcxproj +++ b/HPPA/HPPA.vcxproj @@ -31,7 +31,7 @@ - 5.9_msvc2017_64 + 5.13.2_msvc2017_64 core;network;gui;widgets;serialport;websockets;charts debug @@ -55,11 +55,11 @@ - 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) + 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;D:\cpp_library\eigen-3.4-rc1;$(IncludePath) 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) - 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) + 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;D:\cpp_library\eigen-3.4-rc1;$(IncludePath) 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) @@ -106,13 +106,13 @@ + - @@ -125,6 +125,7 @@ Create Create + @@ -145,7 +146,10 @@ + + + @@ -159,12 +163,13 @@ - + + diff --git a/HPPA/HPPA.vcxproj.filters b/HPPA/HPPA.vcxproj.filters index 18c1524..ee57894 100644 --- a/HPPA/HPPA.vcxproj.filters +++ b/HPPA/HPPA.vcxproj.filters @@ -27,6 +27,9 @@ {4672856c-86fb-46e3-94ff-0a296dcc6111} + + {f2bfb93e-9ef8-4fdd-a776-db93b81af553} + @@ -109,9 +112,6 @@ Source Files - - Source Files - Source Files @@ -127,6 +127,12 @@ Source Files + + Source Files + + + Source Files + @@ -171,9 +177,6 @@ Header Files - - Header Files - Header Files @@ -183,6 +186,12 @@ Header Files + + Header Files + + + Header Files + @@ -238,6 +247,15 @@ Form Files + + Form Files + + + Form Files + + + Form Files + diff --git a/HPPA/OneMotorControl.cpp b/HPPA/OneMotorControl.cpp index 3687b86..0d249f1 100644 --- a/HPPA/OneMotorControl.cpp +++ b/HPPA/OneMotorControl.cpp @@ -122,6 +122,30 @@ void OneMotorControl::setImager(ImagerOperationBase* imager) m_Imager = imager; } +void OneMotorControl::record_dark() +{ + double s = ui.speed_lineEdit->text().toDouble(); + + if (m_darkCaptureCoordinator == nullptr) + { + m_darkCaptureCoordinator = new DarkAndWhiteCaptureCoordinator(0, m_multiAxisController, m_Imager); + } + + m_darkCaptureCoordinator->startStepMotion(s); +} + +void OneMotorControl::record_white() +{ + double s = ui.speed_lineEdit->text().toDouble(); + + if (m_whiteCaptureCoordinator == nullptr) + { + m_whiteCaptureCoordinator = new DarkAndWhiteCaptureCoordinator(1, m_multiAxisController, m_Imager); + } + + m_whiteCaptureCoordinator->startStepMotion(s); +} + void OneMotorControl::run() { if (m_coordinator == nullptr) diff --git a/HPPA/OneMotorControl.h b/HPPA/OneMotorControl.h index c085875..7f65d9b 100644 --- a/HPPA/OneMotorControl.h +++ b/HPPA/OneMotorControl.h @@ -21,6 +21,9 @@ public: void run(); void stop(); + void record_dark(); + void record_white(); + public Q_SLOTS: void onConnectMotor(); @@ -60,4 +63,7 @@ private: OneMotionCaptureCoordinator* m_coordinator = nullptr; ImagerOperationBase* m_Imager; + + DarkAndWhiteCaptureCoordinator* m_darkCaptureCoordinator = nullptr; + DarkAndWhiteCaptureCoordinator* m_whiteCaptureCoordinator = nullptr; }; diff --git a/HPPA/PathPlan.cpp b/HPPA/PathPlan.cpp deleted file mode 100644 index f61d028..0000000 --- a/HPPA/PathPlan.cpp +++ /dev/null @@ -1,308 +0,0 @@ -#include "PathPlan.h" -#include -#include -#include -#include - -PathPlan::PathPlan(VinceControl* xMotor, VinceControl* yMotor, QMotorDoubleSlider* xSlider, QMotorDoubleSlider* ySlider, QWidget* parent) - : QDialog(parent) -{ - ui.setupUi(this); - - m_xMotor = xMotor; - m_yMotor = yMotor; - - m_xSlider = xSlider; - m_ySlider = ySlider; - - ui.recordLine_tableWidget->setFocusPolicy(Qt::NoFocus); - ui.recordLine_tableWidget->setStyleSheet("selection-background-color:rgb(255,209,128)");//ѡи - - ui.recordLine_tableWidget->setSelectionBehavior(QAbstractItemView::SelectRows);//ѡΪΪλ - //ui.recordLine_tableWidget->setSelectionMode(QAbstractItemView::SingleSelection);//ѡģʽѡ - //QHeaderView* headerView = ui.recordLine_tableWidget->verticalHeader(); - //headerView->setHidden(true);//ȥĬԴк - - - ui.recordLine_tableWidget->setColumnCount(2); - ui.recordLine_tableWidget->setHorizontalHeaderLabels(QStringList() << "yPosition" << "xMaxPosition"); - - connect(ui.addRecordLine_btn, SIGNAL(clicked()), this, SLOT(onAddRecordLine_btn())); - connect(ui.removeRecordLine_btn, SIGNAL(clicked()), this, SLOT(onRemoveRecordLine_btn())); - connect(ui.generateRecordLine_btn, SIGNAL(clicked()), this, SLOT(onGenerateRecordLine_btn())); - connect(ui.deleteRecordLine_btn, SIGNAL(clicked()), this, SLOT(onDeleteRecordLine_btn())); - connect(ui.saveRecordLine2File_btn, SIGNAL(clicked()), this, SLOT(onSaveRecordLine2File_btn())); - connect(ui.readRecordLineFile_btn, SIGNAL(clicked()), this, SLOT(onReadRecordLineFile_btn())); -} - -PathPlan::~PathPlan() -{} - -void PathPlan::setMotor(VinceControl* xMotor, VinceControl* yMotor) -{ - m_xMotor = xMotor; - m_yMotor = yMotor; -} - -QTableWidget* PathPlan::getRecordLineTableWidget() -{ - return ui.recordLine_tableWidget; -} - -void PathPlan::onAddRecordLine_btn() -{ - //׼ - ByteBack MotorState = m_yMotor->GetState(); - double currentPosOfYmotor = m_ySlider->getDistanceFromPulse(MotorState.Location); - double maxRangeOfXmotro = m_xSlider->maximum(); - - //ȡѡе - int currentRow = ui.recordLine_tableWidget->currentRow(); - std::cout << "currentRow" << currentRow << std::endl; - - QTableWidgetItem* Item1 = new QTableWidgetItem(QString::number(currentPosOfYmotor, 10, 2)); - QTableWidgetItem* Item2 = new QTableWidgetItem(QString::number(maxRangeOfXmotro, 10, 2)); - Item1->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter); - Item2->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter); - if (currentRow == -1)//ûѡʱ - { - int RowCount = ui.recordLine_tableWidget->rowCount();//Returns the number of rows. 1ʼ - ui.recordLine_tableWidget->insertRow(RowCount);//һУβǴ0ʼ - - ui.recordLine_tableWidget->setItem(RowCount, 0, Item1); - ui.recordLine_tableWidget->setItem(RowCount, 1, Item2); - } - else - { - ui.recordLine_tableWidget->insertRow(currentRow + 1);//һУβǴ0ʼ - - ui.recordLine_tableWidget->setItem(currentRow + 1, 0, Item1); - ui.recordLine_tableWidget->setItem(currentRow + 1, 1, Item2); - } -} - -void PathPlan::onRemoveRecordLine_btn() -{ - int rowIndex = ui.recordLine_tableWidget->currentRow(); - if (rowIndex != -1) - ui.recordLine_tableWidget->removeRow(rowIndex); -} - -void PathPlan::onGenerateRecordLine_btn() -{ - // - double height = ui.height_lineEdit->text().toDouble(); - double fov = ui.fov_lineEdit->text().toDouble(); - double swath = (height * tan(fov / 2 * PI / 180)) * 2;//tanǻ - ui.swath_lineEdit->setText(QString::number(swath)); - - - //ȡΧ - double xMotorRange = m_xSlider->maximum(); - double yMotorRange = m_ySlider->maximum(); - - - //ȷжɼߣʽnumberOfRecordLine_tmp * swath - repetitiveLengthnumberOfRecordLine_tmp - 1 = overallLength - double overallLength = yMotorRange + swath; - double repetitiveRate = ui.repetitiveRate_lineEdit->text().toDouble() / 100; - double repetitiveLength = repetitiveRate * swath; - double offset = ui.offset_lineEdit->text().toDouble(); - - double numberOfRecordLine_tmp = (overallLength - repetitiveLength - offset) / (swath - repetitiveLength); - double tmp = numberOfRecordLine_tmp - (int)numberOfRecordLine_tmp; - int numberOfRecordLine; - double threshold = ui.LastLineThreshold_lineEdit->text().toDouble();//numberOfRecordLine_tmpΪСʱжǷһɼ - if (tmp > threshold) - { - numberOfRecordLine = (int)numberOfRecordLine_tmp + 1; - //std::cout << "ڣ" << threshold << std::endl; - } - else - { - numberOfRecordLine = (int)numberOfRecordLine_tmp; - } - - - - //ȥtableWidgetе - int rowCount = ui.recordLine_tableWidget->rowCount(); - for (size_t i = 0; i < rowCount; i++) - { - ui.recordLine_tableWidget->removeRow(0); - } - - - //tableWidgetУɼߣ - QTableWidgetItem* tmpItem; - for (size_t i = 0; i < numberOfRecordLine; i++) - { - //һ - int RowCount = ui.recordLine_tableWidget->rowCount(); - ui.recordLine_tableWidget->insertRow(RowCount); - - //yPosition - if (tmp > threshold && i == numberOfRecordLine - 1)//һеyPosition - { - tmpItem = new QTableWidgetItem(QString::number(yMotorRange, 10, 2)); - tmpItem->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter); - ui.recordLine_tableWidget->setItem(i, 0, tmpItem); - } - else - { - double x = swath * i - i * repetitiveLength + offset; - tmpItem = new QTableWidgetItem(QString::number(x, 10, 2)); - tmpItem->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter); - ui.recordLine_tableWidget->setItem(i, 0, tmpItem); - } - - //x˶λ ֵΪx - tmpItem = new QTableWidgetItem(QString::number(xMotorRange, 10, 2)); - tmpItem->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter); - ui.recordLine_tableWidget->setItem(i, 1, tmpItem); - - } - -} - -void PathPlan::onDeleteRecordLine_btn() -{ - int rowCount = ui.recordLine_tableWidget->rowCount(); - for (size_t i = 0; i < rowCount; i++) - { - ui.recordLine_tableWidget->removeRow(0); - } -} - -void PathPlan::onSaveRecordLine2File_btn() -{ - //ȷɼߴ - if (ui.recordLine_tableWidget->rowCount() <= 0) - { - QMessageBox::information(this, QString::fromLocal8Bit("ʾ"), QString::fromLocal8Bit("ɹ켣")); - return; - } - - double height = ui.height_lineEdit->text().toDouble(); - double fov = ui.fov_lineEdit->text().toDouble(); - double swath = ui.swath_lineEdit->text().toDouble(); - double offset = ui.offset_lineEdit->text().toDouble(); - double repetitiveRate = ui.repetitiveRate_lineEdit->text().toDouble(); - double LastLineThreshold = ui.LastLineThreshold_lineEdit->text().toDouble(); - - FileOperation* fileOperation = new FileOperation(); - string directory = fileOperation->getDirectoryOfExe(); - - QString RecordLineFilePath = QFileDialog::getSaveFileName(this, tr("Save RecordLine File"), - QString::fromStdString(directory), - tr("RecordLineFile (*.RecordLine)")); - - if (RecordLineFilePath.isEmpty()) - { - return; - } - - FILE* RecordLineFileHandle = fopen(RecordLineFilePath.toStdString().c_str(), "wb+"); - - fwrite(&height, sizeof(double), 1, RecordLineFileHandle); - fwrite(&fov, sizeof(double), 1, RecordLineFileHandle); - fwrite(&swath, sizeof(double), 1, RecordLineFileHandle); - fwrite(&offset, sizeof(double), 1, RecordLineFileHandle); - fwrite(&repetitiveRate, sizeof(double), 1, RecordLineFileHandle); - fwrite(&LastLineThreshold, sizeof(double), 1, RecordLineFileHandle); - - double number = ui.recordLine_tableWidget->rowCount() * ui.recordLine_tableWidget->columnCount(); - fwrite(&number, sizeof(double), 1, RecordLineFileHandle); - - double* data = new double[number]; - //double data[number]; - for (size_t i = 0; i < ui.recordLine_tableWidget->rowCount(); i++) - { - for (size_t j = 0; j < ui.recordLine_tableWidget->columnCount(); j++) - { - data[i * ui.recordLine_tableWidget->columnCount() + j] = ui.recordLine_tableWidget->item(i, j)->text().toDouble(); - } - } - - fwrite(data, sizeof(double), number, RecordLineFileHandle); - - fclose(RecordLineFileHandle); - delete[] data; - - QMessageBox::information(this, QString::fromLocal8Bit("ʾ"), QString::fromLocal8Bit("ɹ")); -} - -void PathPlan::onReadRecordLineFile_btn() -{ - //ļ - FileOperation* fileOperation = new FileOperation(); - string directory = fileOperation->getDirectoryOfExe(); - //string RecordLineFilePath = directory + "\\test.RecordLine"; - - QString RecordLineFilePath = QFileDialog::getOpenFileName(this, tr("Open RecordLine File"), - QString::fromStdString(directory), - tr("RecordLineFile (*.RecordLine)")); - - if (RecordLineFilePath.isEmpty()) - { - return; - } - - FILE* RecordLineFileHandle = fopen(RecordLineFilePath.toStdString().c_str(), "rb"); - double height, fov, swath, offset, repetitiveRate, LastLineThreshold, number; - - //ȡ - fread(&height, sizeof(double), 1, RecordLineFileHandle); - fread(&fov, sizeof(double), 1, RecordLineFileHandle); - fread(&swath, sizeof(double), 1, RecordLineFileHandle); - fread(&offset, sizeof(double), 1, RecordLineFileHandle); - fread(&repetitiveRate, sizeof(double), 1, RecordLineFileHandle); - fread(&LastLineThreshold, sizeof(double), 1, RecordLineFileHandle); - fread(&number, sizeof(double), 1, RecordLineFileHandle); - - double* data = new double[number]; - for (size_t i = 0; i < number; i++) - { - fread(data + i, sizeof(double), 1, RecordLineFileHandle); - //std::cout << *(data + i) << std::endl; - } - - //д - ui.height_lineEdit->setText(QString::number(height)); - ui.fov_lineEdit->setText(QString::number(fov)); - ui.swath_lineEdit->setText(QString::number(swath)); - ui.offset_lineEdit->setText(QString::number(offset)); - ui.repetitiveRate_lineEdit->setText(QString::number(repetitiveRate)); - ui.LastLineThreshold_lineEdit->setText(QString::number(LastLineThreshold)); - - - //tableWidgetӲɼ - //1ȥtableWidgetе - int rowCount = ui.recordLine_tableWidget->rowCount(); - for (size_t i = 0; i < rowCount; i++) - { - ui.recordLine_tableWidget->removeRow(0); - } - //2Уɼߣ - int RecordLineCount = number / ui.recordLine_tableWidget->columnCount(); - for (size_t i = 0; i < RecordLineCount; i++) - { - ui.recordLine_tableWidget->insertRow(0); - - } - //3tableWidget - for (size_t i = 0; i < ui.recordLine_tableWidget->rowCount(); i++) - { - for (size_t j = 0; j < ui.recordLine_tableWidget->columnCount(); j++) - { - QTableWidgetItem* tmp = new QTableWidgetItem(QString::number(data[i * ui.recordLine_tableWidget->columnCount() + j], 10, 5)); - tmp->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter); - ui.recordLine_tableWidget->setItem(i, j, tmp); - } - } - - fclose(RecordLineFileHandle); - delete[] data; - - QMessageBox::information(this, QString::fromLocal8Bit("ʾ"), QString::fromLocal8Bit("ȡɹ")); - -} diff --git a/HPPA/PathPlan.h b/HPPA/PathPlan.h deleted file mode 100644 index 0bd5e5f..0000000 --- a/HPPA/PathPlan.h +++ /dev/null @@ -1,37 +0,0 @@ -#pragma once - -#include -#include "ui_PathPlan.h" -#include "vincecontrol.h" -#include - -#define PI 3.1415926 - -class PathPlan : public QDialog -{ - Q_OBJECT - -public: - PathPlan(VinceControl* xMotor, VinceControl* yMotor, QMotorDoubleSlider* xSlider, QMotorDoubleSlider* ySlider, QWidget* parent = nullptr); - ~PathPlan(); - - void setMotor(VinceControl* xMotor, VinceControl* yMotor); - QTableWidget* getRecordLineTableWidget(); - -private: - Ui::PathPlanClass ui; - - VinceControl* m_xMotor; - VinceControl* m_yMotor; - - QMotorDoubleSlider* m_xSlider; - QMotorDoubleSlider* m_ySlider; - -public Q_SLOTS: - void onAddRecordLine_btn(); - void onRemoveRecordLine_btn(); - void onGenerateRecordLine_btn(); - void onDeleteRecordLine_btn(); - void onSaveRecordLine2File_btn(); - void onReadRecordLineFile_btn(); -}; diff --git a/HPPA/RadianceConversion.ui b/HPPA/RadianceConversion.ui new file mode 100644 index 0000000..4367043 --- /dev/null +++ b/HPPA/RadianceConversion.ui @@ -0,0 +1,167 @@ + + + RadianceConversion_UI + + + + 0 + 0 + 544 + 177 + + + + 辐亮度转换 + + + + + + + + + + 影像 + + + Qt::AlignCenter + + + + + + + 定标文件 + + + Qt::AlignCenter + + + + + + + + + + + + + + Qt::AlignCenter + + + true + + + + + + + + 0 + 0 + + + + + 0 + 0 + + + + + 16777215 + 16777215 + + + + background-color: rgb(255, 255, 255); + + + + + + Qt::AlignCenter + + + true + + + + + + + + + + + + 0 + 0 + + + + ... + + + + + + + + 0 + 0 + + + + ... + + + + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + 转换 + + + + + + + + + Qt::Vertical + + + + 20 + 191 + + + + + + + + + diff --git a/HPPA/ReflectanceConversion.ui b/HPPA/ReflectanceConversion.ui new file mode 100644 index 0000000..a9418b3 --- /dev/null +++ b/HPPA/ReflectanceConversion.ui @@ -0,0 +1,167 @@ + + + ReflectanceConversion_UI + + + + 0 + 0 + 544 + 177 + + + + 反射率转换 + + + + + + + + + + 影像 + + + Qt::AlignCenter + + + + + + + 白板影像 + + + Qt::AlignCenter + + + + + + + + + + + + + + Qt::AlignCenter + + + true + + + + + + + + 0 + 0 + + + + + 0 + 0 + + + + + 16777215 + 16777215 + + + + background-color: rgb(255, 255, 255); + + + + + + Qt::AlignCenter + + + true + + + + + + + + + + + + 0 + 0 + + + + ... + + + + + + + + 0 + 0 + + + + ... + + + + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + 转换 + + + + + + + + + Qt::Vertical + + + + 20 + 191 + + + + + + + + + diff --git a/HPPA/TwoMotorControl.cpp b/HPPA/TwoMotorControl.cpp index ecec9b5..63a5d63 100644 --- a/HPPA/TwoMotorControl.cpp +++ b/HPPA/TwoMotorControl.cpp @@ -65,6 +65,30 @@ bool TwoMotorControl::getState() return tmp; } +void TwoMotorControl::record_dark() +{ + double s = ui.xmotor_move_speed_lineEdit->text().toDouble(); + + if (m_darkCaptureCoordinator == nullptr) + { + m_darkCaptureCoordinator = new DarkAndWhiteCaptureCoordinator(0, m_multiAxisController, m_Imager); + } + + m_darkCaptureCoordinator->startStepMotion(s); +} + +void TwoMotorControl::record_white() +{ + double s = ui.xmotor_move_speed_lineEdit->text().toDouble(); + + if (m_whiteCaptureCoordinator == nullptr) + { + m_whiteCaptureCoordinator = new DarkAndWhiteCaptureCoordinator(1, m_multiAxisController, m_Imager); + } + + m_whiteCaptureCoordinator->startStepMotion(s); +} + void TwoMotorControl::run() { if (m_coordinator==nullptr) diff --git a/HPPA/TwoMotorControl.h b/HPPA/TwoMotorControl.h index f9d7627..383a38a 100644 --- a/HPPA/TwoMotorControl.h +++ b/HPPA/TwoMotorControl.h @@ -24,6 +24,9 @@ public: void setImager(ImagerOperationBase* imager); void setPosFileName(QString posFileName); + void record_dark(); + void record_white(); + private: ImagerOperationBase* m_Imager; bool getState(); @@ -84,6 +87,9 @@ private: QThread m_coordinatorThread; TwoMotionCaptureCoordinator* m_coordinator = nullptr; + DarkAndWhiteCaptureCoordinator* m_darkCaptureCoordinator = nullptr; + DarkAndWhiteCaptureCoordinator* m_whiteCaptureCoordinator = nullptr; + QThread m_motorThread; IrisMultiMotorController* m_multiAxisController; }; diff --git a/HPPA/about.ui b/HPPA/about.ui index 0608e09..7c2799a 100644 --- a/HPPA/about.ui +++ b/HPPA/about.ui @@ -70,7 +70,7 @@ - 版本:1.9.0 + 版本:2.0