加入 dockWidget

This commit is contained in:
tangchao0503
2025-01-01 18:46:33 +08:00
parent cbc81cb75e
commit 0e46470402
17 changed files with 1278 additions and 1052 deletions

View File

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>1312</width>
<height>752</height>
<width>600</width>
<height>332</height>
</rect>
</property>
<property name="windowTitle">

View File

@ -8,8 +8,6 @@
#include "ImageReaderWriter.h"
HPPA::HPPA(QWidget *parent)
: QMainWindow(parent)
{
@ -164,8 +162,8 @@ HPPA::HPPA(QWidget *parent)
startTimer(1000);
m_lManualSpeedOfXMotor = 6000;
m_lManualSpeedOfYMotor = 6000*2;//<2F>Ϻ<EFBFBD>ũ<EFBFBD><C5A9>Ժ<EFBFBD><D4BA>20000
m_lManualSpeedOfXMotor = 6000 * 4 * 2;
m_lManualSpeedOfYMotor = 6000 * 4;//<2F>Ϻ<EFBFBD>ũ<EFBFBD><C5A9>Ժ<EFBFBD><D4BA>20000
connect(this->ui.motor_reset_btn, SIGNAL(clicked()), this, SLOT(onMotorReset()));
@ -179,7 +177,7 @@ HPPA::HPPA(QWidget *parent)
connect(this->ui.ymotor_backward_btn, SIGNAL(pressed()), this, SLOT(onyMotorBackward()));
connect(this->ui.ymotor_backward_btn, SIGNAL(released()), this, SLOT(onyMotorStop()));
//<2F>ٶ<EFBFBD>
//<2F>ٶ<EFBFBD>
QRegExp rx("\\d{0,3}[1-9]$");
ui.xmotor_speed_lineEdit->setValidator(new QRegExpValidator(rx));
@ -232,29 +230,6 @@ HPPA::HPPA(QWidget *parent)
//<2F><><EFBFBD><EFBFBD>λ<EFBFBD><CEBB>ģ<EFBFBD><C4A3>
connect(ui.graphicsView->imager, SIGNAL(leftMouseButtonPressed(int, int)), this, SLOT(onimagerSimulatorMove(int, int)));
//<2F><EFBFBD>ɼ<EFBFBD><C9BC><EFBFBD>
ui.recordLine_tableWidget->setFocusPolicy(Qt::NoFocus);
ui.recordLine_tableWidget->setStyleSheet("selection-background-color:rgb(255,209,128)");//<2F><><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD>и<EFBFBD><D0B8><EFBFBD>
ui.recordLine_tableWidget->setSelectionBehavior(QAbstractItemView::SelectRows);//<2F><><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>λ
//ui.recordLine_tableWidget->setSelectionMode(QAbstractItemView::SingleSelection);//<2F><><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1>ģʽ<C4A3><CABD>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
//QHeaderView* headerView = ui.recordLine_tableWidget->verticalHeader();
//headerView->setHidden(true);//ȥ<><C8A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ĭ<EFBFBD><C4AC><EFBFBD>Դ<EFBFBD><D4B4><EFBFBD><EFBFBD>к<EFBFBD>
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()));
//
m_ForLoopControlThread = new QThread();
m_ForLoopControl = new ForLoopControl();
@ -279,31 +254,41 @@ HPPA::HPPA(QWidget *parent)
connect(m_ForLoopControl, SIGNAL(recordSignal(int)), this, SLOT(onCreateTab(int)));//<2F><>tabWidget<65><74><EFBFBD>½<EFBFBD>һ<EFBFBD><D2BB>tab<61><62><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾͼ<CABE><CDBC>
connect(ui.ImageViewerTabWidget, SIGNAL(currentChanged(int)), this, SLOT(onTabWidgetCurrentChanged(int)));
//<2F><>Դ<EFBFBD><D4B4><EFBFBD><EFBFBD>
connect(ui.lamp_power_open_btn, SIGNAL(clicked()), this, SLOT(onLampPowerOpen_btn()));
connect(ui.lamp_power_close_btn, SIGNAL(clicked()), this, SLOT(onLampPowerClose_btn()));
connect(ui.motor_power_open_btn, SIGNAL(clicked()), this, SLOT(onMotorPowerOpen_btn()));
connect(ui.motor_power_close_btn, SIGNAL(clicked()), this, SLOT(onMotorPowerClose_btn()));
//
connect(this->ui.action_about, SIGNAL(triggered()), this, SLOT(onAbout()));
initPanelToolbar();
//<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->setWidget(m_pathPlan);
tabifyDockWidget(ui.mDockWidgetLinearStage, dock_pathPlan);
mPanelMenu->addAction(dock_pathPlan->toggleViewAction());
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>dock
adjustTable* adt = new adjustTable();
//
connect(ui.objective_table1_up_btn, SIGNAL(clicked()), this, SLOT(onObjectivTable1Up_btn()));
connect(ui.objective_table1_down_btn, SIGNAL(clicked()), this, SLOT(onObjectivTable1Down_btn()));
connect(ui.objective_table1_stop_btn, SIGNAL(clicked()), this, SLOT(onObjectivTable1Stop_btn()));
QDockWidget* dock_adt = new QDockWidget(QString::fromLocal8Bit("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"), this);
dock_adt->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
dock_adt->setWidget(adt);
tabifyDockWidget(dock_pathPlan, dock_adt);
mPanelMenu->addAction(dock_adt->toggleViewAction());
connect(ui.objective_table2_up_btn, SIGNAL(clicked()), this, SLOT(onObjectivTable2Up_btn()));
connect(ui.objective_table2_down_btn, SIGNAL(clicked()), this, SLOT(onObjectivTable2Down_btn()));
connect(ui.objective_table2_stop_btn, SIGNAL(clicked()), this, SLOT(onObjectivTable2Stop_btn()));
//<2F><>Դ<EFBFBD><D4B4><EFBFBD><EFBFBD>
PowerControl* pc = new PowerControl();
QDockWidget* dock_pc = new QDockWidget(QString::fromLocal8Bit("<EFBFBD><EFBFBD>Դ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>"), this);
dock_pc->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
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);
createActionGroups();
connect(mImagerGroup, &QActionGroup::triggered, this, &HPPA::selectingImager);
initPanelToolbar();
}
void HPPA::createActionGroups()
@ -357,9 +342,6 @@ HPPA::~HPPA()
void HPPA::initPanelToolbar()
{
tabifyDockWidget(ui.mDockWidgetSpectrometer, ui.mDockWidgetLinearStage);
tabifyDockWidget(ui.mDockWidgetLinearStage, ui.mDockWidgetPathPlanning);
tabifyDockWidget(ui.mDockWidgetPathPlanning, ui.mDockWidgetPowerControl);
tabifyDockWidget(ui.mDockWidgetPowerControl, ui.mDockWidgetAdjustTable);
mPanelMenu = new QMenu(QString::fromLocal8Bit("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>"), this);//create panel menu
mPanelMenu->setObjectName(QStringLiteral("mPanelMenu"));
@ -372,9 +354,7 @@ void HPPA::initPanelToolbar()
mPanelMenu->addAction(ui.mDockWidgetSpectrometer->toggleViewAction());
mPanelMenu->addAction(ui.mDockWidgetLinearStage->toggleViewAction());
mPanelMenu->addAction(ui.mDockWidgetPathPlanning->toggleViewAction());
mPanelMenu->addAction(ui.mDockWidgetPowerControl->toggleViewAction());
mPanelMenu->addAction(ui.mDockWidgetAdjustTable->toggleViewAction());
mPanelMenu->addAction(ui.mDockWidgetRGBCamera->toggleViewAction());
mPanelMenu->addAction(ui.mDockWidgetSimulator->toggleViewAction());
@ -413,25 +393,25 @@ void HPPA::onStartRecordStep1()
//ȷ<><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 < ui.recordLine_tableWidget->rowCount(); i++)
for (size_t i = 0; i < m_pathPlan->getRecordLineTableWidget()->rowCount(); i++)
{
//xx = xx + ui.xmotor_location_slider->value() < ui.recordLine_tableWidget->item(i, 1)->text().toDouble();
//xx = xx + ui.xmotor_location_slider->value() < m_pathPlan->getRecordLineTableWidget()->item(i, 1)->text().toDouble();
if (ui.xmotor_location_slider->value() < ui.recordLine_tableWidget->item(i, 1)->text().toDouble())
if (ui.xmotor_location_slider->value() < m_pathPlan->getRecordLineTableWidget()->item(i, 1)->text().toDouble())
{
validLineCount++;
}
}
if (validLineCount < ui.recordLine_tableWidget->rowCount())
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 (ui.recordLine_tableWidget->rowCount() <= 0)
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;
@ -475,15 +455,15 @@ void HPPA::onStartRecordStep1()
ui.ImageViewerTabWidget->clear();
//<2F><>ʼѭ<CABC><D1AD>
m_ForLoopControl->setLoopCount(ui.recordLine_tableWidget->rowCount());//Ϊѭ<CEAA><D1AD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>߳<EFBFBD><DFB3><EFBFBD><EFBFBD><EFBFBD>ѭ<EFBFBD><D1AD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
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 < ui.recordLine_tableWidget->rowCount(); i++)
for (size_t i = 0; i < m_pathPlan->getRecordLineTableWidget()->rowCount(); i++)
{
for (size_t j = 0; j < ui.recordLine_tableWidget->columnCount(); j++)
for (size_t j = 0; j < m_pathPlan->getRecordLineTableWidget()->columnCount(); j++)
{
ui.recordLine_tableWidget->item(i, j)->setBackgroundColor(QColor(240, 240, 240));
m_pathPlan->getRecordLineTableWidget()->item(i, j)->setBackgroundColor(QColor(240, 240, 240));
}
}
@ -516,15 +496,15 @@ void HPPA::onStartRecordStep2(int lineNumber)
if (lineNumber >= 0)
{
//<2F><>ʼ<EFBFBD>ƶ<EFBFBD>y<EFBFBD><79><EFBFBD><EFBFBD><EFA3AC><EFBFBD><EFBFBD>x<EFBFBD><78><EFBFBD><EFBFBD><EFBFBD>ƶ<EFBFBD><C6B6>͹<EFBFBD><CDB9><EFBFBD><EFBFBD>Dzɼ<C7B2><C9BC>Ĵ<EFBFBD><C4B4><EFBFBD>Ҳ<EFBFBD><D2B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
double pos = ui.recordLine_tableWidget->item(lineNumber, 0)->text().toDouble();
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);
//<2F><><EFBFBD><EFBFBD><EFBFBD>ڲɼ<DAB2><C9BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>ɫ
for (size_t i = 0; i < ui.recordLine_tableWidget->columnCount(); i++)
for (size_t i = 0; i < m_pathPlan->getRecordLineTableWidget()->columnCount(); i++)
{
ui.recordLine_tableWidget->item(lineNumber, i)->setBackgroundColor(QColor(255, 0, 0));
m_pathPlan->getRecordLineTableWidget()->item(lineNumber, i)->setBackgroundColor(QColor(255, 0, 0));
}
}
else if (lineNumber == -1)
@ -536,7 +516,7 @@ void HPPA::onStartRecordStep2(int lineNumber)
ui.mainToolBar->widgetForAction(ui.action_start_recording)->setStyleSheet("QWidget{background-color:rgb(0,255,0);}");
//<2F><>y<EFBFBD><79><EFBFBD><EFBFBD><EFBFBD>ƶ<EFBFBD><C6B6><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD>ɼ<EFBFBD><C9BC>ߵ<EFBFBD>λ<EFBFBD><CEBB>
double ymotorPositionOfLine1Tmp = ui.recordLine_tableWidget->item(0, 0)->text().toDouble();
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);
@ -1081,7 +1061,7 @@ void HPPA::ontimerYmotorLocationFeedBackAfterRecord()
{
m_timerYmotorLocationFeedBackAfterRecord->stop();
double ymotorPositionOfLine1Tmp = ui.recordLine_tableWidget->item(0, 0)->text().toDouble();//ymotorPositionOfLine1
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);
@ -1209,13 +1189,12 @@ void HPPA::ontimerTestRangeOfxMotor()
{
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();
double maxDistance = ui.xmotor_location_slider->getDistanceFromPulse(MotorState.Location);
//<2F><>x<EFBFBD><78><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̼<EFBFBD>¼<EFBFBD><C2BC><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD>Ա<EFBFBD><D4B1><EFBFBD><EFBFBD><EFBFBD>ʹ<EFBFBD><CAB9> <20><> <20><><EFBFBD><EFBFBD>ÿ<EFBFBD>ζ<EFBFBD><CEB6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̣<EFBFBD><CCA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˷<EFBFBD>ʱ<EFBFBD><CAB1>
configfile.setMaxRange(maxDistance, "x");
mConfigfile.setMaxRange(maxDistance, "x");
ui.xmotor_location_slider->setMaximum(maxDistance);
ui.xmotor_max_location_label->setText(QString::number(ui.xmotor_location_slider->maximum()));
@ -1252,13 +1231,13 @@ void HPPA::ontimerTestRangeOfyMotor()
{
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();
double maxDistance = ui.ymotor_location_slider->getDistanceFromPulse(MotorState.Location);
//<2F><>y<EFBFBD><79><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̼<EFBFBD>¼<EFBFBD><C2BC><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD>Ա<EFBFBD><D4B1><EFBFBD><EFBFBD><EFBFBD>ʹ<EFBFBD><CAB9> <20><> <20><><EFBFBD><EFBFBD>ÿ<EFBFBD>ζ<EFBFBD><CEB6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̣<EFBFBD><CCA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˷<EFBFBD>ʱ<EFBFBD><CAB1>
configfile.setMaxRange(maxDistance, "y");
mConfigfile.setMaxRange(maxDistance, "y");
ui.ymotor_location_slider->setMaximum(maxDistance);
ui.ymotor_max_location_label->setText(QString::number(ui.ymotor_location_slider->maximum()));
@ -1270,262 +1249,6 @@ void HPPA::ontimerTestRangeOfyMotor()
}
}
void HPPA::onAddRecordLine_btn()
{
//׼<><D7BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
ByteBack MotorState = m_yMotor->GetState();
double currentPosOfYmotor = ui.ymotor_location_slider->getDistanceFromPulse(MotorState.Location);
double maxRangeOfXmotro = ui.xmotor_location_slider->maximum();
//<2F><>ȡѡ<C8A1><D1A1><EFBFBD>е<EFBFBD><D0B5><EFBFBD><EFBFBD><EFBFBD>
int currentRow = ui.recordLine_tableWidget->currentRow();
std::cout << "currentRow<EFBFBD><EFBFBD>" << currentRow << std::endl;
QTableWidgetItem* Item1 = new QTableWidgetItem(QString::number(currentPosOfYmotor, 10, 2));
QTableWidgetItem* Item2 = new QTableWidgetItem(QString::number(maxRangeOfXmotro, 10, 2));
if (currentRow == -1)//<2F><>û<EFBFBD><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD>ʱ
{
int RowCount = ui.recordLine_tableWidget->rowCount();//Returns the number of rows. <20><>1<EFBFBD><31>ʼ<EFBFBD><CABC>
ui.recordLine_tableWidget->insertRow(RowCount);//<2F><><EFBFBD><EFBFBD>һ<EFBFBD>У<EFBFBD><D0A3>β<EFBFBD><CEB2>Ǵ<EFBFBD>0<EFBFBD><30>ʼ<EFBFBD><CABC>
ui.recordLine_tableWidget->setItem(RowCount, 0, Item1);
ui.recordLine_tableWidget->setItem(RowCount, 1, Item2);
}
else
{
ui.recordLine_tableWidget->insertRow(currentRow + 1);//<2F><><EFBFBD><EFBFBD>һ<EFBFBD>У<EFBFBD><D0A3>β<EFBFBD><CEB2>Ǵ<EFBFBD>0<EFBFBD><30>ʼ<EFBFBD><CABC>
ui.recordLine_tableWidget->setItem(currentRow + 1, 0, Item1);
ui.recordLine_tableWidget->setItem(currentRow + 1, 1, Item2);
}
}
void HPPA::onRemoveRecordLine_btn()
{
int rowIndex = ui.recordLine_tableWidget->currentRow();
if (rowIndex != -1)
ui.recordLine_tableWidget->removeRow(rowIndex);
}
void HPPA::onGenerateRecordLine_btn()
{
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
double height = ui.height_lineEdit->text().toDouble();
double fov = ui.fov_lineEdit->text().toDouble();
double swath = (height * tan(fov / 2 * PI / 180)) * 2;//tan<61><6E><EFBFBD><EFBFBD><EFBFBD>ǻ<EFBFBD><C7BB><EFBFBD>
ui.swath_lineEdit->setText(QString::number(swath));
//<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Χ
double xMotorRange = ui.xmotor_location_slider->maximum();
double yMotorRange = ui.ymotor_location_slider->maximum();
//ȷ<><C8B7><EFBFBD>ж<EFBFBD><D0B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɼ<EFBFBD><C9BC>ߣ<EFBFBD><DFA3><EFBFBD>ʽ<EFBFBD><CABD>numberOfRecordLine_tmp * swath - repetitiveLength<74><68>numberOfRecordLine_tmp - 1<><31> = 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();//<2F><>numberOfRecordLine_tmpΪС<CEAA><D0A1>ʱ<EFBFBD><CAB1><EFBFBD>ж<EFBFBD><D0B6>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD>ɼ<EFBFBD><C9BC><EFBFBD>
if (tmp > threshold)
{
numberOfRecordLine = (int)numberOfRecordLine_tmp + 1;
//std::cout << "<22><><EFBFBD>ڣ<EFBFBD>" << threshold << std::endl;
}
else
{
numberOfRecordLine = (int)numberOfRecordLine_tmp;
}
//ȥ<><C8A5>tableWidget<65><74><EFBFBD><EFBFBD><EFBFBD>е<EFBFBD><D0B5><EFBFBD>
int rowCount = ui.recordLine_tableWidget->rowCount();
for (size_t i = 0; i < rowCount; i++)
{
ui.recordLine_tableWidget->removeRow(0);
}
//<2F><>tableWidget<65><74><EFBFBD><EFBFBD><EFBFBD>У<EFBFBD><D0A3>ɼ<EFBFBD><C9BC>ߣ<EFBFBD>
QTableWidgetItem* tmpItem;
for (size_t i = 0; i < numberOfRecordLine; i++)
{
//<2F><><EFBFBD><EFBFBD>һ<EFBFBD><D2BB>
int RowCount = ui.recordLine_tableWidget->rowCount();
ui.recordLine_tableWidget->insertRow(RowCount);
//<2F><><EFBFBD><EFBFBD>yPosition
if (tmp > threshold && i == numberOfRecordLine - 1)//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD>е<EFBFBD>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);
}
//<2F><><EFBFBD><EFBFBD>x<EFBFBD><78><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˶<EFBFBD>λ<EFBFBD><CEBB> <20><> ֵ<><D6B5><EFBFBD><EFBFBD>Ϊx<CEAA><78><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
tmpItem = new QTableWidgetItem(QString::number(xMotorRange, 10, 2));
tmpItem->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
ui.recordLine_tableWidget->setItem(i, 1, tmpItem);
}
}
void HPPA::onDeleteRecordLine_btn()
{
int rowCount = ui.recordLine_tableWidget->rowCount();
for (size_t i = 0; i < rowCount; i++)
{
ui.recordLine_tableWidget->removeRow(0);
}
}
void HPPA::onSaveRecordLine2File_btn()
{
//ȷ<><C8B7><EFBFBD>ɼ<EFBFBD><C9BC>ߴ<EFBFBD><DFB4><EFBFBD>
if (ui.recordLine_tableWidget->rowCount() <= 0)
{
QMessageBox::information(this, QString::fromLocal8Bit("<EFBFBD><EFBFBD>ʾ"), QString::fromLocal8Bit("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɹ켣<EFBFBD><EFBFBD>"));
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("<EFBFBD><EFBFBD>ʾ"), QString::fromLocal8Bit("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD><EFBFBD><EFBFBD>"));
}
void HPPA::onReadRecordLineFile_btn()
{
//<2F><><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>
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(), "r");
double height, fov, swath, offset, repetitiveRate, LastLineThreshold, number;
//<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>
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;
}
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>д
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));
//<2F><>tableWidget<65><74><EFBFBD>Ӳɼ<D3B2><C9BC><EFBFBD>
//<2F><>1<EFBFBD><31>ȥ<EFBFBD><C8A5>tableWidget<65><74><EFBFBD><EFBFBD><EFBFBD>е<EFBFBD><D0B5><EFBFBD>
int rowCount = ui.recordLine_tableWidget->rowCount();
for (size_t i = 0; i < rowCount; i++)
{
ui.recordLine_tableWidget->removeRow(0);
}
//<2F><>2<EFBFBD><32><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>У<EFBFBD><D0A3>ɼ<EFBFBD><C9BC>ߣ<EFBFBD>
int RecordLineCount = number / ui.recordLine_tableWidget->columnCount();
for (size_t i = 0; i < RecordLineCount; i++)
{
ui.recordLine_tableWidget->insertRow(0);
}
//<2F><>3<EFBFBD><33><EFBFBD><EFBFBD>tableWidget<65><74><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
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, 2));
tmp->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
ui.recordLine_tableWidget->setItem(i, j, tmp);
}
}
fclose(RecordLineFileHandle);
delete[] data;
QMessageBox::information(this, QString::fromLocal8Bit("<EFBFBD><EFBFBD>ʾ"), QString::fromLocal8Bit("<EFBFBD><EFBFBD>ȡ<EFBFBD>ɹ<EFBFBD><EFBFBD><EFBFBD>"));
}
void HPPA::ontimerMoveXmotor()
{
//std::cout << "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" << std::endl;
@ -1567,9 +1290,9 @@ void HPPA::ontimerMoveXmotor()
m_timerMoveXmotor->stop();
//<2F><><EFBFBD>ɼ<EFBFBD><C9BC><EFBFBD><EFBFBD>ɵ<EFBFBD><C9B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>ɫ
for (size_t j = 0; j < ui.recordLine_tableWidget->columnCount(); j++)
for (size_t j = 0; j < m_pathPlan->getRecordLineTableWidget()->columnCount(); j++)
{
ui.recordLine_tableWidget->item(m_numberOfRecording, j)->setBackgroundColor(QColor(0, 255, 0));
m_pathPlan->getRecordLineTableWidget()->item(m_numberOfRecording, j)->setBackgroundColor(QColor(0, 255, 0));
}
//׼ȷ<D7BC><C8B7><EFBFBD><EFBFBD>x<EFBFBD><78><EFBFBD><EFBFBD>slider<65><72>λ<EFBFBD><CEBB>
@ -1612,7 +1335,7 @@ void HPPA::ontimerMoveYmotor()
m_timerMoveYmotor->stop();
//׼ȷ<D7BC><C8B7><EFBFBD><EFBFBD>y<EFBFBD><79><EFBFBD><EFBFBD>slider<65><72>λ<EFBFBD><CEBB>
double pos = ui.recordLine_tableWidget->item(m_numberOfRecording, 0)->text().toDouble();
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);
@ -1620,9 +1343,9 @@ void HPPA::ontimerMoveYmotor()
if (m_RecordState % 2 == 0)
{
//
for (size_t j = 0; j < ui.recordLine_tableWidget->columnCount(); j++)
for (size_t j = 0; j < m_pathPlan->getRecordLineTableWidget()->columnCount(); j++)
{
ui.recordLine_tableWidget->item(m_numberOfRecording, j)->setBackgroundColor(QColor(240, 240, 240));
m_pathPlan->getRecordLineTableWidget()->item(m_numberOfRecording, j)->setBackgroundColor(QColor(240, 240, 240));
}
return;
@ -1638,7 +1361,7 @@ void HPPA::ontimerMoveYmotor()
m_xMotor->SettingSpeed(ui.xmotor_speed_slider->OriginalValue());//<2F><>ʼ<EFBFBD>ɼ<EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD>ù<EFBFBD><C3B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ٶ<EFBFBD> <20><> <20>ŵ㣺<C5B5><E3A3BA><EFBFBD><EFBFBD><EFBFBD>˲ɼ<CBB2>ʱ<EFBFBD>ٶȺ<D9B6><C8BA><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ٶ<EFBFBD>
double xMaxPositionTmp = ui.recordLine_tableWidget->item(m_numberOfRecording, 1)->text().toDouble();
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);
@ -1731,34 +1454,6 @@ void HPPA::getRequest(QString str)
QNetworkReply* reply = naManager->get(request);
}
void HPPA::onLampPowerOpen_btn()//onLampPowerOpen_btn
{
QString xx = "http://192.168.1.3/setshutter?Portname=3&Value=1";
getRequest(xx);
}
void HPPA::onLampPowerClose_btn()//onLampPowerClose_btn
{
QString xx = "http://192.168.1.3/setshutter?Portname=3&Value=0";
getRequest(xx);
}
void HPPA::onMotorPowerOpen_btn()
{
QString xx = "http://192.168.1.3/setshutter?Portname=1&Value=1";
getRequest(xx);
newMotor();
}
void HPPA::onMotorPowerClose_btn()
{
QString xx = "http://192.168.1.3/setshutter?Portname=1&Value=0";
getRequest(xx);
deleteMotor();
}
void HPPA::newMotor()
{
if (m_xMotor != nullptr && m_yMotor != nullptr)
@ -1769,6 +1464,8 @@ void HPPA::newMotor()
//<2F><><EFBFBD><EFBFBD>
m_xMotor = new VinceControl(NETTCP, 6002);//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
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);
if (imagerSelected == "mActionPica_NIR")
{
connect(m_xMotor, SIGNAL(newTCPConnection(VinceControl*)), this, SLOT(setMotorParamMicroscope(VinceControl*)));
@ -1817,10 +1514,10 @@ void HPPA::setMotorParamMicroscope(VinceControl* motor)
void HPPA::setXMotorParamFromCfgFile(VinceControl* motor)
{
float lead;//导程
float stepAnglemar;//步距角
float scaleFactor;//因机械装置的原因引入的缩放因子
int subdivisionMultiples;//细分数
float lead;
float stepAnglemar;
float scaleFactor;
int subdivisionMultiples;
float maxRange;
mConfigfile.getXMotorParm(stepAnglemar, lead, subdivisionMultiples, scaleFactor, maxRange);
@ -1835,10 +1532,10 @@ void HPPA::setXMotorParamFromCfgFile(VinceControl* motor)
void HPPA::setYMotorParamFromCfgFile(VinceControl* motor)
{
float lead;//导程
float stepAnglemar;//步距角
float scaleFactor;//因机械装置的原因引入的缩放因子
int subdivisionMultiples;//细分数
float lead;
float stepAnglemar;
float scaleFactor;
int subdivisionMultiples;
float maxRange;
mConfigfile.getYMotorParm(stepAnglemar, lead, subdivisionMultiples, scaleFactor, maxRange);
@ -1885,42 +1582,6 @@ void HPPA::requestFinished(QNetworkReply* reply) {
}
}
void HPPA::onObjectivTable1Up_btn()
{
QString xx = "http://192.168.1.253/set_up";
getRequest(xx);
}
void HPPA::onObjectivTable1Down_btn()
{
QString xx = "http://192.168.1.253/set_down";
getRequest(xx);
}
void HPPA::onObjectivTable1Stop_btn()
{
QString xx = "http://192.168.1.253/stopnow";
getRequest(xx);
}
void HPPA::onObjectivTable2Up_btn()
{
QString xx = "http://192.168.1.254/set_up";
getRequest(xx);
}
void HPPA::onObjectivTable2Down_btn()
{
QString xx = "http://192.168.1.254/set_down";
getRequest(xx);
}
void HPPA::onObjectivTable2Stop_btn()
{
QString xx = "http://192.168.1.254/stopnow";
getRequest(xx);
}
void HPPA::onExit()
{
this->close();
@ -2159,6 +1820,13 @@ void HPPA::onPlotHyperspectralImageRgbImage()
//<2F>ڽ<EFBFBD><DABD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾͼ<CABE><CDBC>
currentImageViewer[0]->SetImage(&QPixmap::fromImage(imageProcessor.Mat2QImage(rgbImageStretched)));//<2F><><EFBFBD><EFBFBD>ͼ<EFBFBD><CDBC>
//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);
//<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
//CuttedRect.setHeight(m_Imager->getFrameCounter() - 1);//<2F>ü<EFBFBD>rect

View File

@ -26,9 +26,13 @@
#include "fileOperation.h"
#include "RgbCameraOperation.h"
#include "imageProcessor.h"
#include "fileOperation.h"
#include "focusWindow.h"
#include "aboutWindow.h"
#include "adjustTable.h"
#include "PowerControl.h"
#include "PathPlan.h"
#include "hppaConfigFile.h"
#include "path_tc.h"
@ -171,7 +175,7 @@ private:
QLabel * xmotor_state_label1;
QLabel * ymotor_state_label1;
Configfile configfile;
Configfile mConfigfile;
ForLoopControl * m_ForLoopControl;
ImagerOperationBase* m_Imager;//
@ -211,10 +215,6 @@ private:
QTimer *m_timerYmotorLocationFeedBackAfterRecord;//<2F>ɼ<EFBFBD>Ӱ<EFBFBD><D3B0><EFBFBD><EFBFBD><EFBFBD>ɺ󣬽<C9BA><F3A3ACBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><CEBB>ʵʱ<CAB5><CAB1><EFBFBD>ص<EFBFBD>slider<65><72>
QString operateWidget;//<2F><>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD><EFBFBD>Ŀؼ<C4BF><D8BC><EFBFBD>
//<2F><><EFBFBD><EFBFBD>
void deleteMotor();
void newMotor();
bool isMotorConnected(VinceControl *motor);//<2F>ж<EFBFBD><D0B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7>Ͽ<EFBFBD><CFBF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ͽ<EFBFBD><CFBF><EFBFBD><EFBFBD><EFBFBD>true<75><65><EFBFBD><EFBFBD><EFBFBD>򷵻<EFBFBD>false
void SetXMotorWidgetEnable(bool enable);
@ -240,6 +240,8 @@ private:
void createActionGroups();
void selectingImager(QAction* selectedAction);
PathPlan* m_pathPlan;
public Q_SLOTS:
void onPlotHyperspectralImageRgbImage();
void PlotSpectral(int state);
@ -273,8 +275,12 @@ public Q_SLOTS:
//<2F><><EFBFBD><EFBFBD>
void deleteMotor();
void newMotor();
void timerEvent(QTimerEvent *event);
void setMotorParamMicroscope(VinceControl* motor);
void setXMotorParamFromCfgFile(VinceControl* motor);
void setYMotorParamFromCfgFile(VinceControl* motor);
void onxMotorLeft();
@ -309,14 +315,6 @@ public Q_SLOTS:
void ontimerTestRangeOfxMotor();
void ontimerTestRangeOfyMotor();
//<2F>ɼ<EFBFBD><C9BC>߹滮
void onAddRecordLine_btn();
void onRemoveRecordLine_btn();
void onGenerateRecordLine_btn();
void onDeleteRecordLine_btn();
void onSaveRecordLine2File_btn();
void onReadRecordLineFile_btn();
void ontimerMoveXmotor();
void ontimerMoveYmotor();
@ -330,21 +328,8 @@ public Q_SLOTS:
void onCopyFinished();
void onLampPowerOpen_btn();
void onLampPowerClose_btn();
void onMotorPowerOpen_btn();
void onMotorPowerClose_btn();
void requestFinished(QNetworkReply* reply);
void onObjectivTable1Up_btn();
void onObjectivTable1Down_btn();
void onObjectivTable1Stop_btn();
void onObjectivTable2Up_btn();
void onObjectivTable2Down_btn();
void onObjectivTable2Stop_btn();
signals:
void StartFocusSignal();
void StartLoopSignal();

View File

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>1592</width>
<height>1142</height>
<width>1078</width>
<height>623</height>
</rect>
</property>
<property name="windowTitle">
@ -84,7 +84,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>1592</width>
<width>1078</width>
<height>30</height>
</rect>
</property>
@ -415,617 +415,6 @@ QDockWidget::title {
</layout>
</widget>
</widget>
<widget class="QDockWidget" name="mDockWidgetAdjustTable">
<property name="styleSheet">
<string notr="true">/* 标题设置 */
QDockWidget::title {
text-align: left;
background-color: rgb(240, 240, 240);
/*padding-left: 35px;*/
}</string>
</property>
<property name="floating">
<bool>false</bool>
</property>
<property name="windowTitle">
<string>升降台</string>
</property>
<attribute name="dockWidgetArea">
<number>2</number>
</attribute>
<widget class="QWidget" name="dockWidgetContents_8">
<layout class="QGridLayout" name="gridLayout_17">
<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="spacing">
<number>0</number>
</property>
<item row="0" column="0">
<widget class="QGroupBox" name="groupBox_7">
<property name="title">
<string>1号升降台</string>
</property>
<layout class="QGridLayout" name="gridLayout_11">
<item row="0" column="0">
<widget class="QPushButton" name="objective_table1_up_btn">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>上升</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QPushButton" name="objective_table1_down_btn">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>下降</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QPushButton" name="objective_table1_stop_btn">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>停止</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="0" column="1">
<widget class="QGroupBox" name="groupBox_6">
<property name="title">
<string>2号升降台</string>
</property>
<layout class="QGridLayout" name="gridLayout_9">
<item row="0" column="0">
<widget class="QPushButton" name="objective_table2_up_btn">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>上升</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QPushButton" name="objective_table2_down_btn">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>下降</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QPushButton" name="objective_table2_stop_btn">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>停止</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
</widget>
<widget class="QDockWidget" name="mDockWidgetPowerControl">
<property name="styleSheet">
<string notr="true">/* 标题设置 */
QDockWidget::title {
text-align: left;
background-color: rgb(240, 240, 240);
/*padding-left: 35px;*/
}</string>
</property>
<property name="windowTitle">
<string>电源控制</string>
</property>
<attribute name="dockWidgetArea">
<number>2</number>
</attribute>
<widget class="QWidget" name="dockWidgetContents_7">
<layout class="QGridLayout" name="gridLayout_16">
<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="spacing">
<number>0</number>
</property>
<item row="0" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_20">
<item>
<widget class="QLabel" name="label_17">
<property name="text">
<string>卤素灯</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="lamp_power_open_btn">
<property name="text">
<string>打开</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="lamp_power_close_btn">
<property name="text">
<string>关闭</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_19">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item row="1" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_21">
<item>
<widget class="QLabel" name="label_18">
<property name="text">
<string>马 达</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="motor_power_open_btn">
<property name="text">
<string>打开</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="motor_power_close_btn">
<property name="text">
<string>关闭</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_20">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item row="2" column="0">
<spacer name="verticalSpacer_3">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>50</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</widget>
<widget class="QDockWidget" name="mDockWidgetPathPlanning">
<property name="styleSheet">
<string notr="true">/* 标题设置 */
QDockWidget::title {
text-align: left;
background-color: rgb(240, 240, 240);
/*padding-left: 35px;*/
}
</string>
</property>
<property name="windowTitle">
<string>轨迹规划</string>
</property>
<attribute name="dockWidgetArea">
<number>2</number>
</attribute>
<widget class="QWidget" name="dockWidgetContents_6">
<layout class="QGridLayout" name="gridLayout_15">
<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="spacing">
<number>0</number>
</property>
<item row="0" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_16">
<item>
<widget class="QLabel" name="label_4">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>108</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>高度</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="height_lineEdit">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>100</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="generateRecordLine_btn">
<property name="layoutDirection">
<enum>Qt::LeftToRight</enum>
</property>
<property name="text">
<string>生成轨迹</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="saveRecordLine2File_btn">
<property name="text">
<string>保存轨迹</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="1" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_17">
<item>
<widget class="QLabel" name="label_5">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>108</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>视场角</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="fov_lineEdit">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>17.6</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="deleteRecordLine_btn">
<property name="text">
<string>删除轨迹</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="readRecordLineFile_btn">
<property name="text">
<string>读取轨迹</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="2" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_18">
<item>
<widget class="QLabel" name="label_7">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>108</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>偏移</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="offset_lineEdit">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="baseSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>0</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_6">
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>幅宽</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="swath_lineEdit">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>90</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>0</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="addRecordLine_btn">
<property name="text">
<string>添加</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="3" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_19">
<item>
<widget class="QLabel" name="label_12">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>108</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>重复率(%)</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="repetitiveRate_lineEdit">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="baseSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>0</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<property name="readOnly">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_13">
<property name="text">
<string>阈值</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="LastLineThreshold_lineEdit">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>90</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>0.7</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<property name="readOnly">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="removeRecordLine_btn">
<property name="text">
<string>移除</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="4" column="0">
<widget class="QTableWidget" name="recordLine_tableWidget"/>
</item>
</layout>
</widget>
</widget>
<widget class="QDockWidget" name="mDockWidgetSpectrometer">
<property name="styleSheet">
<string notr="true">/* 标题设置 */

View File

@ -105,9 +105,12 @@
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="aboutWindow.cpp" />
<ClCompile Include="adjustTable.cpp" />
<ClCompile Include="hppaConfigFile.cpp" />
<ClCompile Include="ImagerOperationBase.cpp" />
<ClCompile Include="PathPlan.cpp" />
<ClCompile Include="path_tc.cpp" />
<ClCompile Include="PowerControl.cpp" />
<ClCompile Include="QDoubleSlider.cpp" />
<ClCompile Include="QMotorDoubleSlider.cpp" />
<ClCompile Include="resononImager.cpp" />
@ -120,6 +123,7 @@
<ClCompile Include="utility_tc.cpp" />
<QtRcc Include="HPPA.qrc" />
<QtUic Include="about.ui" />
<QtUic Include="adjustTable.ui" />
<QtUic Include="FocusDialog.ui" />
<QtUic Include="HPPA.ui" />
<QtMoc Include="HPPA.h" />
@ -133,6 +137,8 @@
<ClCompile Include="imagerSimulatioin.cpp" />
<ClCompile Include="ImageViewer.cpp" />
<ClCompile Include="main.cpp" />
<QtUic Include="PathPlan.ui" />
<QtUic Include="PowerControl.ui" />
</ItemGroup>
<ItemGroup>
<QtMoc Include="fileOperation.h" />
@ -144,6 +150,9 @@
<QtMoc Include="image2display.h" />
</ItemGroup>
<ItemGroup>
<QtMoc Include="adjustTable.h" />
<QtMoc Include="PowerControl.h" />
<QtMoc Include="PathPlan.h" />
<ClInclude Include="utility_tc.h" />
<QtMoc Include="aboutWindow.h" />
<ClInclude Include="hppaConfigFile.h" />

View File

@ -97,6 +97,15 @@
<ClCompile Include="utility_tc.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="adjustTable.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="PowerControl.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="PathPlan.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<QtMoc Include="fileOperation.h">
@ -135,6 +144,15 @@
<QtMoc Include="ImagerOperationBase.h">
<Filter>Header Files</Filter>
</QtMoc>
<QtMoc Include="adjustTable.h">
<Filter>Header Files</Filter>
</QtMoc>
<QtMoc Include="PowerControl.h">
<Filter>Header Files</Filter>
</QtMoc>
<QtMoc Include="PathPlan.h">
<Filter>Header Files</Filter>
</QtMoc>
</ItemGroup>
<ItemGroup>
<ClInclude Include="imageProcessor.h">
@ -169,6 +187,15 @@
<QtUic Include="about.ui">
<Filter>Form Files</Filter>
</QtUic>
<QtUic Include="adjustTable.ui">
<Filter>Form Files</Filter>
</QtUic>
<QtUic Include="PowerControl.ui">
<Filter>Form Files</Filter>
</QtUic>
<QtUic Include="PathPlan.ui">
<Filter>Form Files</Filter>
</QtUic>
</ItemGroup>
<ItemGroup>
<None Include="cpp.hint" />

308
HPPA/PathPlan.cpp Normal file
View File

@ -0,0 +1,308 @@
#include "PathPlan.h"
#include <iostream>
#include <QMessageBox>
#include <QFileDialog>
#include <fileOperation.h>
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)");//<2F><><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD>и<EFBFBD><D0B8><EFBFBD>
ui.recordLine_tableWidget->setSelectionBehavior(QAbstractItemView::SelectRows);//<2F><><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>λ
//ui.recordLine_tableWidget->setSelectionMode(QAbstractItemView::SingleSelection);//<2F><><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1>ģʽ<C4A3><CABD>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
//QHeaderView* headerView = ui.recordLine_tableWidget->verticalHeader();
//headerView->setHidden(true);//ȥ<><C8A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ĭ<EFBFBD><C4AC><EFBFBD>Դ<EFBFBD><D4B4><EFBFBD><EFBFBD>к<EFBFBD>
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()
{
//׼<><D7BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
ByteBack MotorState = m_yMotor->GetState();
double currentPosOfYmotor = m_ySlider->getDistanceFromPulse(MotorState.Location);
double maxRangeOfXmotro = m_xSlider->maximum();
//<2F><>ȡѡ<C8A1><D1A1><EFBFBD>е<EFBFBD><D0B5><EFBFBD><EFBFBD><EFBFBD>
int currentRow = ui.recordLine_tableWidget->currentRow();
std::cout << "currentRow<EFBFBD><EFBFBD>" << 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)//<2F><>û<EFBFBD><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD>ʱ
{
int RowCount = ui.recordLine_tableWidget->rowCount();//Returns the number of rows. <20><>1<EFBFBD><31>ʼ<EFBFBD><CABC>
ui.recordLine_tableWidget->insertRow(RowCount);//<2F><><EFBFBD><EFBFBD>һ<EFBFBD>У<EFBFBD><D0A3>β<EFBFBD><CEB2>Ǵ<EFBFBD>0<EFBFBD><30>ʼ<EFBFBD><CABC>
ui.recordLine_tableWidget->setItem(RowCount, 0, Item1);
ui.recordLine_tableWidget->setItem(RowCount, 1, Item2);
}
else
{
ui.recordLine_tableWidget->insertRow(currentRow + 1);//<2F><><EFBFBD><EFBFBD>һ<EFBFBD>У<EFBFBD><D0A3>β<EFBFBD><CEB2>Ǵ<EFBFBD>0<EFBFBD><30>ʼ<EFBFBD><CABC>
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()
{
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
double height = ui.height_lineEdit->text().toDouble();
double fov = ui.fov_lineEdit->text().toDouble();
double swath = (height * tan(fov / 2 * PI / 180)) * 2;//tan<61><6E><EFBFBD><EFBFBD><EFBFBD>ǻ<EFBFBD><C7BB><EFBFBD>
ui.swath_lineEdit->setText(QString::number(swath));
//<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Χ
double xMotorRange = m_xSlider->maximum();
double yMotorRange = m_ySlider->maximum();
//ȷ<><C8B7><EFBFBD>ж<EFBFBD><D0B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɼ<EFBFBD><C9BC>ߣ<EFBFBD><DFA3><EFBFBD>ʽ<EFBFBD><CABD>numberOfRecordLine_tmp * swath - repetitiveLength<74><68>numberOfRecordLine_tmp - 1<><31> = 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();//<2F><>numberOfRecordLine_tmpΪС<CEAA><D0A1>ʱ<EFBFBD><CAB1><EFBFBD>ж<EFBFBD><D0B6>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD>ɼ<EFBFBD><C9BC><EFBFBD>
if (tmp > threshold)
{
numberOfRecordLine = (int)numberOfRecordLine_tmp + 1;
//std::cout << "<22><><EFBFBD>ڣ<EFBFBD>" << threshold << std::endl;
}
else
{
numberOfRecordLine = (int)numberOfRecordLine_tmp;
}
//ȥ<><C8A5>tableWidget<65><74><EFBFBD><EFBFBD><EFBFBD>е<EFBFBD><D0B5><EFBFBD>
int rowCount = ui.recordLine_tableWidget->rowCount();
for (size_t i = 0; i < rowCount; i++)
{
ui.recordLine_tableWidget->removeRow(0);
}
//<2F><>tableWidget<65><74><EFBFBD><EFBFBD><EFBFBD>У<EFBFBD><D0A3>ɼ<EFBFBD><C9BC>ߣ<EFBFBD>
QTableWidgetItem* tmpItem;
for (size_t i = 0; i < numberOfRecordLine; i++)
{
//<2F><><EFBFBD><EFBFBD>һ<EFBFBD><D2BB>
int RowCount = ui.recordLine_tableWidget->rowCount();
ui.recordLine_tableWidget->insertRow(RowCount);
//<2F><><EFBFBD><EFBFBD>yPosition
if (tmp > threshold && i == numberOfRecordLine - 1)//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD>е<EFBFBD>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);
}
//<2F><><EFBFBD><EFBFBD>x<EFBFBD><78><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˶<EFBFBD>λ<EFBFBD><CEBB> <20><> ֵ<><D6B5><EFBFBD><EFBFBD>Ϊx<CEAA><78><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
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()
{
//ȷ<><C8B7><EFBFBD>ɼ<EFBFBD><C9BC>ߴ<EFBFBD><DFB4><EFBFBD>
if (ui.recordLine_tableWidget->rowCount() <= 0)
{
QMessageBox::information(this, QString::fromLocal8Bit("<EFBFBD><EFBFBD>ʾ"), QString::fromLocal8Bit("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɹ켣<EFBFBD><EFBFBD>"));
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("<EFBFBD><EFBFBD>ʾ"), QString::fromLocal8Bit("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD><EFBFBD><EFBFBD>"));
}
void PathPlan::onReadRecordLineFile_btn()
{
//<2F><><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>
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(), "r");
double height, fov, swath, offset, repetitiveRate, LastLineThreshold, number;
//<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>
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;
}
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>д
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));
//<2F><>tableWidget<65><74><EFBFBD>Ӳɼ<D3B2><C9BC><EFBFBD>
//<2F><>1<EFBFBD><31>ȥ<EFBFBD><C8A5>tableWidget<65><74><EFBFBD><EFBFBD><EFBFBD>е<EFBFBD><D0B5><EFBFBD>
int rowCount = ui.recordLine_tableWidget->rowCount();
for (size_t i = 0; i < rowCount; i++)
{
ui.recordLine_tableWidget->removeRow(0);
}
//<2F><>2<EFBFBD><32><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>У<EFBFBD><D0A3>ɼ<EFBFBD><C9BC>ߣ<EFBFBD>
int RecordLineCount = number / ui.recordLine_tableWidget->columnCount();
for (size_t i = 0; i < RecordLineCount; i++)
{
ui.recordLine_tableWidget->insertRow(0);
}
//<2F><>3<EFBFBD><33><EFBFBD><EFBFBD>tableWidget<65><74><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
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, 2));
tmp->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
ui.recordLine_tableWidget->setItem(i, j, tmp);
}
}
fclose(RecordLineFileHandle);
delete[] data;
QMessageBox::information(this, QString::fromLocal8Bit("<EFBFBD><EFBFBD>ʾ"), QString::fromLocal8Bit("<EFBFBD><EFBFBD>ȡ<EFBFBD>ɹ<EFBFBD><EFBFBD><EFBFBD>"));
}

37
HPPA/PathPlan.h Normal file
View File

@ -0,0 +1,37 @@
#pragma once
#include <QDialog>
#include "ui_PathPlan.h"
#include "vincecontrol.h"
#include <QMotorDoubleSlider.h>
#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();
};

362
HPPA/PathPlan.ui Normal file
View File

@ -0,0 +1,362 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>PathPlanClass</class>
<widget class="QDialog" name="PathPlanClass">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>566</width>
<height>273</height>
</rect>
</property>
<property name="windowTitle">
<string>PathPlan</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<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="spacing">
<number>0</number>
</property>
<item row="0" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_16">
<item>
<widget class="QLabel" name="label_4">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>108</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>高度</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="height_lineEdit">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>100</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="generateRecordLine_btn">
<property name="layoutDirection">
<enum>Qt::LeftToRight</enum>
</property>
<property name="text">
<string>生成轨迹</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="saveRecordLine2File_btn">
<property name="text">
<string>保存轨迹</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="1" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_17">
<item>
<widget class="QLabel" name="label_5">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>108</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>视场角</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="fov_lineEdit">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>17.6</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="deleteRecordLine_btn">
<property name="text">
<string>删除轨迹</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="readRecordLineFile_btn">
<property name="text">
<string>读取轨迹</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="2" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_18">
<item>
<widget class="QLabel" name="label_7">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>108</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>偏移</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="offset_lineEdit">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="baseSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>0</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_6">
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>幅宽</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="swath_lineEdit">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>90</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>0</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="addRecordLine_btn">
<property name="text">
<string>添加</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="3" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_19">
<item>
<widget class="QLabel" name="label_12">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>108</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>重复率(%)</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="repetitiveRate_lineEdit">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="baseSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>0</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<property name="readOnly">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_13">
<property name="text">
<string>阈值</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="LastLineThreshold_lineEdit">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>90</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>0.7</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<property name="readOnly">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="removeRecordLine_btn">
<property name="text">
<string>移除</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="4" column="0">
<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/>
<connections/>
</ui>

55
HPPA/PowerControl.cpp Normal file
View File

@ -0,0 +1,55 @@
#include "PowerControl.h"
PowerControl::PowerControl(QWidget *parent)
: QDialog(parent)
{
ui.setupUi(this);
connect(ui.lamp_power_open_btn, SIGNAL(clicked()), this, SLOT(onLampPowerOpen_btn()));
connect(ui.lamp_power_close_btn, SIGNAL(clicked()), this, SLOT(onLampPowerClose_btn()));
connect(ui.motor_power_open_btn, SIGNAL(clicked()), this, SLOT(onMotorPowerOpen_btn()));
connect(ui.motor_power_close_btn, SIGNAL(clicked()), this, SLOT(onMotorPowerClose_btn()));
}
PowerControl::~PowerControl()
{}
void PowerControl::getRequest(QString str)
{
QNetworkRequest request;
QNetworkAccessManager* naManager = new QNetworkAccessManager(this);
QMetaObject::Connection connRet = QObject::connect(naManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(requestFinished(QNetworkReply*)));
Q_ASSERT(connRet);
request.setUrl(QUrl(str));
QNetworkReply* reply = naManager->get(request);
}
void PowerControl::onLampPowerOpen_btn()//onLampPowerOpen_btn
{
QString xx = "http://192.168.1.3/setshutter?Portname=3&Value=1";
getRequest(xx);
}
void PowerControl::onLampPowerClose_btn()//onLampPowerClose_btn
{
QString xx = "http://192.168.1.3/setshutter?Portname=3&Value=0";
getRequest(xx);
}
void PowerControl::onMotorPowerOpen_btn()
{
QString xx = "http://192.168.1.3/setshutter?Portname=1&Value=1";
getRequest(xx);
emit powerOpened();
}
void PowerControl::onMotorPowerClose_btn()
{
QString xx = "http://192.168.1.3/setshutter?Portname=1&Value=0";
getRequest(xx);
emit powerClosed();
}

33
HPPA/PowerControl.h Normal file
View File

@ -0,0 +1,33 @@
#pragma once
#include <QDialog>
#include <QNetworkRequest>
#include <QNetworkReply>
#include <QNetworkAccessManager>
#include "ui_PowerControl.h"
class PowerControl : public QDialog
{
Q_OBJECT
public:
PowerControl(QWidget *parent = nullptr);
~PowerControl();
public Q_SLOTS:
void onLampPowerOpen_btn();
void onLampPowerClose_btn();
void onMotorPowerOpen_btn();
void onMotorPowerClose_btn();
signals:
void powerOpened();
void powerClosed();
private:
Ui::PowerControlClass ui;
void getRequest(QString str);
};

126
HPPA/PowerControl.ui Normal file
View File

@ -0,0 +1,126 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>PowerControlClass</class>
<widget class="QDialog" name="PowerControlClass">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>294</width>
<height>119</height>
</rect>
</property>
<property name="windowTitle">
<string>PowerControl</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<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="spacing">
<number>0</number>
</property>
<item row="0" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_20">
<item>
<widget class="QLabel" name="label_17">
<property name="text">
<string>卤素灯</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="lamp_power_open_btn">
<property name="text">
<string>打开</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="lamp_power_close_btn">
<property name="text">
<string>关闭</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_19">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item row="1" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_21">
<item>
<widget class="QLabel" name="label_18">
<property name="text">
<string>马 达</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="motor_power_open_btn">
<property name="text">
<string>打开</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="motor_power_close_btn">
<property name="text">
<string>关闭</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_20">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item row="2" column="0">
<spacer name="verticalSpacer_3">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>42</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<layoutdefault spacing="6" margin="11"/>
<resources/>
<connections/>
</ui>

View File

@ -180,13 +180,10 @@ void ResononNirImager::focus()
imagerStopCollect();
//reConnectImage();
Sleep(20);
setFramerate(tmpFrmerate);//Ϊɶ<CEAA><C9B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>֡<EFBFBD><D6A1>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڽ<EFBFBD><DABD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>϶<EFBFBD><CFB6><EFBFBD><EFBFBD><EFBFBD>֡<EFBFBD>ʾͲ<CABE><CDB2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
reConnectImage();
setIntegrationTime(tmpIntegrationTime);
setFramerate(tmpFrmerate);//<2F><><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFA3AC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFA3AC><EFBFBD>д<EFBFBD><D0B4><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
}
void ResononNirImager::record_dark()

65
HPPA/adjustTable.cpp Normal file
View File

@ -0,0 +1,65 @@
#include "adjustTable.h"
adjustTable::adjustTable(QWidget *parent)
: QDialog(parent)
{
ui.setupUi(this);
connect(ui.objective_table1_up_btn, SIGNAL(clicked()), this, SLOT(onObjectivTable1Up_btn()));
connect(ui.objective_table1_down_btn, SIGNAL(clicked()), this, SLOT(onObjectivTable1Down_btn()));
connect(ui.objective_table1_stop_btn, SIGNAL(clicked()), this, SLOT(onObjectivTable1Stop_btn()));
connect(ui.objective_table2_up_btn, SIGNAL(clicked()), this, SLOT(onObjectivTable2Up_btn()));
connect(ui.objective_table2_down_btn, SIGNAL(clicked()), this, SLOT(onObjectivTable2Down_btn()));
connect(ui.objective_table2_stop_btn, SIGNAL(clicked()), this, SLOT(onObjectivTable2Stop_btn()));
}
adjustTable::~adjustTable()
{}
void adjustTable::getRequest(QString str)
{
QNetworkRequest request;
QNetworkAccessManager* naManager = new QNetworkAccessManager(this);
QMetaObject::Connection connRet = QObject::connect(naManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(requestFinished(QNetworkReply*)));
Q_ASSERT(connRet);
request.setUrl(QUrl(str));
QNetworkReply* reply = naManager->get(request);
}
void adjustTable::onObjectivTable1Up_btn()
{
QString xx = "http://192.168.1.253/set_up";
getRequest(xx);
}
void adjustTable::onObjectivTable1Down_btn()
{
QString xx = "http://192.168.1.253/set_down";
getRequest(xx);
}
void adjustTable::onObjectivTable1Stop_btn()
{
QString xx = "http://192.168.1.253/stopnow";
getRequest(xx);
}
void adjustTable::onObjectivTable2Up_btn()
{
QString xx = "http://192.168.1.254/set_up";
getRequest(xx);
}
void adjustTable::onObjectivTable2Down_btn()
{
QString xx = "http://192.168.1.254/set_down";
getRequest(xx);
}
void adjustTable::onObjectivTable2Stop_btn()
{
QString xx = "http://192.168.1.254/stopnow";
getRequest(xx);
}

31
HPPA/adjustTable.h Normal file
View File

@ -0,0 +1,31 @@
#pragma once
#include <QDialog>
#include <QNetworkRequest>
#include <QNetworkReply>
#include <QNetworkAccessManager>
#include "ui_adjustTable.h"
class adjustTable : public QDialog
{
Q_OBJECT
public:
adjustTable(QWidget *parent = nullptr);
~adjustTable();
public Q_SLOTS:
void onObjectivTable1Up_btn();
void onObjectivTable1Down_btn();
void onObjectivTable1Stop_btn();
void onObjectivTable2Up_btn();
void onObjectivTable2Down_btn();
void onObjectivTable2Stop_btn();
private:
Ui::adjustTableClass ui;
void getRequest(QString str);
};

133
HPPA/adjustTable.ui Normal file
View File

@ -0,0 +1,133 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>adjustTableClass</class>
<widget class="QDialog" name="adjustTableClass">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>348</width>
<height>194</height>
</rect>
</property>
<property name="windowTitle">
<string>adjustTable</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<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="spacing">
<number>0</number>
</property>
<item row="0" column="0">
<widget class="QGroupBox" name="groupBox_7">
<property name="title">
<string>1号升降台</string>
</property>
<layout class="QGridLayout" name="gridLayout_11">
<item row="0" column="0">
<widget class="QPushButton" name="objective_table1_up_btn">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>上升</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QPushButton" name="objective_table1_down_btn">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>下降</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QPushButton" name="objective_table1_stop_btn">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>停止</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="0" column="1">
<widget class="QGroupBox" name="groupBox_6">
<property name="title">
<string>2号升降台</string>
</property>
<layout class="QGridLayout" name="gridLayout_9">
<item row="0" column="0">
<widget class="QPushButton" name="objective_table2_up_btn">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>上升</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QPushButton" name="objective_table2_down_btn">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>下降</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QPushButton" name="objective_table2_stop_btn">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>停止</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<layoutdefault spacing="6" margin="11"/>
<resources/>
<connections/>
</ui>

View File

@ -16,6 +16,7 @@ std::vector<cv::Point2f> ImageProcessor::CHistogram(const cv::Mat img)
int rows = mimg.rows;
int cols = mimg.cols;
int maxValue = *std::max_element(mimg.begin<unsigned short>(), mimg.end<unsigned short>());
maxValue = 65535;
//ͳ<><CDB3>ÿ<EFBFBD><C3BF><EFBFBD>Ҷȳ<D2B6><C8B3>ֵĴ<D6B5><C4B4><EFBFBD>
std::vector<long int> hisnum(maxValue, 0);//<2F><><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><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
for (int i(0); i < rows; ++i)