Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 20848bef1a | |||
| f6138dd2ed | |||
| f32ade7487 | |||
| 89c701c5f2 | |||
| a7fd9e4fa9 |
262
HPPA/HPPA.cpp
262
HPPA/HPPA.cpp
@ -13,6 +13,10 @@ HPPA::HPPA(QWidget *parent)
|
|||||||
{
|
{
|
||||||
ui.setupUi(this);
|
ui.setupUi(this);
|
||||||
|
|
||||||
|
QCoreApplication::setOrganizationName("IRIS");
|
||||||
|
QCoreApplication::setOrganizationDomain("iris.com");
|
||||||
|
QCoreApplication::setApplicationName("HPPA");
|
||||||
|
|
||||||
QString strPath = QCoreApplication::applicationDirPath() + "/UILayout.ini";
|
QString strPath = QCoreApplication::applicationDirPath() + "/UILayout.ini";
|
||||||
QFile file(strPath);
|
QFile file(strPath);
|
||||||
if (file.open(QIODevice::ReadOnly)) {
|
if (file.open(QIODevice::ReadOnly)) {
|
||||||
@ -263,7 +267,8 @@ HPPA::HPPA(QWidget *parent)
|
|||||||
//<2F>켣<EFBFBD>滮
|
//<2F>켣<EFBFBD>滮
|
||||||
m_pathPlan = new PathPlan(m_xMotor, m_yMotor, ui.xmotor_location_slider, ui.ymotor_location_slider);
|
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);
|
QDockWidget* dock_pathPlan = new QDockWidget(QString::fromLocal8Bit("<EFBFBD>켣<EFBFBD>滮"), this);
|
||||||
dock_pathPlan->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
|
dock_pathPlan->setObjectName("mDockPathPlan");
|
||||||
|
dock_pathPlan->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea | Qt::TopDockWidgetArea | Qt::BottomDockWidgetArea);
|
||||||
dock_pathPlan->setWidget(m_pathPlan);
|
dock_pathPlan->setWidget(m_pathPlan);
|
||||||
tabifyDockWidget(ui.mDockWidgetLinearStage, dock_pathPlan);
|
tabifyDockWidget(ui.mDockWidgetLinearStage, dock_pathPlan);
|
||||||
mPanelMenu->addAction(dock_pathPlan->toggleViewAction());
|
mPanelMenu->addAction(dock_pathPlan->toggleViewAction());
|
||||||
@ -272,6 +277,7 @@ HPPA::HPPA(QWidget *parent)
|
|||||||
adjustTable* adt = new adjustTable();
|
adjustTable* adt = new adjustTable();
|
||||||
|
|
||||||
QDockWidget* dock_adt = new QDockWidget(QString::fromLocal8Bit("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"), this);
|
QDockWidget* dock_adt = new QDockWidget(QString::fromLocal8Bit("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"), this);
|
||||||
|
dock_adt->setObjectName("mDockAdjustTable");
|
||||||
dock_adt->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
|
dock_adt->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
|
||||||
dock_adt->setWidget(adt);
|
dock_adt->setWidget(adt);
|
||||||
tabifyDockWidget(dock_pathPlan, dock_adt);
|
tabifyDockWidget(dock_pathPlan, dock_adt);
|
||||||
@ -281,6 +287,7 @@ HPPA::HPPA(QWidget *parent)
|
|||||||
PowerControl* pc = new PowerControl();
|
PowerControl* pc = new PowerControl();
|
||||||
|
|
||||||
QDockWidget* dock_pc = new QDockWidget(QString::fromLocal8Bit("<EFBFBD><EFBFBD>Դ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>"), this);
|
QDockWidget* dock_pc = new QDockWidget(QString::fromLocal8Bit("<EFBFBD><EFBFBD>Դ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>"), this);
|
||||||
|
dock_pc->setObjectName("mDockPowerControl");
|
||||||
dock_pc->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
|
dock_pc->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
|
||||||
dock_pc->setWidget(pc);
|
dock_pc->setWidget(pc);
|
||||||
tabifyDockWidget(dock_adt, dock_pc);
|
tabifyDockWidget(dock_adt, dock_pc);
|
||||||
@ -288,8 +295,50 @@ HPPA::HPPA(QWidget *parent)
|
|||||||
connect(pc, &PowerControl::powerOpened, this, &HPPA::newMotor);
|
connect(pc, &PowerControl::powerOpened, this, &HPPA::newMotor);
|
||||||
connect(pc, &PowerControl::powerClosed, this, &HPPA::deleteMotor);
|
connect(pc, &PowerControl::powerClosed, this, &HPPA::deleteMotor);
|
||||||
|
|
||||||
|
//<2F><>е<EFBFBD>ۿ<EFBFBD><DBBF><EFBFBD>
|
||||||
|
rac = new RobotArmControl();
|
||||||
|
connect(rac->robotController, SIGNAL(hsiRecordSignal(int)), this, SLOT(recordFromRobotArm(int)));
|
||||||
|
QDockWidget* dock_rac = new QDockWidget(QString::fromLocal8Bit("<EFBFBD><EFBFBD>е<EFBFBD>ۿ<EFBFBD><EFBFBD><EFBFBD>"), this);
|
||||||
|
dock_rac->setObjectName("mDockRobotArmControl");
|
||||||
|
dock_rac->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
|
||||||
|
dock_rac->setWidget(rac);
|
||||||
|
tabifyDockWidget(dock_adt, dock_rac);
|
||||||
|
mPanelMenu->addAction(dock_rac->toggleViewAction());
|
||||||
|
|
||||||
createActionGroups();
|
createActionGroups();
|
||||||
connect(mImagerGroup, &QActionGroup::triggered, this, &HPPA::selectingImager);
|
connect(mImagerGroup, &QActionGroup::triggered, this, &HPPA::selectingImager);
|
||||||
|
|
||||||
|
createMoveplatformActionGroup();
|
||||||
|
connect(moveplatformActionGroup, &QActionGroup::triggered, this, &HPPA::selectingMoveplatform);
|
||||||
|
}
|
||||||
|
|
||||||
|
void HPPA::recordFromRobotArm(int fileCounter)
|
||||||
|
{
|
||||||
|
qDebug() << "recordFromRobotArm" << fileCounter;
|
||||||
|
|
||||||
|
if (fileCounter == -1)
|
||||||
|
{
|
||||||
|
m_Imager->setRecordControlState(false);
|
||||||
|
|
||||||
|
ui.action_start_recording->setText(QString::fromLocal8Bit("<EFBFBD>ɼ<EFBFBD>"));
|
||||||
|
ui.mainToolBar->widgetForAction(ui.action_start_recording)->setStyleSheet("QWidget{background-color:rgb(0,255,0);}");
|
||||||
|
qDebug() << "recordFromRobotArm: 1111111111111111111111";
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (fileCounter - 1 == 0)
|
||||||
|
{
|
||||||
|
ui.ImageViewerTabWidget->clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
onCreateTab(fileCounter-1);
|
||||||
|
m_numberOfRecording = fileCounter - 1;
|
||||||
|
emit StartRecordSignal();
|
||||||
|
|
||||||
|
ui.action_start_recording->setText(QString::fromLocal8Bit("<EFBFBD>ɼ<EFBFBD><EFBFBD><EFBFBD>"));
|
||||||
|
ui.mainToolBar->widgetForAction(ui.action_start_recording)->setStyleSheet("QWidget{background-color:rgb(255,0,0);}");
|
||||||
|
qDebug() << "recordFromRobotArm: 2222222222222222222222";
|
||||||
}
|
}
|
||||||
|
|
||||||
void HPPA::createActionGroups()
|
void HPPA::createActionGroups()
|
||||||
@ -301,13 +350,69 @@ void HPPA::createActionGroups()
|
|||||||
mImagerGroup->addAction(ui.mActionCorning_410);
|
mImagerGroup->addAction(ui.mActionCorning_410);
|
||||||
mImagerGroup->addAction(ui.mActionPica_NIR);
|
mImagerGroup->addAction(ui.mActionPica_NIR);
|
||||||
|
|
||||||
|
|
||||||
|
// <20><>ȡ<EFBFBD>ϴ<EFBFBD>ѡ<EFBFBD><D1A1><EFBFBD>Ľ<EFBFBD><C4BD><EFBFBD>
|
||||||
|
QSettings settings;
|
||||||
|
QString lastSelectedAction = settings.value("LastSelectedImagerAction").toString();
|
||||||
|
|
||||||
|
// <20>ָ<EFBFBD><D6B8>ϴ<EFBFBD>ѡ<EFBFBD><D1A1><EFBFBD>Ľ<EFBFBD><C4BD><EFBFBD>
|
||||||
|
if (lastSelectedAction == "mActionPica_L")
|
||||||
|
{
|
||||||
|
ui.mActionPica_L->setChecked(true);
|
||||||
|
}
|
||||||
|
else if (lastSelectedAction == "mActionPica_NIR")
|
||||||
|
{
|
||||||
ui.mActionPica_NIR->setChecked(true);
|
ui.mActionPica_NIR->setChecked(true);
|
||||||
imagerSelected = ui.mActionPica_NIR->objectName();
|
}
|
||||||
|
else if (lastSelectedAction == "mActionPika_XC2")
|
||||||
|
{
|
||||||
|
ui.mActionPika_XC2->setChecked(true);
|
||||||
|
}
|
||||||
|
else if (lastSelectedAction == "mActionCorning_410")
|
||||||
|
{
|
||||||
|
ui.mActionCorning_410->setChecked(true);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void HPPA::selectingImager(QAction* selectedAction)
|
void HPPA::selectingImager(QAction* selectedAction)
|
||||||
{
|
{
|
||||||
imagerSelected = selectedAction->objectName();
|
QSettings settings;
|
||||||
|
settings.setValue("LastSelectedImagerAction", selectedAction->objectName());
|
||||||
|
settings.sync();
|
||||||
|
}
|
||||||
|
|
||||||
|
void HPPA::createMoveplatformActionGroup()
|
||||||
|
{
|
||||||
|
moveplatformActionGroup = new QActionGroup(this);
|
||||||
|
moveplatformActionGroup->addAction(ui.mAction_is_no_motor);
|
||||||
|
moveplatformActionGroup->addAction(ui.mAction_2AxisMotor);
|
||||||
|
moveplatformActionGroup->addAction(ui.mAction_RobotArm);
|
||||||
|
|
||||||
|
// <20><>ȡ<EFBFBD>ϴ<EFBFBD>ѡ<EFBFBD><D1A1><EFBFBD>Ľ<EFBFBD><C4BD><EFBFBD>
|
||||||
|
QSettings settings;
|
||||||
|
QString lastSelectedAction = settings.value("LastSelectedMoveplatform").toString();
|
||||||
|
|
||||||
|
// <20>ָ<EFBFBD><D6B8>ϴ<EFBFBD>ѡ<EFBFBD><D1A1><EFBFBD>Ľ<EFBFBD><C4BD><EFBFBD>
|
||||||
|
if (lastSelectedAction == "mAction_is_no_motor")
|
||||||
|
{
|
||||||
|
ui.mAction_is_no_motor->setChecked(true);
|
||||||
|
}
|
||||||
|
else if (lastSelectedAction == "mAction_2AxisMotor")
|
||||||
|
{
|
||||||
|
ui.mAction_2AxisMotor->setChecked(true);
|
||||||
|
}
|
||||||
|
else if (lastSelectedAction == "mAction_RobotArm")
|
||||||
|
{
|
||||||
|
ui.mAction_RobotArm->setChecked(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void HPPA::selectingMoveplatform(QAction* selectedAction)
|
||||||
|
{
|
||||||
|
QSettings settings;
|
||||||
|
settings.setValue("LastSelectedMoveplatform", selectedAction->objectName());
|
||||||
|
settings.sync();
|
||||||
}
|
}
|
||||||
|
|
||||||
HPPA::~HPPA()
|
HPPA::~HPPA()
|
||||||
@ -373,25 +478,68 @@ void HPPA::CalculateIntegratioinTimeRange()
|
|||||||
|
|
||||||
void HPPA::onStartRecordStep1()
|
void HPPA::onStartRecordStep1()
|
||||||
{
|
{
|
||||||
////<2F><><EFBFBD>Դ<EFBFBD><D4B4>룬<EFBFBD><EBA3AC><EFBFBD><EFBFBD>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD>ɼ<EFBFBD><C9BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
QAction* checked = moveplatformActionGroup->checkedAction();
|
||||||
//m_RecordState += 1;
|
if (!checked)
|
||||||
|
{
|
||||||
|
QMessageBox msgBox;
|
||||||
|
msgBox.setText(QString::fromLocal8Bit("<EFBFBD><EFBFBD>ѡ<EFBFBD><EFBFBD>ɨ<EFBFBD><EFBFBD>ƽ̨<EFBFBD><EFBFBD>"));
|
||||||
|
msgBox.exec();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
//if (m_RecordState % 2 == 1)
|
//<EFBFBD>ж<EFBFBD><EFBFBD>ǷǴ<EFBFBD><EFBFBD>ڵ<EFBFBD><EFBFBD>ļ<EFBFBD>
|
||||||
//{
|
FileOperation* fileOperation = new FileOperation();
|
||||||
// onCreateTab(1);
|
string directory = fileOperation->getDirectoryFromString();
|
||||||
// m_numberOfRecording = 0;
|
//string imgPath = directory + "\\tmp_image";
|
||||||
// m_Imager->setFileName2Save(m_FilenameLineEdit->text().toStdString());
|
string imgPath = directory + "\\" + m_FilenameLineEdit->text().toStdString();
|
||||||
// emit StartRecordSignal();//<2F><><EFBFBD>俪ʼ<E4BFAA>ɼ<EFBFBD><C9BC>ź<EFBFBD>
|
int x = _access(imgPath.c_str(), 0);
|
||||||
//}
|
if (!x)//<2F><><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD>ھ<EFBFBD>ִ<EFBFBD>д<EFBFBD>if<69>Ĵ<EFBFBD><C4B4><EFBFBD>
|
||||||
//else
|
{
|
||||||
//{
|
enum QMessageBox::StandardButton response = QMessageBox::question(this, QString::fromLocal8Bit("<EFBFBD><EFBFBD>ʾ"), QString::fromLocal8Bit("<EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڣ<EFBFBD><EFBFBD>Ƿǣ<EFBFBD>"), QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes);;
|
||||||
// m_Imager->setRecordControlState(false);//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֹͣ<CDA3>ɼ<EFBFBD>
|
if (response == QMessageBox::Yes)//
|
||||||
|
{
|
||||||
|
//std::cout << "<22><><EFBFBD><EFBFBD>" << std::endl;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//std::cout << "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>" << std::endl;
|
||||||
|
//m_RecordState -= 1;//<2F><><EFBFBD><EFBFBD><EFBFBD>ǵĻ<C7B5><C4BB><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA>ԭ<EFBFBD><D4AD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֹͣ<CDA3>ɼ<EFBFBD>
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// ui.action_start_recording->setText(QString::fromLocal8Bit("<22>ɼ<EFBFBD>"));
|
m_Imager->setFrameNumber(this->frame_number->text().toInt());
|
||||||
// ui.mainToolBar->widgetForAction(ui.action_start_recording)->setStyleSheet("QWidget{background-color:rgb(0,255,0);}");
|
m_Imager->setFileName2Save(imgPath);
|
||||||
//}
|
|
||||||
|
|
||||||
|
QString checkedName = checked->objectName();
|
||||||
|
|
||||||
|
if (checkedName == "mAction_is_no_motor")
|
||||||
|
{
|
||||||
|
m_RecordState += 1;
|
||||||
|
|
||||||
|
if (m_RecordState % 2 == 1)
|
||||||
|
{
|
||||||
|
ui.ImageViewerTabWidget->clear();
|
||||||
|
|
||||||
|
onCreateTab(0);
|
||||||
|
m_numberOfRecording = 0;
|
||||||
|
|
||||||
|
emit StartRecordSignal();//<2F><><EFBFBD>俪ʼ<E4BFAA>ɼ<EFBFBD><C9BC>ź<EFBFBD>
|
||||||
|
|
||||||
|
ui.action_start_recording->setText(QString::fromLocal8Bit("ֹͣ<EFBFBD>ɼ<EFBFBD>"));
|
||||||
|
ui.mainToolBar->widgetForAction(ui.action_start_recording)->setStyleSheet("QWidget{background-color:rgb(255,0,0);}");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_Imager->setRecordControlState(false);//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֹͣ<CDA3>ɼ<EFBFBD>
|
||||||
|
|
||||||
|
ui.action_start_recording->setText(QString::fromLocal8Bit("<EFBFBD>ɼ<EFBFBD>"));
|
||||||
|
ui.mainToolBar->widgetForAction(ui.action_start_recording)->setStyleSheet("QWidget{background-color:rgb(0,255,0);}");
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else if (checkedName == "mAction_2AxisMotor")
|
||||||
|
{
|
||||||
//ȷ<><C8B7>x<EFBFBD><78><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><CEBB> С<><D0A1> x<><78><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɼ<EFBFBD><C9BC><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><CEBB>
|
//ȷ<><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;
|
int validLineCount = 0;
|
||||||
for (size_t i = 0; i < m_pathPlan->getRecordLineTableWidget()->rowCount(); i++)
|
for (size_t i = 0; i < m_pathPlan->getRecordLineTableWidget()->rowCount(); i++)
|
||||||
@ -423,39 +571,14 @@ void HPPA::onStartRecordStep1()
|
|||||||
|
|
||||||
if (m_RecordState % 2 == 1)
|
if (m_RecordState % 2 == 1)
|
||||||
{
|
{
|
||||||
//<2F>ж<EFBFBD><D0B6>ǷǴ<F1B8B2B8><C7B4>ڵ<EFBFBD><DAB5>ļ<EFBFBD>
|
|
||||||
FileOperation * fileOperation = new FileOperation();
|
|
||||||
string directory = fileOperation->getDirectoryFromString();
|
|
||||||
//string imgPath = directory + "\\tmp_image";
|
|
||||||
string imgPath = directory + "\\" + m_FilenameLineEdit->text().toStdString() + "_" + std::to_string(1);
|
|
||||||
int x = _access(imgPath.c_str(), 0);
|
|
||||||
if (!x)//<2F><><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD>ھ<EFBFBD>ִ<EFBFBD>д<EFBFBD>if<69>Ĵ<EFBFBD><C4B4><EFBFBD>
|
|
||||||
{
|
|
||||||
enum QMessageBox::StandardButton response = QMessageBox::question(this, QString::fromLocal8Bit("<EFBFBD><EFBFBD>ʾ"), QString::fromLocal8Bit("<EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڣ<EFBFBD><EFBFBD>Ƿǣ<EFBFBD>"), QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes);;
|
|
||||||
if (response == QMessageBox::Yes)//
|
|
||||||
{
|
|
||||||
//std::cout << "<22><><EFBFBD><EFBFBD>" << std::endl;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
//std::cout << "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>" << std::endl;
|
|
||||||
m_RecordState -= 1;//<2F><><EFBFBD><EFBFBD><EFBFBD>ǵĻ<C7B5><C4BB><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA>ԭ<EFBFBD><D4AD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֹͣ<CDA3>ɼ<EFBFBD>
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
operateWidget = QObject::sender()->objectName();
|
operateWidget = QObject::sender()->objectName();
|
||||||
|
|
||||||
//<2F><><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
||||||
m_Imager->setFileName2Save(m_FilenameLineEdit->text().toStdString());
|
|
||||||
|
|
||||||
//ɾ<><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>tab
|
//ɾ<><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>tab
|
||||||
ui.ImageViewerTabWidget->clear();
|
ui.ImageViewerTabWidget->clear();
|
||||||
|
|
||||||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼x<C2BC><78><EFBFBD><EFBFBD>λ<EFBFBD>õ<EFBFBD><C3B5>ļ<EFBFBD>
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼x<C2BC><78><EFBFBD><EFBFBD>λ<EFBFBD>õ<EFBFBD><C3B5>ļ<EFBFBD>
|
||||||
string x_location = directory + "\\" + m_FilenameLineEdit->text().toStdString() + "x_location.pos";
|
string x_location = removeFileExtension(imgPath) + "x_location.pos";
|
||||||
m_hTimesFile = fopen(x_location.c_str(), "w+");
|
m_hTimesFile = fopen(x_location.c_str(), "w+");
|
||||||
|
|
||||||
//<2F><>ʼѭ<CABC><D1AD>
|
//<2F><>ʼѭ<CABC><D1AD>
|
||||||
@ -484,6 +607,16 @@ void HPPA::onStartRecordStep1()
|
|||||||
ui.action_start_recording->setText(QString::fromLocal8Bit("<EFBFBD>ɼ<EFBFBD>"));
|
ui.action_start_recording->setText(QString::fromLocal8Bit("<EFBFBD>ɼ<EFBFBD>"));
|
||||||
ui.mainToolBar->widgetForAction(ui.action_start_recording)->setStyleSheet("QWidget{background-color:rgb(0,255,0);}");
|
ui.mainToolBar->widgetForAction(ui.action_start_recording)->setStyleSheet("QWidget{background-color:rgb(0,255,0);}");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else if (checkedName == "mAction_RobotArm")
|
||||||
|
{
|
||||||
|
//<2F><><EFBFBD>ж<EFBFBD><D0B6>Ƿ<EFBFBD>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ִ<EFBFBD>к<EFBFBD><D0BA><EFBFBD>RobotArmControl::executeTask<73><6B><EFBFBD><EFBFBD><DEB8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾbug
|
||||||
|
rac->executeTaskWithHyperImager();
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void HPPA::onStartRecordStep2(int lineNumber)
|
void HPPA::onStartRecordStep2(int lineNumber)
|
||||||
@ -515,7 +648,6 @@ void HPPA::onStartRecordStep2(int lineNumber)
|
|||||||
else if (lineNumber == -1)
|
else if (lineNumber == -1)
|
||||||
{
|
{
|
||||||
std::cout << "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Զ<EFBFBD><EFBFBD><EFBFBD>ֹ<EFBFBD>ɼ<EFBFBD><EFBFBD><EFBFBD>" << std::endl;
|
std::cout << "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Զ<EFBFBD><EFBFBD><EFBFBD>ֹ<EFBFBD>ɼ<EFBFBD><EFBFBD><EFBFBD>" << std::endl;
|
||||||
m_RecordState++;
|
|
||||||
|
|
||||||
ui.action_start_recording->setText(QString::fromLocal8Bit("<EFBFBD>ɼ<EFBFBD>"));
|
ui.action_start_recording->setText(QString::fromLocal8Bit("<EFBFBD>ɼ<EFBFBD>"));
|
||||||
ui.mainToolBar->widgetForAction(ui.action_start_recording)->setStyleSheet("QWidget{background-color:rgb(0,255,0);}");
|
ui.mainToolBar->widgetForAction(ui.action_start_recording)->setStyleSheet("QWidget{background-color:rgb(0,255,0);}");
|
||||||
@ -673,7 +805,7 @@ void HPPA::onLeftMouseButtonPressed(int x, int y)
|
|||||||
|
|
||||||
FileOperation * fileOperation = new FileOperation();
|
FileOperation * fileOperation = new FileOperation();
|
||||||
string directory = fileOperation->getDirectoryFromString();
|
string directory = fileOperation->getDirectoryFromString();
|
||||||
string imgPath = directory + "\\" + m_FilenameLineEdit->text().toStdString() + "_" + std::to_string(m_TabWidgetCurrentIndex + 1);
|
string imgPath = directory + "\\" + m_FilenameLineEdit->text().toStdString() + "_" + std::to_string(m_TabWidgetCurrentIndex + 1) + ".bil";
|
||||||
|
|
||||||
ImageReaderWriter *ImageReader = new ImageReaderWriter(imgPath.c_str());
|
ImageReaderWriter *ImageReader = new ImageReaderWriter(imgPath.c_str());
|
||||||
|
|
||||||
@ -728,7 +860,7 @@ void HPPA::timerEvent(QTimerEvent *event)
|
|||||||
{
|
{
|
||||||
if (m_xMotor == nullptr || m_yMotor == nullptr)
|
if (m_xMotor == nullptr || m_yMotor == nullptr)
|
||||||
{
|
{
|
||||||
qDebug() << "Motor pointer is null!!!!!";
|
//qDebug() << "Motor pointer is null!!!!!";
|
||||||
|
|
||||||
xmotor_state_label1->setStyleSheet("QLabel{background-color:rgb(255,0,0);}");
|
xmotor_state_label1->setStyleSheet("QLabel{background-color:rgb(255,0,0);}");
|
||||||
SetXMotorWidgetEnable(false);
|
SetXMotorWidgetEnable(false);
|
||||||
@ -746,7 +878,7 @@ void HPPA::timerEvent(QTimerEvent *event)
|
|||||||
}
|
}
|
||||||
ByteBack xMotorState = m_xMotor->GetState();//ִ<><D6B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
ByteBack xMotorState = m_xMotor->GetState();//ִ<><D6B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
|
|
||||||
std::cout << "------------------------------------------x<><78><EFBFBD><EFBFBD><EFBFBD>ٶȣ<D9B6>" << xMotorState.Speed << std::endl;
|
//std::cout << "------------------------------------------x<><78><EFBFBD><EFBFBD><EFBFBD>ٶȣ<D9B6>" << xMotorState.Speed << std::endl;
|
||||||
|
|
||||||
if (xMotorState.Speed == -1000000)
|
if (xMotorState.Speed == -1000000)
|
||||||
{
|
{
|
||||||
@ -1491,6 +1623,7 @@ void HPPA::newMotor()
|
|||||||
m_yMotor = new VinceControl(NETTCP, 6001);//ԭ<><D4AD><EFBFBD><EFBFBD>6001<30><31><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ԣ<EFBFBD>6003
|
m_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);
|
m_pathPlan->setMotor(m_xMotor, m_yMotor);
|
||||||
|
QString imagerSelected = mImagerGroup->checkedAction()->objectName();
|
||||||
if (imagerSelected == "mActionPica_NIR")
|
if (imagerSelected == "mActionPica_NIR")
|
||||||
{
|
{
|
||||||
connect(m_xMotor, SIGNAL(newTCPConnection(VinceControl*)), this, SLOT(setMotorParamMicroscope(VinceControl*)));
|
connect(m_xMotor, SIGNAL(newTCPConnection(VinceControl*)), this, SLOT(setMotorParamMicroscope(VinceControl*)));
|
||||||
@ -1626,6 +1759,7 @@ void HPPA::onconnect()
|
|||||||
m_RecordThread = new QThread();
|
m_RecordThread = new QThread();
|
||||||
|
|
||||||
//<2F><><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʹ<EFBFBD><CDB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>mImagerGroup
|
//<2F><><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʹ<EFBFBD><CDB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>mImagerGroup
|
||||||
|
QString imagerSelected = mImagerGroup->checkedAction()->objectName();
|
||||||
if (imagerSelected == "mActionPica_L")
|
if (imagerSelected == "mActionPica_L")
|
||||||
{
|
{
|
||||||
m_Imager = new ResononPicaLImager();
|
m_Imager = new ResononPicaLImager();
|
||||||
@ -1636,7 +1770,7 @@ void HPPA::onconnect()
|
|||||||
}
|
}
|
||||||
else if (imagerSelected == "mActionPika_XC2")
|
else if (imagerSelected == "mActionPika_XC2")
|
||||||
{
|
{
|
||||||
|
m_Imager = new ResononPicaLImager();
|
||||||
}
|
}
|
||||||
else if (imagerSelected == "mActionCorning_410")
|
else if (imagerSelected == "mActionCorning_410")
|
||||||
{
|
{
|
||||||
@ -1833,6 +1967,9 @@ void HPPA::onReference()
|
|||||||
msgBox.setText(QString::fromLocal8Bit("<EFBFBD><EFBFBD>ȷ<EFBFBD><EFBFBD><EFBFBD>װ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȷ<EFBFBD><EFBFBD>"));
|
msgBox.setText(QString::fromLocal8Bit("<EFBFBD><EFBFBD>ȷ<EFBFBD><EFBFBD><EFBFBD>װ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȷ<EFBFBD><EFBFBD>"));
|
||||||
msgBox.exec();
|
msgBox.exec();
|
||||||
|
|
||||||
|
bool isMotorEnable = this->ui.mAction_2AxisMotor->isChecked();
|
||||||
|
if (isMotorEnable)
|
||||||
|
{
|
||||||
//<2F>ƶ<EFBFBD>x<EFBFBD><78><EFBFBD><EFBFBD>
|
//<2F>ƶ<EFBFBD>x<EFBFBD><78><EFBFBD><EFBFBD>
|
||||||
if (!isMotorConnected(m_xMotor))
|
if (!isMotorConnected(m_xMotor))
|
||||||
{
|
{
|
||||||
@ -1843,6 +1980,7 @@ void HPPA::onReference()
|
|||||||
|
|
||||||
m_xMotor->MoveMotar(true);
|
m_xMotor->MoveMotar(true);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
emit RecordWhiteSignal();
|
emit RecordWhiteSignal();
|
||||||
}
|
}
|
||||||
@ -1851,6 +1989,9 @@ void HPPA::recordWhiteFinish()
|
|||||||
{
|
{
|
||||||
ui.mainToolBar->widgetForAction(ui.action_reference)->setStyleSheet("QWidget{background-color:rgb(0,255,0);}");
|
ui.mainToolBar->widgetForAction(ui.action_reference)->setStyleSheet("QWidget{background-color:rgb(0,255,0);}");
|
||||||
|
|
||||||
|
bool isMotorEnable = this->ui.mAction_2AxisMotor->isChecked();
|
||||||
|
if (isMotorEnable)
|
||||||
|
{
|
||||||
//<2F>ƶ<EFBFBD>x<EFBFBD><78><EFBFBD><EFBFBD>
|
//<2F>ƶ<EFBFBD>x<EFBFBD><78><EFBFBD><EFBFBD>
|
||||||
if (!isMotorConnected(m_xMotor))
|
if (!isMotorConnected(m_xMotor))
|
||||||
{
|
{
|
||||||
@ -1859,9 +2000,11 @@ void HPPA::recordWhiteFinish()
|
|||||||
m_xMotor->MoveToLocation(m_lXmotorLocationOfStartRecord);
|
m_xMotor->MoveToLocation(m_lXmotorLocationOfStartRecord);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void HPPA::onPlotHyperspectralImageRgbImage()
|
void HPPA::onPlotHyperspectralImageRgbImage()
|
||||||
{
|
{
|
||||||
|
//return;
|
||||||
//<2F><>ȡ<EFBFBD><C8A1>ͼ<EFBFBD>ؼ<EFBFBD>
|
//<2F><>ȡ<EFBFBD><C8A1>ͼ<EFBFBD>ؼ<EFBFBD>
|
||||||
QWidget* currentWidget = ui.ImageViewerTabWidget->widget(m_numberOfRecording);
|
QWidget* currentWidget = ui.ImageViewerTabWidget->widget(m_numberOfRecording);
|
||||||
QList<ImageViewer *> currentImageViewer = currentWidget->findChildren<ImageViewer *>();
|
QList<ImageViewer *> currentImageViewer = currentWidget->findChildren<ImageViewer *>();
|
||||||
@ -1975,11 +2118,32 @@ void HPPA::PlotSpectral(int state)
|
|||||||
void HPPA::onRecordFinishedSignal_WhenFrameNumberMeet()
|
void HPPA::onRecordFinishedSignal_WhenFrameNumberMeet()
|
||||||
{
|
{
|
||||||
std::cout << "ֹͣ<EFBFBD>ɼ<EFBFBD>ԭ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>֡<EFBFBD><EFBFBD><EFBFBD>ɼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˡ<EFBFBD>" << std::endl;
|
std::cout << "ֹͣ<EFBFBD>ɼ<EFBFBD>ԭ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>֡<EFBFBD><EFBFBD><EFBFBD>ɼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˡ<EFBFBD>" << std::endl;
|
||||||
|
|
||||||
|
ui.action_start_recording->setText(QString::fromLocal8Bit("<EFBFBD>ɼ<EFBFBD>"));
|
||||||
|
ui.mainToolBar->widgetForAction(ui.action_start_recording)->setStyleSheet("QWidget{background-color:rgb(0,255,0);}");
|
||||||
|
|
||||||
|
m_RecordState++;//<2F><><EFBFBD>Զ<EFBFBD>ֹͣ<CDA3>ɼ<EFBFBD>
|
||||||
}
|
}
|
||||||
|
|
||||||
void HPPA::onRecordFinishedSignal_WhenFrameNumberNotMeet()
|
void HPPA::onRecordFinishedSignal_WhenFrameNumberNotMeet()
|
||||||
{
|
{
|
||||||
|
QAction* checked = moveplatformActionGroup->checkedAction();
|
||||||
|
QString checkedName;
|
||||||
|
if (checked)
|
||||||
|
{
|
||||||
|
checkedName = checked->objectName();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (checkedName == "mAction_RobotArm")//<2F><>е<EFBFBD>ۻ<EFBFBD><DBBB><EFBFBD>ֹͣ<CDA3>ɼ<EFBFBD><C9BC><EFBFBD><EFBFBD><EFBFBD>˲<EFBFBD><CBB2><EFBFBD>ֿ<EFBFBD>ʼ<EFBFBD>ɼ<EFBFBD><C9BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ui.action_start_recording<6E><67>ʾ<EFBFBD>쳣
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
std::cout << "ֹͣ<EFBFBD>ɼ<EFBFBD>ԭ<EFBFBD><EFBFBD>1<EFBFBD><EFBFBD>֡<EFBFBD><EFBFBD>û<EFBFBD>вɼ<EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ﵽ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD>ã<EFBFBD><EFBFBD><EFBFBD>2<EFBFBD><EFBFBD><EFBFBD>ֶ<EFBFBD>ֹͣ<EFBFBD>ɼ<EFBFBD><EFBFBD><EFBFBD>" << std::endl;
|
std::cout << "ֹͣ<EFBFBD>ɼ<EFBFBD>ԭ<EFBFBD><EFBFBD>1<EFBFBD><EFBFBD>֡<EFBFBD><EFBFBD>û<EFBFBD>вɼ<EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ﵽ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD>ã<EFBFBD><EFBFBD><EFBFBD>2<EFBFBD><EFBFBD><EFBFBD>ֶ<EFBFBD>ֹͣ<EFBFBD>ɼ<EFBFBD><EFBFBD><EFBFBD>" << std::endl;
|
||||||
|
|
||||||
|
ui.action_start_recording->setText(QString::fromLocal8Bit("<EFBFBD>ɼ<EFBFBD>"));
|
||||||
|
ui.mainToolBar->widgetForAction(ui.action_start_recording)->setStyleSheet("QWidget{background-color:rgb(0,255,0);}");
|
||||||
}
|
}
|
||||||
|
|
||||||
ForLoopControl::ForLoopControl()
|
ForLoopControl::ForLoopControl()
|
||||||
|
|||||||
@ -33,6 +33,7 @@
|
|||||||
#include "adjustTable.h"
|
#include "adjustTable.h"
|
||||||
#include "PowerControl.h"
|
#include "PowerControl.h"
|
||||||
#include "PathPlan.h"
|
#include "PathPlan.h"
|
||||||
|
#include "RobotArmControl.h"
|
||||||
|
|
||||||
#include "hppaConfigFile.h"
|
#include "hppaConfigFile.h"
|
||||||
#include "path_tc.h"
|
#include "path_tc.h"
|
||||||
@ -236,9 +237,13 @@ private:
|
|||||||
void getRequest(QString str);
|
void getRequest(QString str);
|
||||||
|
|
||||||
QActionGroup* mImagerGroup = nullptr;
|
QActionGroup* mImagerGroup = nullptr;
|
||||||
QString imagerSelected;
|
|
||||||
void createActionGroups();
|
void createActionGroups();
|
||||||
void selectingImager(QAction* selectedAction);
|
void selectingImager(QAction* selectedAction);
|
||||||
|
QActionGroup* moveplatformActionGroup = nullptr;
|
||||||
|
void createMoveplatformActionGroup();
|
||||||
|
void selectingMoveplatform(QAction* selectedAction);
|
||||||
|
RobotArmControl* rac;
|
||||||
|
|
||||||
|
|
||||||
PathPlan* m_pathPlan;
|
PathPlan* m_pathPlan;
|
||||||
|
|
||||||
@ -334,6 +339,8 @@ public Q_SLOTS:
|
|||||||
|
|
||||||
void requestFinished(QNetworkReply* reply);
|
void requestFinished(QNetworkReply* reply);
|
||||||
|
|
||||||
|
void recordFromRobotArm(int fileCounter);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void StartFocusSignal();
|
void StartFocusSignal();
|
||||||
void StartLoopSignal();
|
void StartLoopSignal();
|
||||||
|
|||||||
58
HPPA/HPPA.ui
58
HPPA/HPPA.ui
@ -6,8 +6,8 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>1078</width>
|
<width>1194</width>
|
||||||
<height>623</height>
|
<height>834</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
@ -46,7 +46,7 @@
|
|||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<property name="currentIndex">
|
<property name="currentIndex">
|
||||||
<number>1</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="tab_4">
|
<widget class="QWidget" name="tab_4">
|
||||||
<attribute name="title">
|
<attribute name="title">
|
||||||
@ -84,7 +84,7 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>1078</width>
|
<width>1194</width>
|
||||||
<height>30</height>
|
<height>30</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
@ -162,8 +162,17 @@ color:white;
|
|||||||
<string>窗口</string>
|
<string>窗口</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
|
<widget class="QMenu" name="menu_2">
|
||||||
|
<property name="title">
|
||||||
|
<string>扫描平台</string>
|
||||||
|
</property>
|
||||||
|
<addaction name="mAction_is_no_motor"/>
|
||||||
|
<addaction name="mAction_2AxisMotor"/>
|
||||||
|
<addaction name="mAction_RobotArm"/>
|
||||||
|
</widget>
|
||||||
<addaction name="file"/>
|
<addaction name="file"/>
|
||||||
<addaction name="menuspectrometer"/>
|
<addaction name="menuspectrometer"/>
|
||||||
|
<addaction name="menu_2"/>
|
||||||
<addaction name="mWindowsMenu"/>
|
<addaction name="mWindowsMenu"/>
|
||||||
<addaction name="menuhelp"/>
|
<addaction name="menuhelp"/>
|
||||||
</widget>
|
</widget>
|
||||||
@ -1535,6 +1544,47 @@ QDockWidget::title {
|
|||||||
<string>工具栏</string>
|
<string>工具栏</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
|
<action name="action_2">
|
||||||
|
<property name="checkable">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>马达</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
|
<action name="mAction_is_no_motor">
|
||||||
|
<property name="checkable">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="checked">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>无</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
|
<action name="mAction_2AxisMotor">
|
||||||
|
<property name="checkable">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>2 轴线性马达</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
|
<action name="mAction_RobotArm">
|
||||||
|
<property name="checkable">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="checked">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>机械臂</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
</widget>
|
</widget>
|
||||||
<layoutdefault spacing="6" margin="11"/>
|
<layoutdefault spacing="6" margin="11"/>
|
||||||
<customwidgets>
|
<customwidgets>
|
||||||
|
|||||||
@ -86,7 +86,7 @@
|
|||||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<SubSystem>Windows</SubSystem>
|
<SubSystem>Console</SubSystem>
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
</Link>
|
</Link>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
@ -116,6 +116,7 @@
|
|||||||
<ClCompile Include="resononImager.cpp" />
|
<ClCompile Include="resononImager.cpp" />
|
||||||
<ClCompile Include="ResononNirImager.cpp" />
|
<ClCompile Include="ResononNirImager.cpp" />
|
||||||
<ClCompile Include="RgbCameraOperation.cpp" />
|
<ClCompile Include="RgbCameraOperation.cpp" />
|
||||||
|
<ClCompile Include="RobotArmControl.cpp" />
|
||||||
<ClCompile Include="stdafx.cpp">
|
<ClCompile Include="stdafx.cpp">
|
||||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
|
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
|
||||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
|
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
|
||||||
@ -139,6 +140,7 @@
|
|||||||
<ClCompile Include="main.cpp" />
|
<ClCompile Include="main.cpp" />
|
||||||
<QtUic Include="PathPlan.ui" />
|
<QtUic Include="PathPlan.ui" />
|
||||||
<QtUic Include="PowerControl.ui" />
|
<QtUic Include="PowerControl.ui" />
|
||||||
|
<QtUic Include="RobotArmControl.ui" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<QtMoc Include="fileOperation.h" />
|
<QtMoc Include="fileOperation.h" />
|
||||||
@ -153,6 +155,7 @@
|
|||||||
<QtMoc Include="adjustTable.h" />
|
<QtMoc Include="adjustTable.h" />
|
||||||
<QtMoc Include="PowerControl.h" />
|
<QtMoc Include="PowerControl.h" />
|
||||||
<QtMoc Include="PathPlan.h" />
|
<QtMoc Include="PathPlan.h" />
|
||||||
|
<QtMoc Include="RobotArmControl.h" />
|
||||||
<ClInclude Include="utility_tc.h" />
|
<ClInclude Include="utility_tc.h" />
|
||||||
<QtMoc Include="aboutWindow.h" />
|
<QtMoc Include="aboutWindow.h" />
|
||||||
<ClInclude Include="hppaConfigFile.h" />
|
<ClInclude Include="hppaConfigFile.h" />
|
||||||
|
|||||||
@ -106,6 +106,9 @@
|
|||||||
<ClCompile Include="PathPlan.cpp">
|
<ClCompile Include="PathPlan.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="RobotArmControl.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<QtMoc Include="fileOperation.h">
|
<QtMoc Include="fileOperation.h">
|
||||||
@ -153,6 +156,9 @@
|
|||||||
<QtMoc Include="PathPlan.h">
|
<QtMoc Include="PathPlan.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</QtMoc>
|
</QtMoc>
|
||||||
|
<QtMoc Include="RobotArmControl.h">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</QtMoc>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="imageProcessor.h">
|
<ClInclude Include="imageProcessor.h">
|
||||||
@ -196,6 +202,9 @@
|
|||||||
<QtUic Include="PathPlan.ui">
|
<QtUic Include="PathPlan.ui">
|
||||||
<Filter>Form Files</Filter>
|
<Filter>Form Files</Filter>
|
||||||
</QtUic>
|
</QtUic>
|
||||||
|
<QtUic Include="RobotArmControl.ui">
|
||||||
|
<Filter>Form Files</Filter>
|
||||||
|
</QtUic>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="cpp.hint" />
|
<None Include="cpp.hint" />
|
||||||
|
|||||||
@ -204,16 +204,13 @@ void ImagerOperationBase::start_record()
|
|||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
FileOperation* fileOperation = new FileOperation();
|
m_FileName2Save2 = m_FileName2Save + "_" + std::to_string(m_FileSavedCounter) + ".bil";
|
||||||
string directory = fileOperation->getDirectoryFromString();
|
FILE* m_fImage = fopen(m_FileName2Save2.c_str(), "w+b");
|
||||||
string imgPath = directory + "\\" + m_FileName2Save + "_" + std::to_string(m_FileSavedCounter);
|
|
||||||
|
|
||||||
FILE* m_fImage = fopen((imgPath + ".bil").c_str(), "w+b");
|
|
||||||
|
|
||||||
size_t x;
|
size_t x;
|
||||||
double pixelValueTmp;
|
double pixelValueTmp;
|
||||||
|
|
||||||
string timesFile = imgPath + ".times";
|
string timesFile = removeFileExtension(m_FileName2Save2) + ".times";
|
||||||
FILE* hTimesFile = fopen(timesFile.c_str(), "w+");
|
FILE* hTimesFile = fopen(timesFile.c_str(), "w+");
|
||||||
|
|
||||||
imagerStartCollect();
|
imagerStartCollect();
|
||||||
@ -290,7 +287,7 @@ void ImagerOperationBase::start_record()
|
|||||||
|
|
||||||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD>λ<EFBFBD>ͼǰ<CDBC><C7B0>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD>λ<EFBFBD>ͼǰ<CDBC><C7B0>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
//m_RgbImage
|
//m_RgbImage
|
||||||
emit PlotSignal();//<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>ȫ
|
//emit PlotSignal();//<2F><>1<EFBFBD><31><EFBFBD>ɼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɺ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD>λ<EFBFBD>ͼ<EFBFBD><EFBFBD><EFBFBD>Է<EFBFBD><EFBFBD>ɼ<EFBFBD>֡<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>֡<EFBFBD>ʵı<EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͼ<EFBFBD><EFBFBD>ȫ<EFBFBD><EFBFBD>2<EFBFBD><EFBFBD>ʹ<EFBFBD>û<EFBFBD>е<EFBFBD>۲ɼ<EFBFBD>ʱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֹͣ<EFBFBD>ɼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˲<EFBFBD>俪ʼ<EFBFBD>ɼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ᵼ<EFBFBD><EFBFBD><EFBFBD>ϴβɼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ĵ<EFBFBD><EFBFBD>źŵ<EFBFBD><EFBFBD>õIJۺ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD>˼<EFBFBD><EFBFBD>ݣ<EFBFBD>ע<EFBFBD>͵<EFBFBD>
|
||||||
|
|
||||||
if (m_iFrameCounter >= m_iFrameNumber)
|
if (m_iFrameCounter >= m_iFrameNumber)
|
||||||
{
|
{
|
||||||
@ -404,11 +401,7 @@ void ImagerOperationBase::WriteHdr()
|
|||||||
//write an ENVI compatible header file
|
//write an ENVI compatible header file
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
|
string hdrPath = removeFileExtension(m_FileName2Save2) + ".hdr";
|
||||||
FileOperation* fileOperation = new FileOperation();
|
|
||||||
string directory = fileOperation->getDirectoryFromString();
|
|
||||||
|
|
||||||
string hdrPath = directory + "\\" + m_FileName2Save + "_" + std::to_string(m_FileSavedCounter) + ".hdr";
|
|
||||||
|
|
||||||
std::ofstream outfile(hdrPath.c_str());
|
std::ofstream outfile(hdrPath.c_str());
|
||||||
outfile << "ENVI\n";
|
outfile << "ENVI\n";
|
||||||
|
|||||||
@ -66,6 +66,7 @@ protected:
|
|||||||
|
|
||||||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڸ<EFBFBD><DAB8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӱ<EFBFBD><D3B0><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD>
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڸ<EFBFBD><DAB8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӱ<EFBFBD><D3B0><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD>
|
||||||
string m_FileName2Save;//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӱ<EFBFBD><D3B0><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD>
|
string m_FileName2Save;//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӱ<EFBFBD><D3B0><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD>
|
||||||
|
string m_FileName2Save2;
|
||||||
int m_FileSavedCounter;//<2F><><EFBFBD><EFBFBD><EFBFBD>˼<EFBFBD><CBBC><EFBFBD>Ӱ<EFBFBD><D3B0><EFBFBD>ļ<EFBFBD>
|
int m_FileSavedCounter;//<2F><><EFBFBD><EFBFBD><EFBFBD>˼<EFBFBD><CBBC><EFBFBD>Ӱ<EFBFBD><D3B0><EFBFBD>ļ<EFBFBD>
|
||||||
|
|
||||||
bool m_HasDark;//<2F><><EFBFBD>ɼ<EFBFBD><C9BC>˰<EFBFBD><CBB0><EFBFBD><EFBFBD><EFBFBD>֮<EFBFBD><D6AE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊtrue
|
bool m_HasDark;//<2F><><EFBFBD>ɼ<EFBFBD><C9BC>˰<EFBFBD><CBB0><EFBFBD><EFBFBD><EFBFBD>֮<EFBFBD><D6AE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊtrue
|
||||||
|
|||||||
@ -285,16 +285,13 @@ void ResononNirImager::start_record()
|
|||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
FileOperation* fileOperation = new FileOperation();
|
m_FileName2Save2 = m_FileName2Save + "_" + std::to_string(m_FileSavedCounter) + ".bil";
|
||||||
string directory = fileOperation->getDirectoryFromString();
|
FILE* m_fImage = fopen(m_FileName2Save2.c_str(), "w+b");
|
||||||
string imgPath = directory + "\\" + m_FileName2Save + "_" + std::to_string(m_FileSavedCounter);
|
|
||||||
|
|
||||||
FILE* m_fImage = fopen((imgPath + ".bil").c_str(), "w+b");
|
|
||||||
|
|
||||||
size_t x;
|
size_t x;
|
||||||
double pixelValueTmp;
|
double pixelValueTmp;
|
||||||
|
|
||||||
string timesFile = imgPath + ".times";
|
string timesFile = removeFileExtension(m_FileName2Save2) + ".times";
|
||||||
FILE* hTimesFile = fopen(timesFile.c_str(), "w+");
|
FILE* hTimesFile = fopen(timesFile.c_str(), "w+");
|
||||||
|
|
||||||
reConnectImage();//nir<69>ڶ<EFBFBD><DAB6>βɼ<CEB2>ʱ<EFBFBD><CAB1>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>imagerStartCollect()<29>ᱨ<EFBFBD><E1B1A8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
reConnectImage();//nir<69>ڶ<EFBFBD><DAB6>βɼ<CEB2>ʱ<EFBFBD><CAB1>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>imagerStartCollect()<29>ᱨ<EFBFBD><E1B1A8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
@ -395,11 +392,7 @@ void ResononNirImager::WriteHdr()
|
|||||||
//write an ENVI compatible header file
|
//write an ENVI compatible header file
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
|
string hdrPath = removeFileExtension(m_FileName2Save2) + ".hdr";
|
||||||
FileOperation* fileOperation = new FileOperation();
|
|
||||||
string directory = fileOperation->getDirectoryFromString();
|
|
||||||
|
|
||||||
string hdrPath = directory + "\\" + m_FileName2Save + "_" + std::to_string(m_FileSavedCounter) + ".hdr";
|
|
||||||
|
|
||||||
std::ofstream outfile(hdrPath.c_str());
|
std::ofstream outfile(hdrPath.c_str());
|
||||||
outfile << "ENVI\n";
|
outfile << "ENVI\n";
|
||||||
|
|||||||
@ -7,6 +7,7 @@
|
|||||||
#include "resonon_imager_allied.h"
|
#include "resonon_imager_allied.h"
|
||||||
#include "image2display.h"
|
#include "image2display.h"
|
||||||
#include "fileOperation.h"
|
#include "fileOperation.h"
|
||||||
|
#include "utility_tc.h"
|
||||||
|
|
||||||
class ResononNirImager :public ImagerOperationBase
|
class ResononNirImager :public ImagerOperationBase
|
||||||
{
|
{
|
||||||
|
|||||||
639
HPPA/RobotArmControl.cpp
Normal file
639
HPPA/RobotArmControl.cpp
Normal file
@ -0,0 +1,639 @@
|
|||||||
|
#include "RobotArmControl.h"
|
||||||
|
|
||||||
|
RobotArmControl::RobotArmControl(QWidget* parent): QDialog(parent)
|
||||||
|
{
|
||||||
|
ui.setupUi(this);
|
||||||
|
robotController = new RobotController(this);
|
||||||
|
|
||||||
|
connect(ui.get_task_list_btn, SIGNAL(clicked()), this, SLOT(getTaskList()));
|
||||||
|
connect(ui.get_pose_btn, SIGNAL(clicked()), this, SLOT(getPose()));
|
||||||
|
connect(ui.connect2arm_btn, SIGNAL(clicked()), this, SLOT(connectRobotArm()));
|
||||||
|
|
||||||
|
connect(ui.execute_task_btn, SIGNAL(clicked()), this, SLOT(executeTaskWithoutHyperImager()));
|
||||||
|
connect(ui.pause_task_btn, SIGNAL(clicked()), this, SLOT(pauseTask()));
|
||||||
|
connect(ui.continue_task_btn, SIGNAL(clicked()), this, SLOT(continueTask()));
|
||||||
|
|
||||||
|
robotMonitor = new EC8056;
|
||||||
|
connect(robotMonitor, &EC8056::dataReceived, this, &RobotArmControl::monitorRobotArm);
|
||||||
|
|
||||||
|
|
||||||
|
m_pModel = new QStringListModel(ui.taskList_listView);
|
||||||
|
|
||||||
|
ui.taskList_listView->setModel(m_pModel);
|
||||||
|
}
|
||||||
|
|
||||||
|
RobotArmControl::~RobotArmControl()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void RobotArmControl::monitorRobotArm(const ECData& data)
|
||||||
|
{
|
||||||
|
double x = data.machinePose[0];
|
||||||
|
double y = data.machinePose[1];
|
||||||
|
double z = data.machinePose[2];
|
||||||
|
|
||||||
|
ui.pose_x_label->setText(QString::number(x));
|
||||||
|
ui.pose_y_label->setText(QString::number(y));
|
||||||
|
ui.pose_z_label->setText(QString::number(z));
|
||||||
|
}
|
||||||
|
|
||||||
|
void RobotArmControl::onCommandResponse(QString str, const QJsonObject& response)
|
||||||
|
{
|
||||||
|
//qDebug() << "response:" << response;
|
||||||
|
|
||||||
|
QString re;
|
||||||
|
if (response.contains("result"))
|
||||||
|
{
|
||||||
|
re = response["result"].toVariant().toString();
|
||||||
|
ui.textEdit->append(str + " Result: " + re);
|
||||||
|
}
|
||||||
|
else if (response.contains("error"))
|
||||||
|
{
|
||||||
|
//auto delete11 = response["error"].toObject();
|
||||||
|
//qDebug() << "response[\"error\"]:" << delete11;
|
||||||
|
|
||||||
|
auto errorStr = response["error"].toObject()["message"].toString();
|
||||||
|
|
||||||
|
ui.textEdit->append(str + " Error: " + errorStr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void RobotArmControl::getTaskList()
|
||||||
|
{
|
||||||
|
FileOperation* fileOperation = new FileOperation();
|
||||||
|
string directory = fileOperation->getDirectoryOfExe();
|
||||||
|
|
||||||
|
QString pythonScript = QString::fromStdString(directory) + "\\get_jbi_filename.py";
|
||||||
|
|
||||||
|
QProcess process;
|
||||||
|
|
||||||
|
process.start("python.exe", QStringList() << pythonScript);
|
||||||
|
process.waitForFinished();
|
||||||
|
QString output = process.readAllStandardOutput();
|
||||||
|
|
||||||
|
QStringList files;
|
||||||
|
//files.append("tc20250324down.jbi");
|
||||||
|
//files.append("tc20250324circle.jbi");
|
||||||
|
//files.append("tc20250324side.jbi");
|
||||||
|
QStringList lines = output.split('\n', QString::SkipEmptyParts);
|
||||||
|
for (const QString& line : lines)
|
||||||
|
{
|
||||||
|
files.append(line.trimmed());
|
||||||
|
}
|
||||||
|
|
||||||
|
////<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݣ<EFBFBD>Ȼ<EFBFBD><C8BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
|
//for (size_t i = 0; i < files.length(); i++)
|
||||||
|
//{
|
||||||
|
// int row = m_pModel->rowCount();
|
||||||
|
// m_pModel->insertRow(row);
|
||||||
|
// QModelIndex index = m_pModel->index(row);
|
||||||
|
// m_pModel->setData(index, files[i]);
|
||||||
|
//}
|
||||||
|
|
||||||
|
m_pModel->setStringList(files);
|
||||||
|
}
|
||||||
|
|
||||||
|
void RobotArmControl::getPose()
|
||||||
|
{
|
||||||
|
QJsonObject response;
|
||||||
|
bool x = robotController->getRobotPose(response);
|
||||||
|
onCommandResponse("getPose", response);
|
||||||
|
}
|
||||||
|
|
||||||
|
void RobotArmControl::connectRobotArm()
|
||||||
|
{
|
||||||
|
bool re = robotController->connectToRobot("192.168.1.100");
|
||||||
|
robotMonitor->connectToHost("192.168.1.100");
|
||||||
|
}
|
||||||
|
|
||||||
|
void RobotArmControl::executeTaskWithHyperImager()
|
||||||
|
{
|
||||||
|
QModelIndex index = ui.taskList_listView->currentIndex();
|
||||||
|
if (-1 == index.row())
|
||||||
|
{
|
||||||
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD>û<EFBFBD>ѡ<EFBFBD><D1A1><EFBFBD>ļ<EFBFBD>
|
||||||
|
ui.textEdit->append("Please select file on the left!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
QString fileName = index.data(Qt::DisplayRole).toString();
|
||||||
|
|
||||||
|
QJsonObject response;
|
||||||
|
bool x;
|
||||||
|
|
||||||
|
x = robotController->checkJbiExist(fileName, response);
|
||||||
|
onCommandResponse("checkJbiExist", response);
|
||||||
|
if (!x)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
x = robotController->setServoStatus(1, response);
|
||||||
|
onCommandResponse("setServoStatus", response);
|
||||||
|
if (!x)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
x = robotController->runJbi(fileName, response, true);
|
||||||
|
onCommandResponse("runJbi", response);
|
||||||
|
if (!x)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void RobotArmControl::executeTaskWithoutHyperImager()
|
||||||
|
{
|
||||||
|
QModelIndex index = ui.taskList_listView->currentIndex();
|
||||||
|
if (-1 == index.row())
|
||||||
|
{
|
||||||
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD>û<EFBFBD>ѡ<EFBFBD><D1A1><EFBFBD>ļ<EFBFBD>
|
||||||
|
ui.textEdit->append("Please select file on the left!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
QString fileName = index.data(Qt::DisplayRole).toString();
|
||||||
|
|
||||||
|
QJsonObject response;
|
||||||
|
bool x;
|
||||||
|
|
||||||
|
x = robotController->checkJbiExist(fileName, response);
|
||||||
|
onCommandResponse("checkJbiExist", response);
|
||||||
|
if (!x)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
x = robotController->setServoStatus(1, response);
|
||||||
|
onCommandResponse("setServoStatus", response);
|
||||||
|
if (!x)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
x = robotController->runJbi(fileName, response, false);
|
||||||
|
onCommandResponse("runJbi", response);
|
||||||
|
if (!x)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void RobotArmControl::pauseTask()
|
||||||
|
{
|
||||||
|
QJsonObject response;
|
||||||
|
bool x;
|
||||||
|
|
||||||
|
x = robotController->pauseTask(response);
|
||||||
|
onCommandResponse("pauseTask", response);
|
||||||
|
}
|
||||||
|
|
||||||
|
void RobotArmControl::continueTask()
|
||||||
|
{
|
||||||
|
QJsonObject response;
|
||||||
|
bool x;
|
||||||
|
|
||||||
|
x = robotController->continueTask(response);
|
||||||
|
onCommandResponse("continueTask", response);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
RobotController::RobotController(QObject* parent) : QObject(parent), socket(new QTcpSocket(this))
|
||||||
|
{
|
||||||
|
//connect(socket, &QTcpSocket::readyRead, this, &RobotController::onReadyRead);
|
||||||
|
|
||||||
|
m_timer = new QTimer(this);
|
||||||
|
connect(m_timer, SIGNAL(timeout()), this, SLOT(getPoint()));
|
||||||
|
}
|
||||||
|
|
||||||
|
RobotController::~RobotController()
|
||||||
|
{
|
||||||
|
disconnectFromRobot();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool RobotController::connectToRobot(const QString& ip, quint16 port)
|
||||||
|
{
|
||||||
|
socket->setProxy(QNetworkProxy::NoProxy);
|
||||||
|
|
||||||
|
socket->connectToHost(ip, port);
|
||||||
|
|
||||||
|
if (!socket->waitForConnected(3000)) {
|
||||||
|
qDebug() << "Connection failed:" << socket->errorString();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
qDebug() << "Connected successfully!";
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void RobotController::disconnectFromRobot()
|
||||||
|
{
|
||||||
|
if (socket->isOpen())
|
||||||
|
{
|
||||||
|
socket->close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool RobotController::processResponse(QJsonObject response, QString& result)
|
||||||
|
{
|
||||||
|
//qDebug() << "response:" << response;
|
||||||
|
|
||||||
|
if (response.contains("result"))
|
||||||
|
{
|
||||||
|
result = response["result"].toVariant().toString();
|
||||||
|
|
||||||
|
//qDebug() << "result1:" << result;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else if (response.contains("error"))
|
||||||
|
{
|
||||||
|
result = response["error"].toObject()["message"].toString();
|
||||||
|
//qDebug() << "result2:" << result;
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool RobotController::processResponse_getJbiState(QJsonObject response, QString& result)
|
||||||
|
{
|
||||||
|
//qDebug() << "response:" << response;
|
||||||
|
|
||||||
|
if (response.contains("result"))
|
||||||
|
{
|
||||||
|
QString resultStr = response["result"].toString();
|
||||||
|
|
||||||
|
QJsonDocument resultDoc = QJsonDocument::fromJson(resultStr.toUtf8());
|
||||||
|
QJsonObject resultObj = resultDoc.object();
|
||||||
|
//qDebug() << "resultObj:" << resultObj;
|
||||||
|
|
||||||
|
int runState = resultObj["runState"].toInt();
|
||||||
|
//qDebug() << "runState:" << runState;
|
||||||
|
|
||||||
|
result = QString::number(runState);
|
||||||
|
//qDebug() << "result:" << result;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else if (response.contains("error"))
|
||||||
|
{
|
||||||
|
result = response["error"].toObject()["message"].toString();
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void RobotController::getPoint()
|
||||||
|
{
|
||||||
|
QJsonObject response;
|
||||||
|
getJbiState(response);//0 ֹͣ״̬,1 <20><>ͣ״̬,2 <20><>ͣ״̬,3 <20><><EFBFBD><EFBFBD>״̬,4 <20><><EFBFBD><EFBFBD>״̬
|
||||||
|
QString result;
|
||||||
|
bool x = processResponse_getJbiState(response, result);
|
||||||
|
//qDebug() << "getJbiState:" << result;
|
||||||
|
|
||||||
|
if (result.toInt() != 3)
|
||||||
|
{
|
||||||
|
m_timer->stop();
|
||||||
|
|
||||||
|
m_iCurrentJbiJobLine = 0;
|
||||||
|
m_iFileCounter = 0;
|
||||||
|
|
||||||
|
//<2F><><EFBFBD><EFBFBD><EFBFBD>źţ<C5BA><C5A3><EFBFBD><EFBFBD><EFBFBD>ֹͣ<CDA3>ɼ<EFBFBD>
|
||||||
|
emit hsiRecordSignal(-1);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
QJsonObject response2;
|
||||||
|
getCurrentJobLine(response2);
|
||||||
|
QString result2;
|
||||||
|
bool x2 = processResponse(response2, result2);
|
||||||
|
|
||||||
|
int m_iCurrentJbiJobLine_tmp = result2.toInt();
|
||||||
|
|
||||||
|
|
||||||
|
if (m_iCurrentJbiJobLine_tmp != m_iCurrentJbiJobLine)
|
||||||
|
{
|
||||||
|
m_iFileCounter++;
|
||||||
|
|
||||||
|
qDebug() << "Changed! CurrentJobLine:" << m_iCurrentJbiJobLine_tmp;
|
||||||
|
//<2F><><EFBFBD><EFBFBD><EFBFBD>źţ<C5BA><C5A3><EFBFBD><EFBFBD><EFBFBD>ֹͣ<CDA3>ɼ<EFBFBD>
|
||||||
|
emit hsiRecordSignal(-1);
|
||||||
|
|
||||||
|
m_iCurrentJbiJobLine = m_iCurrentJbiJobLine_tmp;
|
||||||
|
|
||||||
|
//<2F><><EFBFBD><EFBFBD><EFBFBD>źţ<C5BA><C5A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD>ɼ<EFBFBD>
|
||||||
|
emit hsiRecordSignal(m_iFileCounter);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void RobotController::sendCommand(const QString& cmd, const QJsonValue& params, int id)
|
||||||
|
{
|
||||||
|
QJsonObject request;
|
||||||
|
request["method"] = cmd;
|
||||||
|
request["params"] = params;
|
||||||
|
request["jsonrpc"] = "2.0";
|
||||||
|
request["id"] = id;
|
||||||
|
|
||||||
|
QJsonDocument doc(request);
|
||||||
|
QByteArray data = doc.toJson(QJsonDocument::Compact) + "\n";
|
||||||
|
//qDebug() << "send command:" << data.constData();
|
||||||
|
|
||||||
|
socket->write(data);
|
||||||
|
socket->waitForBytesWritten();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool RobotController::onReadyRead(QJsonObject& re)
|
||||||
|
{
|
||||||
|
QByteArray data = socket->readAll();
|
||||||
|
QJsonDocument doc = QJsonDocument::fromJson(data);
|
||||||
|
if (!doc.isNull() && doc.isObject())
|
||||||
|
{
|
||||||
|
re = doc.object();
|
||||||
|
//qDebug() << "Received all:" << re;
|
||||||
|
|
||||||
|
if (re.contains("result"))
|
||||||
|
{
|
||||||
|
//qDebug() << "Received result:" << re["result"].toVariant();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else if (re.contains("error"))
|
||||||
|
{
|
||||||
|
//qDebug() << "Received error:" << re["error"];
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
//emit commandResponse(true, doc.object());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//emit commandResponse(false, QJsonObject());
|
||||||
|
|
||||||
|
re = QJsonObject();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool RobotController::getRobotPose(QJsonObject& re)
|
||||||
|
{
|
||||||
|
sendCommand("getRobotPose");
|
||||||
|
socket->waitForReadyRead(m_iTimeout);
|
||||||
|
|
||||||
|
return onReadyRead(re);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool RobotController::getRobotState(QJsonObject& re)
|
||||||
|
{
|
||||||
|
sendCommand("getRobotState");
|
||||||
|
socket->waitForReadyRead(m_iTimeout);
|
||||||
|
|
||||||
|
return onReadyRead(re);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool RobotController::getJbiState(QJsonObject& re)
|
||||||
|
{
|
||||||
|
sendCommand("getJbiState");
|
||||||
|
socket->waitForReadyRead(m_iTimeout);
|
||||||
|
|
||||||
|
return onReadyRead(re);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool RobotController::getCurrentJobLine(QJsonObject& re)
|
||||||
|
{
|
||||||
|
sendCommand("getCurrentJobLine");
|
||||||
|
socket->waitForReadyRead(m_iTimeout);
|
||||||
|
|
||||||
|
return onReadyRead(re);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool RobotController::getRobotMode(QJsonObject& re)
|
||||||
|
{
|
||||||
|
sendCommand("getRobotMode");
|
||||||
|
socket->waitForReadyRead(m_iTimeout);
|
||||||
|
|
||||||
|
return onReadyRead(re);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool RobotController::checkJbiExist(const QString& jbiFilename, QJsonObject& re)
|
||||||
|
{
|
||||||
|
QJsonObject paramsRunJbi;
|
||||||
|
paramsRunJbi["filename"] = jbiFilename;//ʹ<>ö<EFBFBD><C3B6><EFBFBD><EFBFBD>ṹ
|
||||||
|
|
||||||
|
sendCommand("checkJbiExist", paramsRunJbi);
|
||||||
|
socket->waitForReadyRead(m_iTimeout);
|
||||||
|
|
||||||
|
return onReadyRead(re);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool RobotController::setServoStatus(int status, QJsonObject& re)
|
||||||
|
{
|
||||||
|
QJsonObject params_set_servo_status;
|
||||||
|
params_set_servo_status["status"] = status;//ʹ<>ö<EFBFBD><C3B6><EFBFBD><EFBFBD>ṹ
|
||||||
|
|
||||||
|
sendCommand("set_servo_status", params_set_servo_status);
|
||||||
|
socket->waitForReadyRead(m_iTimeout);
|
||||||
|
|
||||||
|
return onReadyRead(re);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool RobotController::runJbi(const QString& jbiFilename, QJsonObject& re, bool isRecordHsi)
|
||||||
|
{
|
||||||
|
QJsonObject paramsRunJbi;
|
||||||
|
paramsRunJbi["filename"] = jbiFilename;//ʹ<>ö<EFBFBD><C3B6><EFBFBD><EFBFBD>ṹ
|
||||||
|
|
||||||
|
sendCommand("runJbi", paramsRunJbi);
|
||||||
|
socket->waitForReadyRead(m_iTimeout);
|
||||||
|
|
||||||
|
if (isRecordHsi)
|
||||||
|
{
|
||||||
|
m_timer->start(1000);
|
||||||
|
}
|
||||||
|
|
||||||
|
return onReadyRead(re);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool RobotController::pauseTask(QJsonObject& re)
|
||||||
|
{
|
||||||
|
sendCommand("pause");
|
||||||
|
socket->waitForReadyRead(m_iTimeout);
|
||||||
|
|
||||||
|
return onReadyRead(re);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool RobotController::run(QJsonObject& re)
|
||||||
|
{
|
||||||
|
sendCommand("run");
|
||||||
|
socket->waitForReadyRead(m_iTimeout);
|
||||||
|
|
||||||
|
return onReadyRead(re);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool RobotController::continueTask(QJsonObject& re)
|
||||||
|
{
|
||||||
|
sendCommand("run");
|
||||||
|
socket->waitForReadyRead(m_iTimeout);
|
||||||
|
|
||||||
|
return onReadyRead(re);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool RobotController::setRobotPowerStatus(int status, QJsonObject& re)
|
||||||
|
{
|
||||||
|
sendCommand("set_robot_power_status", QJsonArray{ status });
|
||||||
|
socket->waitForReadyRead(m_iTimeout);
|
||||||
|
|
||||||
|
return onReadyRead(re);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
EC8056::EC8056(QObject* parent) : QObject(parent), socket(new QTcpSocket(this))
|
||||||
|
{
|
||||||
|
connect(socket, &QTcpSocket::readyRead, this, &EC8056::onReadyRead);
|
||||||
|
/*connect(socket, QOverload<QAbstractSocket::SocketError>::of(&QTcpSocket::errorOccurred),
|
||||||
|
this, &EC8056::onSocketError);*/
|
||||||
|
//connect(socket, SIGNAL(error(QAbstractSocket::SocketError)),
|
||||||
|
// this, SLOT(onSocketError(QAbstractSocket::SocketError)));
|
||||||
|
}
|
||||||
|
|
||||||
|
void EC8056::connectToHost(const QString& host, quint16 port)
|
||||||
|
{
|
||||||
|
socket->setProxy(QNetworkProxy::NoProxy);
|
||||||
|
|
||||||
|
socket->connectToHost(QHostAddress(host), port);
|
||||||
|
|
||||||
|
if (!socket->waitForConnected(3000)) {
|
||||||
|
qDebug() << "Connection failed:" << socket->errorString();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
qDebug() << "Connected successfully!";
|
||||||
|
}
|
||||||
|
|
||||||
|
quint8 EC8056::readUInt8(const QByteArray& buf, int& offset)
|
||||||
|
{
|
||||||
|
return static_cast<quint8>(buf[offset++]);
|
||||||
|
}
|
||||||
|
|
||||||
|
quint32 EC8056::readUInt32(const QByteArray& buf, int& offset)
|
||||||
|
{
|
||||||
|
quint32 val;
|
||||||
|
memcpy(&val, buf.constData() + offset, sizeof(val));
|
||||||
|
offset += sizeof(val);
|
||||||
|
return qFromBigEndian(val);
|
||||||
|
}
|
||||||
|
|
||||||
|
qint32 EC8056::readInt32(const QByteArray& buf, int& offset)
|
||||||
|
{
|
||||||
|
qint32 val;
|
||||||
|
memcpy(&val, buf.constData() + offset, sizeof(val));
|
||||||
|
offset += sizeof(val);
|
||||||
|
return qFromBigEndian(val);
|
||||||
|
}
|
||||||
|
|
||||||
|
quint64 EC8056::readUInt64(const QByteArray& buf, int& offset)
|
||||||
|
{
|
||||||
|
quint64 val;
|
||||||
|
memcpy(&val, buf.constData() + offset, sizeof(val));
|
||||||
|
offset += sizeof(val);
|
||||||
|
return qFromBigEndian(val);
|
||||||
|
}
|
||||||
|
|
||||||
|
double EC8056::readDouble(const QByteArray& buf, int& offset)
|
||||||
|
{
|
||||||
|
QByteArray b = buf.mid(offset, sizeof(double));
|
||||||
|
offset += sizeof(double);
|
||||||
|
if (QSysInfo::ByteOrder == QSysInfo::LittleEndian)
|
||||||
|
std::reverse(b.begin(), b.end());
|
||||||
|
|
||||||
|
double val;
|
||||||
|
memcpy(&val, b.constData(), sizeof(double));
|
||||||
|
return val;
|
||||||
|
}
|
||||||
|
|
||||||
|
void EC8056::onReadyRead()
|
||||||
|
{
|
||||||
|
buffer.append(socket->readAll());
|
||||||
|
|
||||||
|
if (buffer.size() < 1024)
|
||||||
|
return;
|
||||||
|
|
||||||
|
int offset = 0;
|
||||||
|
ECData data;
|
||||||
|
|
||||||
|
data.msgSize = readUInt32(buffer, offset);
|
||||||
|
offset = 1020;
|
||||||
|
data.matchingWord = readUInt32(buffer, offset);
|
||||||
|
|
||||||
|
if ((data.msgSize == 1024)/* && (data.matchingWord == 3967833836)*/)
|
||||||
|
{
|
||||||
|
offset = 0;
|
||||||
|
|
||||||
|
data.msgSize = readUInt32(buffer, offset);
|
||||||
|
data.timeStamp = readUInt64(buffer, offset);
|
||||||
|
data.auto_cycle = readUInt8(buffer, offset);
|
||||||
|
|
||||||
|
for (int i = 0; i < 8; ++i) data.machinePos[i] = readDouble(buffer, offset);
|
||||||
|
for (int i = 0; i < 6; ++i) data.machinePose[i] = readDouble(buffer, offset);
|
||||||
|
for (int i = 0; i < 6; ++i) data.machineUserPose[i] = readDouble(buffer, offset);
|
||||||
|
for (int i = 0; i < 8; ++i) data.torque[i] = readDouble(buffer, offset);
|
||||||
|
|
||||||
|
data.robotState = readUInt32(buffer, offset);
|
||||||
|
data.servoReady = readUInt32(buffer, offset);
|
||||||
|
data.can_motor_run = readUInt32(buffer, offset);
|
||||||
|
|
||||||
|
for (int i = 0; i < 8; ++i) data.motor_speed[i] = readInt32(buffer, offset);
|
||||||
|
|
||||||
|
data.robotMode = readUInt32(buffer, offset);
|
||||||
|
|
||||||
|
for (int i = 0; i < 3; ++i) data.analog_ioInput[i] = readDouble(buffer, offset);
|
||||||
|
for (int i = 0; i < 5; ++i) data.analog_ioOutput[i] = readDouble(buffer, offset);
|
||||||
|
|
||||||
|
data.digital_ioInput = readUInt64(buffer, offset);
|
||||||
|
data.digital_ioOutput = readUInt64(buffer, offset);
|
||||||
|
|
||||||
|
data.collision = readUInt8(buffer, offset);
|
||||||
|
|
||||||
|
for (int i = 0; i < 6; ++i) data.machineFlangePose[i] = readDouble(buffer, offset);
|
||||||
|
for (int i = 0; i < 6; ++i) data.machineUserFlangePose[i] = readDouble(buffer, offset);
|
||||||
|
|
||||||
|
data.emergencyStopState = readUInt8(buffer, offset);
|
||||||
|
data.tcpSpeed = readDouble(buffer, offset);
|
||||||
|
for (int i = 0; i < 8; ++i) data.joIntSpeed[i] = readDouble(buffer, offset);
|
||||||
|
data.tcpAcc = readDouble(buffer, offset);
|
||||||
|
for (int i = 0; i < 8; ++i) data.joIntAcc[i] = readDouble(buffer, offset);
|
||||||
|
for (int i = 0; i < 6; ++i) data.joIntTemperature[i] = readDouble(buffer, offset);
|
||||||
|
for (int i = 0; i < 6; ++i) data.joIntTorque[i] = readDouble(buffer, offset);
|
||||||
|
for (int i = 0; i < 6; ++i) data.extJoIntTorques[i] = readDouble(buffer, offset);
|
||||||
|
for (int i = 0; i < 6; ++i) data.exTcpForceIntool[i] = readDouble(buffer, offset);
|
||||||
|
|
||||||
|
data.dragState = readUInt8(buffer, offset);
|
||||||
|
data.sensor_connected_state = readUInt8(buffer, offset);
|
||||||
|
data.reserved = readUInt8(buffer, offset);
|
||||||
|
data.matchingWord = readUInt32(buffer, offset);
|
||||||
|
|
||||||
|
/*if (data.msgSize != 1024 || data.matchingWord != 0xec8056ec) {
|
||||||
|
buffer.clear();
|
||||||
|
emit errorOccurred("Invalid packet received");
|
||||||
|
return;
|
||||||
|
}*/
|
||||||
|
|
||||||
|
emit dataReceived(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
buffer.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
void EC8056::onSocketError(QAbstractSocket::SocketError socketError)
|
||||||
|
{
|
||||||
|
Q_UNUSED(socketError)
|
||||||
|
emit errorOccurred(socket->errorString());
|
||||||
|
}
|
||||||
164
HPPA/RobotArmControl.h
Normal file
164
HPPA/RobotArmControl.h
Normal file
@ -0,0 +1,164 @@
|
|||||||
|
#pragma once
|
||||||
|
#include <qdialog.h>
|
||||||
|
#include <QTcpSocket>
|
||||||
|
#include <QJsonDocument>
|
||||||
|
#include <QJsonObject>
|
||||||
|
#include <QJsonArray>
|
||||||
|
#include <QDebug>
|
||||||
|
#include <QThread>
|
||||||
|
#include <QNetworkProxy>
|
||||||
|
#include <QtEndian>
|
||||||
|
#include <QNetworkAccessManager>
|
||||||
|
#include <QNetworkReply>
|
||||||
|
#include <QAuthenticator>
|
||||||
|
#include <QDebug>
|
||||||
|
#include <QRegularExpression>
|
||||||
|
#include <QProcess>
|
||||||
|
#include <QStringListModel>
|
||||||
|
#include <QTimer>
|
||||||
|
|
||||||
|
#include "ui_RobotArmControl.h"
|
||||||
|
#include "fileOperation.h"
|
||||||
|
|
||||||
|
|
||||||
|
struct ECData
|
||||||
|
{
|
||||||
|
quint32 msgSize;
|
||||||
|
quint64 timeStamp;
|
||||||
|
quint8 auto_cycle;
|
||||||
|
double machinePos[8];//<2F>ؽ<EFBFBD><D8BD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
|
double machinePose[6];//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
|
double machineUserPose[6];//<2F>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD>
|
||||||
|
double torque[8];//<2F>ؽڶ<DAB6><EEB6A8><EFBFBD>ذٷֱ<D9B7>
|
||||||
|
quint32 robotState;//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>״̬
|
||||||
|
quint32 servoReady;//<2F>ŷ<EFBFBD>ʹ<EFBFBD><CAB9>״̬
|
||||||
|
quint32 can_motor_run;//ͬ<><CDAC>״̬
|
||||||
|
qint32 motor_speed[8];//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ת<EFBFBD><D7AA>
|
||||||
|
quint32 robotMode;//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ģʽ
|
||||||
|
double analog_ioInput[3];//ģ<><C4A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
|
double analog_ioOutput[5];//ģ<><C4A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
|
quint64 digital_ioInput;//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݵĶ<DDB5><C4B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ
|
||||||
|
quint64 digital_ioOutput;//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݵĶ<DDB5><C4B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ
|
||||||
|
quint8 collision;//<2F><>ײ<EFBFBD><D7B2><EFBFBD><EFBFBD>״̬
|
||||||
|
double machineFlangePose[6];//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵ<EFBFBD>µķ<C2B5><C4B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><CEBB>
|
||||||
|
double machineUserFlangePose[6];//<2F>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD>ϵ<EFBFBD>µķ<C2B5><C4B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><CEBB>
|
||||||
|
quint8 emergencyStopState;//<2F><>ǰ<EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD>ڼ<EFBFBD>ͣ״̬
|
||||||
|
double tcpSpeed;//tcp<63>˶<EFBFBD><CBB6>ٶ<EFBFBD>
|
||||||
|
double joIntSpeed[8];//<2F>ؽ<EFBFBD><D8BD>˶<EFBFBD><CBB6>¸<EFBFBD><C2B8>ؽ<EFBFBD><D8BD>˶<EFBFBD><CBB6>ٶ<EFBFBD>
|
||||||
|
double tcpAcc;//tcp<63><70><EFBFBD>ٶ<EFBFBD>
|
||||||
|
double joIntAcc[8];//<2F>ؽ<EFBFBD><D8BD>˶<EFBFBD><CBB6>¸<EFBFBD><C2B8>ؽڼ<D8BD><DABC>ٶ<EFBFBD>
|
||||||
|
double joIntTemperature[6];//<2F>¶<EFBFBD>
|
||||||
|
double joIntTorque[6];//<2F><><EFBFBD><EFBFBD>Ť<EFBFBD><C5A4>
|
||||||
|
double extJoIntTorques[6];//<2F>ⲿ<EFBFBD>ؽ<EFBFBD>Ť<EFBFBD><C5A4>ֵ
|
||||||
|
double exTcpForceIntool[6];//<2F><>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵ<EFBFBD>µ<EFBFBD><C2B5>ⲿĩ<E2B2BF><C4A9><EFBFBD><EFBFBD>/<2F><><EFBFBD>ع<EFBFBD><D8B9><EFBFBD>ֵ
|
||||||
|
quint8 dragState;//<2F>϶<EFBFBD>ʹ<EFBFBD><CAB9>״̬
|
||||||
|
quint8 sensor_connected_state;//<2F><><EFBFBD>ش<EFBFBD><D8B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>״̬
|
||||||
|
quint8 reserved;
|
||||||
|
quint32 matchingWord;
|
||||||
|
};
|
||||||
|
|
||||||
|
class EC8056 : public QObject
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit EC8056(QObject* parent = nullptr);
|
||||||
|
void connectToHost(const QString& host, quint16 port= 8056);
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void dataReceived(const ECData& data);
|
||||||
|
void errorOccurred(const QString& error);
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void onReadyRead();
|
||||||
|
void onSocketError(QAbstractSocket::SocketError socketError);
|
||||||
|
|
||||||
|
private:
|
||||||
|
QTcpSocket* socket;
|
||||||
|
QByteArray buffer;
|
||||||
|
|
||||||
|
double readDouble(const QByteArray& buf, int& offset);
|
||||||
|
quint64 readUInt64(const QByteArray& buf, int& offset);
|
||||||
|
quint32 readUInt32(const QByteArray& buf, int& offset);
|
||||||
|
qint32 readInt32(const QByteArray& buf, int& offset);
|
||||||
|
quint8 readUInt8(const QByteArray& buf, int& offset);
|
||||||
|
};
|
||||||
|
|
||||||
|
class RobotController : public QObject
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
explicit RobotController(QObject* parent = nullptr);
|
||||||
|
~RobotController();
|
||||||
|
|
||||||
|
bool connectToRobot(const QString& ip, quint16 port = 8055);
|
||||||
|
void disconnectFromRobot();
|
||||||
|
void sendCommand(const QString& cmd, const QJsonValue& params = QJsonArray(), int id = 1);
|
||||||
|
bool processResponse(QJsonObject response, QString& re);
|
||||||
|
bool processResponse_getJbiState(QJsonObject response, QString& result);
|
||||||
|
|
||||||
|
bool getRobotPose(QJsonObject& re);
|
||||||
|
bool getRobotState(QJsonObject& re);//ֹͣ״̬ 0<><30><EFBFBD><EFBFBD>ͣ״̬ 1<><31><EFBFBD><EFBFBD>ͣ״̬ 2<><32><EFBFBD><EFBFBD><EFBFBD><EFBFBD>״̬ 3<><33><EFBFBD><EFBFBD><EFBFBD><EFBFBD>״̬ 4<><34><EFBFBD><EFBFBD>ײ״̬ 5
|
||||||
|
bool getJbiState(QJsonObject& re);//0 ֹͣ״̬,1 <20><>ͣ״̬,2 <20><>ͣ״̬,3 <20><><EFBFBD><EFBFBD>״̬,4 <20><><EFBFBD><EFBFBD>״̬
|
||||||
|
bool getCurrentJobLine(QJsonObject& re);
|
||||||
|
bool getRobotMode(QJsonObject& re);//ʾ<><CABE>ģʽ 0<><30><EFBFBD>Զ<EFBFBD>ģʽ 1<><31>Զ<EFBFBD><D4B6>ģʽ 2
|
||||||
|
bool checkJbiExist(const QString& jbiFilename, QJsonObject& re);
|
||||||
|
bool setServoStatus(int status, QJsonObject& re);
|
||||||
|
bool runJbi(const QString& jbiFilename, QJsonObject& re, bool isRecordHsi);
|
||||||
|
bool pauseTask(QJsonObject& re);
|
||||||
|
bool run(QJsonObject& re);
|
||||||
|
bool continueTask(QJsonObject& re);
|
||||||
|
bool setRobotPowerStatus(int status, QJsonObject& re);
|
||||||
|
|
||||||
|
bool onReadyRead(QJsonObject& re);
|
||||||
|
|
||||||
|
private:
|
||||||
|
QTcpSocket* socket;
|
||||||
|
|
||||||
|
QTimer* m_timer;
|
||||||
|
int m_iTimeout = 3000;
|
||||||
|
int m_iCurrentJbiJobLine = 0;
|
||||||
|
int m_iFileCounter = 0;
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void commandResponse(bool success, const QJsonObject& response);
|
||||||
|
void hsiRecordSignal(int);
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void getPoint();
|
||||||
|
};
|
||||||
|
|
||||||
|
class RobotArmControl : public QDialog
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
RobotArmControl(QWidget* parent = nullptr);
|
||||||
|
~RobotArmControl();
|
||||||
|
RobotController* robotController;
|
||||||
|
|
||||||
|
void onCommandResponse(QString str, const QJsonObject& response);
|
||||||
|
|
||||||
|
public Q_SLOTS:
|
||||||
|
|
||||||
|
void getTaskList();
|
||||||
|
void getPose();
|
||||||
|
|
||||||
|
void connectRobotArm();
|
||||||
|
void executeTaskWithHyperImager();
|
||||||
|
void executeTaskWithoutHyperImager();
|
||||||
|
void pauseTask();
|
||||||
|
void continueTask();
|
||||||
|
|
||||||
|
void monitorRobotArm(const ECData& data);
|
||||||
|
|
||||||
|
signals:
|
||||||
|
//void Opened();
|
||||||
|
//void Closed();
|
||||||
|
|
||||||
|
private:
|
||||||
|
Ui::RobotArmControl_UI ui;
|
||||||
|
|
||||||
|
EC8056* robotMonitor;
|
||||||
|
QStringListModel* m_pModel;
|
||||||
|
};
|
||||||
138
HPPA/RobotArmControl.ui
Normal file
138
HPPA/RobotArmControl.ui
Normal file
@ -0,0 +1,138 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>RobotArmControl_UI</class>
|
||||||
|
<widget class="QDialog" name="RobotArmControl_UI">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>424</width>
|
||||||
|
<height>364</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>Dialog</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QGridLayout" name="gridLayout_3">
|
||||||
|
<item row="2" column="1">
|
||||||
|
<widget class="QPushButton" name="pause_task_btn">
|
||||||
|
<property name="text">
|
||||||
|
<string>暂停任务</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="1">
|
||||||
|
<widget class="QPushButton" name="connect2arm_btn">
|
||||||
|
<property name="text">
|
||||||
|
<string>连接机械臂</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="1">
|
||||||
|
<widget class="QPushButton" name="execute_task_btn">
|
||||||
|
<property name="text">
|
||||||
|
<string>执行任务</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="4" column="1">
|
||||||
|
<widget class="QPushButton" name="get_pose_btn">
|
||||||
|
<property name="text">
|
||||||
|
<string>获取pose</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="1">
|
||||||
|
<widget class="QPushButton" name="continue_task_btn">
|
||||||
|
<property name="text">
|
||||||
|
<string>继续任务</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="5" column="1">
|
||||||
|
<widget class="QTextEdit" name="textEdit"/>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="0" rowspan="6">
|
||||||
|
<widget class="QFrame" name="frame_2">
|
||||||
|
<property name="frameShape">
|
||||||
|
<enum>QFrame::StyledPanel</enum>
|
||||||
|
</property>
|
||||||
|
<property name="frameShadow">
|
||||||
|
<enum>QFrame::Raised</enum>
|
||||||
|
</property>
|
||||||
|
<layout class="QGridLayout" name="gridLayout_2">
|
||||||
|
<property name="leftMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="horizontalSpacing">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QPushButton" name="get_task_list_btn">
|
||||||
|
<property name="text">
|
||||||
|
<string>获取任务列表</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="QListView" name="taskList_listView"/>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="6" column="0" colspan="2">
|
||||||
|
<widget class="QFrame" name="frame">
|
||||||
|
<property name="frameShape">
|
||||||
|
<enum>QFrame::StyledPanel</enum>
|
||||||
|
</property>
|
||||||
|
<property name="frameShadow">
|
||||||
|
<enum>QFrame::Raised</enum>
|
||||||
|
</property>
|
||||||
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
|
<item row="0" column="2">
|
||||||
|
<widget class="QLabel" name="pose_z_label">
|
||||||
|
<property name="text">
|
||||||
|
<string>z</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QLabel" name="pose_x_label">
|
||||||
|
<property name="text">
|
||||||
|
<string>x</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="1">
|
||||||
|
<widget class="QLabel" name="pose_y_label">
|
||||||
|
<property name="text">
|
||||||
|
<string>y</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<resources/>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
||||||
@ -9,7 +9,7 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>523</width>
|
<width>629</width>
|
||||||
<height>463</height>
|
<height>463</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
@ -25,7 +25,7 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>90</x>
|
<x>90</x>
|
||||||
<y>250</y>
|
<y>250</y>
|
||||||
<width>341</width>
|
<width>434</width>
|
||||||
<height>134</height>
|
<height>134</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
@ -70,7 +70,7 @@
|
|||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>版本:1.8.5</string>
|
<string>版本:1.8.8</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QLabel" name="label_4">
|
<widget class="QLabel" name="label_4">
|
||||||
|
|||||||
@ -12,6 +12,10 @@ adjustTable::adjustTable(QWidget *parent)
|
|||||||
connect(ui.objective_table2_up_btn, SIGNAL(clicked()), this, SLOT(onObjectivTable2Up_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_down_btn, SIGNAL(clicked()), this, SLOT(onObjectivTable2Down_btn()));
|
||||||
connect(ui.objective_table2_stop_btn, SIGNAL(clicked()), this, SLOT(onObjectivTable2Stop_btn()));
|
connect(ui.objective_table2_stop_btn, SIGNAL(clicked()), this, SLOT(onObjectivTable2Stop_btn()));
|
||||||
|
|
||||||
|
connect(ui.objective_table252_up_btn, SIGNAL(clicked()), this, SLOT(onObjectivTable252Up_btn()));
|
||||||
|
connect(ui.objective_table252_down_btn, SIGNAL(clicked()), this, SLOT(onObjectivTable252Down_btn()));
|
||||||
|
connect(ui.objective_table252_stop_btn, SIGNAL(clicked()), this, SLOT(onObjectivTable252Stop_btn()));
|
||||||
}
|
}
|
||||||
|
|
||||||
adjustTable::~adjustTable()
|
adjustTable::~adjustTable()
|
||||||
@ -63,3 +67,21 @@ void adjustTable::onObjectivTable2Stop_btn()
|
|||||||
QString xx = "http://192.168.1.254/stopnow";
|
QString xx = "http://192.168.1.254/stopnow";
|
||||||
getRequest(xx);
|
getRequest(xx);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void adjustTable::onObjectivTable252Up_btn()
|
||||||
|
{
|
||||||
|
QString xx = "http://192.168.1.252/set_up";
|
||||||
|
getRequest(xx);
|
||||||
|
}
|
||||||
|
|
||||||
|
void adjustTable::onObjectivTable252Down_btn()
|
||||||
|
{
|
||||||
|
QString xx = "http://192.168.1.252/set_down";
|
||||||
|
getRequest(xx);
|
||||||
|
}
|
||||||
|
|
||||||
|
void adjustTable::onObjectivTable252Stop_btn()
|
||||||
|
{
|
||||||
|
QString xx = "http://192.168.1.252/stopnow";
|
||||||
|
getRequest(xx);
|
||||||
|
}
|
||||||
@ -24,6 +24,10 @@ public Q_SLOTS:
|
|||||||
void onObjectivTable2Down_btn();
|
void onObjectivTable2Down_btn();
|
||||||
void onObjectivTable2Stop_btn();
|
void onObjectivTable2Stop_btn();
|
||||||
|
|
||||||
|
void onObjectivTable252Up_btn();
|
||||||
|
void onObjectivTable252Down_btn();
|
||||||
|
void onObjectivTable252Stop_btn();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::adjustTableClass ui;
|
Ui::adjustTableClass ui;
|
||||||
|
|
||||||
|
|||||||
@ -6,33 +6,66 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>348</width>
|
<width>687</width>
|
||||||
<height>194</height>
|
<height>389</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>adjustTable</string>
|
<string>adjustTable</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout">
|
<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">
|
<item row="0" column="0">
|
||||||
|
<widget class="QGroupBox" name="groupBox_8">
|
||||||
|
<property name="title">
|
||||||
|
<string>252号升降台</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QGridLayout" name="gridLayout_10">
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QPushButton" name="objective_table252_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_table252_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_table252_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_7">
|
<widget class="QGroupBox" name="groupBox_7">
|
||||||
<property name="title">
|
<property name="title">
|
||||||
<string>1号升降台</string>
|
<string>253号升降台</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout_11">
|
<layout class="QGridLayout" name="gridLayout_11">
|
||||||
<item row="0" column="0">
|
<item row="0" column="0">
|
||||||
@ -77,10 +110,10 @@
|
|||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="1">
|
<item row="0" column="2">
|
||||||
<widget class="QGroupBox" name="groupBox_6">
|
<widget class="QGroupBox" name="groupBox_6">
|
||||||
<property name="title">
|
<property name="title">
|
||||||
<string>2号升降台</string>
|
<string>254号升降台</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout_9">
|
<layout class="QGridLayout" name="gridLayout_9">
|
||||||
<item row="0" column="0">
|
<item row="0" column="0">
|
||||||
|
|||||||
@ -101,6 +101,17 @@ bool createDir(QString fullPath)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string removeFileExtension(std::string filename)
|
||||||
|
{
|
||||||
|
size_t lastDot = filename.find_last_of(".");
|
||||||
|
if (lastDot == std::string::npos) {
|
||||||
|
// 如果没有找到后缀,返回原字符串
|
||||||
|
return filename;
|
||||||
|
}
|
||||||
|
return filename.substr(0, lastDot);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
QList<QString> getFileInfo(QString file)
|
QList<QString> getFileInfo(QString file)
|
||||||
{
|
{
|
||||||
QFileInfo fileInfo = QFileInfo(file);
|
QFileInfo fileInfo = QFileInfo(file);
|
||||||
|
|||||||
@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <ctime>
|
#include <ctime>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
@ -18,6 +19,7 @@ void bubbleSort(unsigned short * a, int n);
|
|||||||
void swap(unsigned short * a, unsigned short * b);
|
void swap(unsigned short * a, unsigned short * b);
|
||||||
|
|
||||||
bool createDir(QString fullPath);
|
bool createDir(QString fullPath);
|
||||||
|
std::string removeFileExtension(std::string filename);
|
||||||
|
|
||||||
QList<QString> getFileInfo(QString file);
|
QList<QString> getFileInfo(QString file);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user