3 Commits
1.5 ... 1.7

Author SHA1 Message Date
9fa9fc8efb 添加升降台控制功能 2024-11-29 11:15:58 +08:00
8e3315338f add:添加控制升降台功能 2024-06-20 16:26:54 +08:00
868b60ff67 1、修复bug:关闭-打开马达电源后,总有一个马达连接不上,通过删掉重建马达对象解决;
2、将任总的马达控制库加入本工程;
2024-03-15 14:45:33 +08:00
6 changed files with 245 additions and 22 deletions

View File

@ -1,20 +1,39 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.28307.1267
# Visual Studio Version 17
VisualStudioVersion = 17.5.33502.453
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "HPPA", "HPPA\HPPA.vcxproj", "{E7886664-B69E-4781-BCBE-804574FB4033}"
ProjectSection(ProjectDependencies) = postProject
{B12702AD-ABFB-343A-A199-8E24837244A3} = {B12702AD-ABFB-343A-A199-8E24837244A3}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "vincecontrol", "..\..\cpp_project_vs2019\vincecontrol\vincecontrol\vincecontrol.vcxproj", "{B12702AD-ABFB-343A-A199-8E24837244A3}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{E7886664-B69E-4781-BCBE-804574FB4033}.Debug|x64.ActiveCfg = Debug|x64
{E7886664-B69E-4781-BCBE-804574FB4033}.Debug|x64.Build.0 = Debug|x64
{E7886664-B69E-4781-BCBE-804574FB4033}.Debug|x86.ActiveCfg = Debug|x64
{E7886664-B69E-4781-BCBE-804574FB4033}.Debug|x86.Build.0 = Debug|x64
{E7886664-B69E-4781-BCBE-804574FB4033}.Release|x64.ActiveCfg = Release|x64
{E7886664-B69E-4781-BCBE-804574FB4033}.Release|x64.Build.0 = Release|x64
{E7886664-B69E-4781-BCBE-804574FB4033}.Release|x86.ActiveCfg = Release|x64
{E7886664-B69E-4781-BCBE-804574FB4033}.Release|x86.Build.0 = Release|x64
{B12702AD-ABFB-343A-A199-8E24837244A3}.Debug|x64.ActiveCfg = Debug|x64
{B12702AD-ABFB-343A-A199-8E24837244A3}.Debug|x64.Build.0 = Debug|x64
{B12702AD-ABFB-343A-A199-8E24837244A3}.Debug|x86.ActiveCfg = Debug|Win32
{B12702AD-ABFB-343A-A199-8E24837244A3}.Debug|x86.Build.0 = Debug|Win32
{B12702AD-ABFB-343A-A199-8E24837244A3}.Release|x64.ActiveCfg = Release|x64
{B12702AD-ABFB-343A-A199-8E24837244A3}.Release|x64.Build.0 = Release|x64
{B12702AD-ABFB-343A-A199-8E24837244A3}.Release|x86.ActiveCfg = Release|Win32
{B12702AD-ABFB-343A-A199-8E24837244A3}.Release|x86.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

View File

@ -105,12 +105,10 @@ HPPA::HPPA(QWidget *parent)
//<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_xConnectCount = 0;
m_yConnectCount = 0;
m_xMotor = nullptr;
m_yMotor = nullptr;
newMotor();
//m_TestXmotorStausThread = new MotorWorkerThread(m_xMotor);
@ -179,7 +177,6 @@ HPPA::HPPA(QWidget *parent)
connect(ui.graphicsView->imager, SIGNAL(leftMouseButtonPressed(int, int)), this, SLOT(onimagerSimulatorMove(int, int)));
connect(m_xMotor, SIGNAL(SendLogToCallClass(QString)), this, SLOT(OnSendLogToCallClass(QString)));
//<2F><EFBFBD>ɼ<EFBFBD><C9BC><EFBFBD>
ui.recordLine_tableWidget->setFocusPolicy(Qt::NoFocus);
@ -268,6 +265,15 @@ HPPA::HPPA(QWidget *parent)
float StepAnglemar_y, Lead_y, ScaleFactor_y;
int SubdivisionMultiples_y;
configfile.getYMotorParm(StepAnglemar_y, Lead_y, SubdivisionMultiples_y, ScaleFactor_y);*/
//
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()));
}
HPPA::~HPPA()
@ -275,6 +281,8 @@ HPPA::~HPPA()
if (m_Imager != nullptr)
m_Imager->~ResononImager();//<2F>ͷ<EFBFBD><CDB7><EFBFBD>Դ
if (m_xMotor != nullptr && m_yMotor != nullptr)
{
if (isMotorConnected(m_xMotor))
{
m_xMotor->StopMotormove();
@ -284,6 +292,7 @@ HPPA::~HPPA()
m_yMotor->StopMotormove();
}
}
}
void HPPA::CalculateIntegratioinTimeRange()
{
@ -407,6 +416,11 @@ void HPPA::onStartRecordStep1()
void HPPA::onStartRecordStep2(int lineNumber)
{
if (m_xMotor == nullptr && m_yMotor == nullptr)
{
return;
}
if (lineNumber >= 0)
{
m_numberOfRecording = lineNumber;
@ -637,6 +651,12 @@ void HPPA::timerEvent(QTimerEvent *event)
{
try
{
if (m_xMotor == nullptr || m_yMotor == nullptr)
{
qDebug() << "Motor pointer is null!!!!!";
return;
}
if (!m_xMotor->IsMotorInit)
{
//return;
@ -644,7 +664,7 @@ void HPPA::timerEvent(QTimerEvent *event)
}
ByteBack xMotorState = m_xMotor->GetState();//ִ<><D6B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
std::cout << "------------------------------------------<2D><><EFBFBD><EFBFBD><EFBFBD>ٶȣ<D9B6>" << xMotorState.Speed << std::endl;
std::cout << "------------------------------------------x<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ٶȣ<EFBFBD>" << xMotorState.Speed << std::endl;
if (xMotorState.Speed == -1000000)
{
@ -1638,12 +1658,48 @@ 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)
{
return;
}
//<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_xConnectCount = 0;
m_yConnectCount = 0;
connect(m_xMotor, SIGNAL(SendLogToCallClass(QString)), this, SLOT(OnSendLogToCallClass(QString)));
connect(m_yMotor, SIGNAL(SendLogToCallClass(QString)), this, SLOT(OnSendLogToCallClass(QString)));
}
void HPPA::deleteMotor()
{
disconnect(m_xMotor, SIGNAL(SendLogToCallClass(QString)), this, SLOT(OnSendLogToCallClass(QString)));
disconnect(m_yMotor, SIGNAL(SendLogToCallClass(QString)), this, SLOT(OnSendLogToCallClass(QString)));
delete m_xMotor;
delete m_yMotor;
m_xMotor = nullptr;
m_yMotor = nullptr;
xmotor_state_label1->setStyleSheet("QLabel{background-color:rgb(255,0,0);}");
ymotor_state_label1->setStyleSheet("QLabel{background-color:rgb(255,0,0);}");
}
void HPPA::requestFinished(QNetworkReply* reply) {
@ -1666,6 +1722,42 @@ 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();

View File

@ -203,6 +203,8 @@ private:
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);
void SetYMotorWidgetEnable(bool enable);
@ -319,6 +321,13 @@ public Q_SLOTS:
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

@ -285,7 +285,7 @@
</size>
</property>
<property name="currentIndex">
<number>3</number>
<number>4</number>
</property>
<widget class="QWidget" name="tab">
<attribute name="title">
@ -1682,6 +1682,109 @@
</item>
</layout>
</widget>
<widget class="QWidget" name="tab_7">
<attribute name="title">
<string>升降台</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_12">
<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>
</item>
@ -1697,7 +1800,7 @@
<x>0</x>
<y>0</y>
<width>2213</width>
<height>37</height>
<height>30</height>
</rect>
</property>
<widget class="QMenu" name="file">

View File

@ -55,8 +55,8 @@
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<IncludePath>D:\cpp_library\vincecontrol_vs2017;D:\cpp_library\gdal2.2.3_vs2017\include;C:\Program Files\ResononAPI\include;D:\cpp_library\opencv3.4.11\opencv\build\include;D:\cpp_library\opencv3.4.11\opencv\build\include\opencv;D:\cpp_library\opencv3.4.11\opencv\build\include\opencv2;D:\cpp_project_vs2022\AutoFocus_InspireLinearMotor_DLL\AutoFocus_InspireLinearMotor_DLL\SDKs\PCOMM\Include;D:\cpp_project_vs2022\AutoFocus_InspireLinearMotor_DLL\AutoFocus_InspireLinearMotor_DLL\SDKs\PortControl;D:\cpp_project_vs2022\AutoFocus_InspireLinearMotor_DLL\AutoFocus_InspireLinearMotor_DLL;D:\cpp_project_vs2022\HPPA\HPPA;D:\cpp_library\libconfig-1.7.3\lib;$(IncludePath)</IncludePath>
<LibraryPath>D:\cpp_library\opencv3.4.11\opencv\build\x64\vc15\lib;D:\cpp_library\vincecontrol_vs2017;D:\cpp_library\gdal2.2.3_vs2017\lib;C:\Program Files\ResononAPI\lib64;D:\cpp_project_vs2022\AutoFocus_InspireLinearMotor_DLL\x64\Debug;D:\cpp_library\libconfig-1.7.3\build\x64;$(LibraryPath)</LibraryPath>
<IncludePath>D:\cpp_library\gdal2.2.3_vs2017\include;C:\Program Files\ResononAPI\include;D:\cpp_library\opencv3.4.11\opencv\build\include;D:\cpp_library\opencv3.4.11\opencv\build\include\opencv;D:\cpp_library\opencv3.4.11\opencv\build\include\opencv2;D:\cpp_project_vs2022\AutoFocus_InspireLinearMotor_DLL\AutoFocus_InspireLinearMotor_DLL\SDKs\PCOMM\Include;D:\cpp_project_vs2022\AutoFocus_InspireLinearMotor_DLL\AutoFocus_InspireLinearMotor_DLL\SDKs\PortControl;D:\cpp_project_vs2022\AutoFocus_InspireLinearMotor_DLL\AutoFocus_InspireLinearMotor_DLL;D:\cpp_project_vs2022\HPPA\HPPA;D:\cpp_library\libconfig-1.7.3\lib;D:\cpp_project_vs2022\HPPA - 副本\vincecontrol;$(IncludePath)</IncludePath>
<LibraryPath>D:\cpp_library\opencv3.4.11\opencv\build\x64\vc15\lib;D:\cpp_library\gdal2.2.3_vs2017\lib;C:\Program Files\ResononAPI\lib64;D:\cpp_project_vs2022\AutoFocus_InspireLinearMotor_DLL\x64\Debug;D:\cpp_library\libconfig-1.7.3\build\x64;D:\cpp_project_vs2022\HPPA - 副本\vincecontrol\x64\Debug;$(LibraryPath)</LibraryPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<IncludePath>D:\cpp_library\vincecontrol_vs2017;D:\cpp_library\gdal2.2.3_vs2017\include;C:\Program Files\ResononAPI\include;D:\cpp_library\opencv3.4.11\opencv\build\include;D:\cpp_library\opencv3.4.11\opencv\build\include\opencv;D:\cpp_library\opencv3.4.11\opencv\build\include\opencv2;D:\cpp_project_vs2022\AutoFocus_InspireLinearMotor_DLL\AutoFocus_InspireLinearMotor_DLL\SDKs\PCOMM\Include;D:\cpp_project_vs2022\AutoFocus_InspireLinearMotor_DLL\AutoFocus_InspireLinearMotor_DLL\SDKs\PortControl;D:\cpp_project_vs2022\AutoFocus_InspireLinearMotor_DLL\AutoFocus_InspireLinearMotor_DLL;D:\cpp_project_vs2022\HPPA\HPPA;D:\cpp_library\libconfig-1.7.3\lib;$(IncludePath)</IncludePath>
@ -64,7 +64,7 @@
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Link>
<AdditionalDependencies>opencv_world3411.lib;opencv_world3411d.lib;vincecontrol.lib;gdal_i.lib;resonon-basler.lib;AutoFocus_InspireLinearMotor_DLL.lib;libconfig++d.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>opencv_world3411.lib;opencv_world3411d.lib;gdal_i.lib;resonon-basler.lib;AutoFocus_InspireLinearMotor_DLL.lib;libconfig++d.lib;vincecontrol.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
<ClCompile>
<PreprocessorDefinitions>%(PreprocessorDefinitions)</PreprocessorDefinitions>

View File

@ -70,7 +70,7 @@
</rect>
</property>
<property name="text">
<string>版本1.5</string>
<string>版本1.7</string>
</property>
</widget>
<widget class="QLabel" name="label_4">