Compare commits
10 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 20848bef1a | |||
| f6138dd2ed | |||
| f32ade7487 | |||
| 89c701c5f2 | |||
| a7fd9e4fa9 | |||
| 5af6a039c2 | |||
| b779118d72 | |||
| 380e8042d9 | |||
| 0e46470402 | |||
| cbc81cb75e |
@ -6,8 +6,8 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>1312</width>
|
<width>600</width>
|
||||||
<height>752</height>
|
<height>332</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
|
|||||||
966
HPPA/HPPA.cpp
966
HPPA/HPPA.cpp
File diff suppressed because it is too large
Load Diff
57
HPPA/HPPA.h
57
HPPA/HPPA.h
@ -26,9 +26,14 @@
|
|||||||
#include "fileOperation.h"
|
#include "fileOperation.h"
|
||||||
#include "RgbCameraOperation.h"
|
#include "RgbCameraOperation.h"
|
||||||
#include "imageProcessor.h"
|
#include "imageProcessor.h"
|
||||||
|
#include "fileOperation.h"
|
||||||
|
|
||||||
#include "focusWindow.h"
|
#include "focusWindow.h"
|
||||||
#include "aboutWindow.h"
|
#include "aboutWindow.h"
|
||||||
|
#include "adjustTable.h"
|
||||||
|
#include "PowerControl.h"
|
||||||
|
#include "PathPlan.h"
|
||||||
|
#include "RobotArmControl.h"
|
||||||
|
|
||||||
#include "hppaConfigFile.h"
|
#include "hppaConfigFile.h"
|
||||||
#include "path_tc.h"
|
#include "path_tc.h"
|
||||||
@ -160,12 +165,18 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::HPPAClass ui;
|
Ui::HPPAClass ui;
|
||||||
|
|
||||||
|
QMenu* mPanelMenu = nullptr;
|
||||||
|
QMenu* mToolbarMenu = nullptr;
|
||||||
|
|
||||||
|
void initPanelToolbar();
|
||||||
|
|
||||||
QLineEdit * frame_number;
|
QLineEdit * frame_number;
|
||||||
QLineEdit * m_FilenameLineEdit;
|
QLineEdit * m_FilenameLineEdit;
|
||||||
QLabel * xmotor_state_label1;
|
QLabel * xmotor_state_label1;
|
||||||
QLabel * ymotor_state_label1;
|
QLabel * ymotor_state_label1;
|
||||||
|
|
||||||
Configfile configfile;
|
Configfile mConfigfile;
|
||||||
|
|
||||||
ForLoopControl * m_ForLoopControl;
|
ForLoopControl * m_ForLoopControl;
|
||||||
ImagerOperationBase* m_Imager;//
|
ImagerOperationBase* m_Imager;//
|
||||||
@ -205,10 +216,6 @@ private:
|
|||||||
QTimer *m_timerYmotorLocationFeedBackAfterRecord;//<2F>ɼ<EFBFBD>Ӱ<EFBFBD><D3B0><EFBFBD><EFBFBD><EFBFBD>ɺ<C9BA><F3A3ACBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><CEBB>ʵʱ<CAB5><CAB1><EFBFBD>ص<EFBFBD>slider<65><72>
|
QTimer *m_timerYmotorLocationFeedBackAfterRecord;//<2F>ɼ<EFBFBD>Ӱ<EFBFBD><D3B0><EFBFBD><EFBFBD><EFBFBD>ɺ<C9BA><F3A3ACBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><CEBB>ʵʱ<CAB5><CAB1><EFBFBD>ص<EFBFBD>slider<65><72>
|
||||||
|
|
||||||
QString operateWidget;//<2F><>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD><EFBFBD>Ŀؼ<C4BF><D8BC><EFBFBD>
|
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
|
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 SetXMotorWidgetEnable(bool enable);
|
||||||
@ -230,9 +237,17 @@ 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;
|
||||||
|
|
||||||
|
FILE* m_hTimesFile;
|
||||||
|
|
||||||
public Q_SLOTS:
|
public Q_SLOTS:
|
||||||
void onPlotHyperspectralImageRgbImage();
|
void onPlotHyperspectralImageRgbImage();
|
||||||
@ -248,7 +263,9 @@ public Q_SLOTS:
|
|||||||
void onFocus2(int command);
|
void onFocus2(int command);
|
||||||
void onAbout();
|
void onAbout();
|
||||||
void onDark();
|
void onDark();
|
||||||
|
void recordDarkFinish();
|
||||||
void onReference();
|
void onReference();
|
||||||
|
void recordWhiteFinish();
|
||||||
void onStartRecordStep1();
|
void onStartRecordStep1();
|
||||||
void onStartRecordStep2(int lineNumber);
|
void onStartRecordStep2(int lineNumber);
|
||||||
void onCreateTab(int trackNumber);
|
void onCreateTab(int trackNumber);
|
||||||
@ -267,8 +284,12 @@ public Q_SLOTS:
|
|||||||
|
|
||||||
|
|
||||||
//<2F><><EFBFBD><EFBFBD>
|
//<2F><><EFBFBD><EFBFBD>
|
||||||
|
void deleteMotor();
|
||||||
|
void newMotor();
|
||||||
void timerEvent(QTimerEvent *event);
|
void timerEvent(QTimerEvent *event);
|
||||||
void setMotorParamMicroscope(VinceControl* motor);
|
void setMotorParamMicroscope(VinceControl* motor);
|
||||||
|
void setXMotorParamFromCfgFile(VinceControl* motor);
|
||||||
|
void setYMotorParamFromCfgFile(VinceControl* motor);
|
||||||
|
|
||||||
|
|
||||||
void onxMotorLeft();
|
void onxMotorLeft();
|
||||||
@ -303,14 +324,6 @@ public Q_SLOTS:
|
|||||||
void ontimerTestRangeOfxMotor();
|
void ontimerTestRangeOfxMotor();
|
||||||
void ontimerTestRangeOfyMotor();
|
void ontimerTestRangeOfyMotor();
|
||||||
|
|
||||||
//<2F>ɼ<EFBFBD><C9BC>߹滮
|
|
||||||
void onAddRecordLine_btn();
|
|
||||||
void onRemoveRecordLine_btn();
|
|
||||||
void onGenerateRecordLine_btn();
|
|
||||||
void onDeleteRecordLine_btn();
|
|
||||||
void onSaveRecordLine2File_btn();
|
|
||||||
void onReadRecordLineFile_btn();
|
|
||||||
|
|
||||||
void ontimerMoveXmotor();
|
void ontimerMoveXmotor();
|
||||||
void ontimerMoveYmotor();
|
void ontimerMoveYmotor();
|
||||||
|
|
||||||
@ -324,26 +337,18 @@ public Q_SLOTS:
|
|||||||
|
|
||||||
void onCopyFinished();
|
void onCopyFinished();
|
||||||
|
|
||||||
void onLampPowerOpen_btn();
|
|
||||||
void onLampPowerClose_btn();
|
|
||||||
|
|
||||||
void onMotorPowerOpen_btn();
|
|
||||||
void onMotorPowerClose_btn();
|
|
||||||
|
|
||||||
void requestFinished(QNetworkReply* reply);
|
void requestFinished(QNetworkReply* reply);
|
||||||
|
|
||||||
void onObjectivTable1Up_btn();
|
void recordFromRobotArm(int fileCounter);
|
||||||
void onObjectivTable1Down_btn();
|
|
||||||
void onObjectivTable1Stop_btn();
|
|
||||||
void onObjectivTable2Up_btn();
|
|
||||||
void onObjectivTable2Down_btn();
|
|
||||||
void onObjectivTable2Stop_btn();
|
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void StartFocusSignal();
|
void StartFocusSignal();
|
||||||
void StartLoopSignal();
|
void StartLoopSignal();
|
||||||
void StartRecordSignal();
|
void StartRecordSignal();
|
||||||
void CopyFileThreadSignal(QString, QString);
|
void CopyFileThreadSignal(QString, QString);
|
||||||
|
void BroadcastXMotorPosSignal(long long, int);
|
||||||
|
|
||||||
|
void RecordWhiteSignal();
|
||||||
|
void RecordDarlSignal();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
3111
HPPA/HPPA.ui
3111
HPPA/HPPA.ui
File diff suppressed because it is too large
Load Diff
@ -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>
|
||||||
@ -105,14 +105,18 @@
|
|||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="aboutWindow.cpp" />
|
<ClCompile Include="aboutWindow.cpp" />
|
||||||
|
<ClCompile Include="adjustTable.cpp" />
|
||||||
<ClCompile Include="hppaConfigFile.cpp" />
|
<ClCompile Include="hppaConfigFile.cpp" />
|
||||||
<ClCompile Include="ImagerOperationBase.cpp" />
|
<ClCompile Include="ImagerOperationBase.cpp" />
|
||||||
|
<ClCompile Include="PathPlan.cpp" />
|
||||||
<ClCompile Include="path_tc.cpp" />
|
<ClCompile Include="path_tc.cpp" />
|
||||||
|
<ClCompile Include="PowerControl.cpp" />
|
||||||
<ClCompile Include="QDoubleSlider.cpp" />
|
<ClCompile Include="QDoubleSlider.cpp" />
|
||||||
<ClCompile Include="QMotorDoubleSlider.cpp" />
|
<ClCompile Include="QMotorDoubleSlider.cpp" />
|
||||||
<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>
|
||||||
@ -120,6 +124,7 @@
|
|||||||
<ClCompile Include="utility_tc.cpp" />
|
<ClCompile Include="utility_tc.cpp" />
|
||||||
<QtRcc Include="HPPA.qrc" />
|
<QtRcc Include="HPPA.qrc" />
|
||||||
<QtUic Include="about.ui" />
|
<QtUic Include="about.ui" />
|
||||||
|
<QtUic Include="adjustTable.ui" />
|
||||||
<QtUic Include="FocusDialog.ui" />
|
<QtUic Include="FocusDialog.ui" />
|
||||||
<QtUic Include="HPPA.ui" />
|
<QtUic Include="HPPA.ui" />
|
||||||
<QtMoc Include="HPPA.h" />
|
<QtMoc Include="HPPA.h" />
|
||||||
@ -133,6 +138,9 @@
|
|||||||
<ClCompile Include="imagerSimulatioin.cpp" />
|
<ClCompile Include="imagerSimulatioin.cpp" />
|
||||||
<ClCompile Include="ImageViewer.cpp" />
|
<ClCompile Include="ImageViewer.cpp" />
|
||||||
<ClCompile Include="main.cpp" />
|
<ClCompile Include="main.cpp" />
|
||||||
|
<QtUic Include="PathPlan.ui" />
|
||||||
|
<QtUic Include="PowerControl.ui" />
|
||||||
|
<QtUic Include="RobotArmControl.ui" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<QtMoc Include="fileOperation.h" />
|
<QtMoc Include="fileOperation.h" />
|
||||||
@ -144,6 +152,10 @@
|
|||||||
<QtMoc Include="image2display.h" />
|
<QtMoc Include="image2display.h" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<QtMoc Include="adjustTable.h" />
|
||||||
|
<QtMoc Include="PowerControl.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" />
|
||||||
|
|||||||
@ -97,6 +97,18 @@
|
|||||||
<ClCompile Include="utility_tc.cpp">
|
<ClCompile Include="utility_tc.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="adjustTable.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="PowerControl.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="PathPlan.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="RobotArmControl.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<QtMoc Include="fileOperation.h">
|
<QtMoc Include="fileOperation.h">
|
||||||
@ -135,6 +147,18 @@
|
|||||||
<QtMoc Include="ImagerOperationBase.h">
|
<QtMoc Include="ImagerOperationBase.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</QtMoc>
|
</QtMoc>
|
||||||
|
<QtMoc Include="adjustTable.h">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</QtMoc>
|
||||||
|
<QtMoc Include="PowerControl.h">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</QtMoc>
|
||||||
|
<QtMoc Include="PathPlan.h">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</QtMoc>
|
||||||
|
<QtMoc Include="RobotArmControl.h">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</QtMoc>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="imageProcessor.h">
|
<ClInclude Include="imageProcessor.h">
|
||||||
@ -169,6 +193,18 @@
|
|||||||
<QtUic Include="about.ui">
|
<QtUic Include="about.ui">
|
||||||
<Filter>Form Files</Filter>
|
<Filter>Form Files</Filter>
|
||||||
</QtUic>
|
</QtUic>
|
||||||
|
<QtUic Include="adjustTable.ui">
|
||||||
|
<Filter>Form Files</Filter>
|
||||||
|
</QtUic>
|
||||||
|
<QtUic Include="PowerControl.ui">
|
||||||
|
<Filter>Form Files</Filter>
|
||||||
|
</QtUic>
|
||||||
|
<QtUic Include="PathPlan.ui">
|
||||||
|
<Filter>Form Files</Filter>
|
||||||
|
</QtUic>
|
||||||
|
<QtUic Include="RobotArmControl.ui">
|
||||||
|
<Filter>Form Files</Filter>
|
||||||
|
</QtUic>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="cpp.hint" />
|
<None Include="cpp.hint" />
|
||||||
|
|||||||
@ -37,6 +37,7 @@ ImageViewer::ImageViewer(QWidget* pParent) :QGraphicsView(pParent)
|
|||||||
|
|
||||||
setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||||
setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||||
|
setFrameShape(QFrame::NoFrame);
|
||||||
}
|
}
|
||||||
|
|
||||||
ImageViewer::~ImageViewer()
|
ImageViewer::~ImageViewer()
|
||||||
|
|||||||
@ -111,17 +111,59 @@ void ImagerOperationBase::record_dark()
|
|||||||
{
|
{
|
||||||
std::cout << "<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>" << std::endl;
|
std::cout << "<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>" << std::endl;
|
||||||
imagerStartCollect();
|
imagerStartCollect();
|
||||||
getFrame(dark);
|
|
||||||
|
unsigned int* dark_tmp = new unsigned int[m_FrameSize];
|
||||||
|
std::fill(dark_tmp, dark_tmp + m_FrameSize, 0);
|
||||||
|
|
||||||
|
int counter = 50;
|
||||||
|
for (size_t i = 0; i < counter; i++)
|
||||||
|
{
|
||||||
|
getFrame(dark);
|
||||||
|
|
||||||
|
for (size_t j = 0; j < m_FrameSize; j++)
|
||||||
|
{
|
||||||
|
dark_tmp[j] = dark[j] + dark_tmp[j];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (size_t j = 0; j < m_FrameSize; j++)
|
||||||
|
{
|
||||||
|
dark[j] = (unsigned short)(dark_tmp[j] / counter);
|
||||||
|
}
|
||||||
|
delete[] dark_tmp;
|
||||||
|
|
||||||
imagerStopCollect();
|
imagerStopCollect();
|
||||||
|
|
||||||
m_HasDark = true;
|
m_HasDark = true;
|
||||||
|
|
||||||
|
emit RecordDarlFinishSignal();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ImagerOperationBase::record_white()
|
void ImagerOperationBase::record_white()
|
||||||
{
|
{
|
||||||
std::cout << "<EFBFBD>ɼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>װ壡<EFBFBD><EFBFBD><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><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>" << std::endl;
|
||||||
imagerStartCollect();
|
imagerStartCollect();
|
||||||
getFrame(white);
|
|
||||||
|
unsigned int* white_tmp = new unsigned int[m_FrameSize];
|
||||||
|
std::fill(white_tmp, white_tmp + m_FrameSize, 0);
|
||||||
|
|
||||||
|
int counter = 50;
|
||||||
|
for (size_t i = 0; i < counter; i++)
|
||||||
|
{
|
||||||
|
getFrame(white);
|
||||||
|
|
||||||
|
for (size_t j = 0; j < m_FrameSize; j++)
|
||||||
|
{
|
||||||
|
white_tmp[j] = white[j] + white_tmp[j];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (size_t j = 0; j < m_FrameSize; j++)
|
||||||
|
{
|
||||||
|
white[j] = (unsigned short)(white_tmp[j] / counter);
|
||||||
|
}
|
||||||
|
delete[] white_tmp;
|
||||||
|
|
||||||
imagerStopCollect();
|
imagerStopCollect();
|
||||||
|
|
||||||
//<2F>װ<EFBFBD><D7B0>۰<EFBFBD><DBB0><EFBFBD><EFBFBD><EFBFBD>
|
//<2F>װ<EFBFBD><D7B0>۰<EFBFBD><DBB0><EFBFBD><EFBFBD><EFBFBD>
|
||||||
@ -141,6 +183,8 @@ void ImagerOperationBase::record_white()
|
|||||||
}
|
}
|
||||||
|
|
||||||
m_HasWhite = true;
|
m_HasWhite = true;
|
||||||
|
|
||||||
|
emit RecordWhiteFinishSignal();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ImagerOperationBase::start_record()
|
void ImagerOperationBase::start_record()
|
||||||
@ -160,21 +204,22 @@ 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.c_str(), "w+b");
|
|
||||||
|
|
||||||
size_t x;
|
size_t x;
|
||||||
double pixelValueTmp;
|
double pixelValueTmp;
|
||||||
|
|
||||||
|
string timesFile = removeFileExtension(m_FileName2Save2) + ".times";
|
||||||
|
FILE* hTimesFile = fopen(timesFile.c_str(), "w+");
|
||||||
|
|
||||||
imagerStartCollect();
|
imagerStartCollect();
|
||||||
while (m_bRecordControlState)
|
while (m_bRecordControlState)
|
||||||
{
|
{
|
||||||
m_iFrameCounter++;
|
m_iFrameCounter++;
|
||||||
|
|
||||||
getFrame(buffer);
|
getFrame(buffer);
|
||||||
|
long long timeOs = getNanosecondsSinceMidnight();
|
||||||
|
|
||||||
//<2F><>ȥ<EFBFBD><C8A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӦΪbuffer<65><72>dark<72><6B><EFBFBD><EFBFBD>unsigned short<72><74><EFBFBD><EFBFBD><EFBFBD>Ե<EFBFBD>dark>bufferʱ<72><CAB1>buffer-dark=65535
|
//<2F><>ȥ<EFBFBD><C8A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӦΪbuffer<65><72>dark<72><6B><EFBFBD><EFBFBD>unsigned short<72><74><EFBFBD><EFBFBD><EFBFBD>Ե<EFBFBD>dark>bufferʱ<72><CAB1>buffer-dark=65535
|
||||||
if (m_HasDark)
|
if (m_HasDark)
|
||||||
@ -215,6 +260,7 @@ void ImagerOperationBase::start_record()
|
|||||||
}
|
}
|
||||||
|
|
||||||
x = fwrite(buffer, 2, m_FrameSize, m_fImage);
|
x = fwrite(buffer, 2, m_FrameSize, m_fImage);
|
||||||
|
fprintf(hTimesFile, "%d\n", timeOs);
|
||||||
|
|
||||||
//<2F><>rgb<67><62><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ա<EFBFBD><D4B1>ڽ<EFBFBD><DABD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ
|
//<2F><>rgb<67><62><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ա<EFBFBD><D4B1>ڽ<EFBFBD><DABD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ
|
||||||
m_RgbImage->FillRgbImage(buffer);//??????????????????????????????????????????????????????????????????????????????????????????????????????
|
m_RgbImage->FillRgbImage(buffer);//??????????????????????????????????????????????????????????????????????????????????????????????????????
|
||||||
@ -241,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)
|
||||||
{
|
{
|
||||||
@ -254,6 +300,7 @@ void ImagerOperationBase::start_record()
|
|||||||
|
|
||||||
//QThread::msleep(1001);
|
//QThread::msleep(1001);
|
||||||
fclose(m_fImage);
|
fclose(m_fImage);
|
||||||
|
fclose(hTimesFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ImagerOperationBase::setFrameNumber(int FrameNumber)
|
void ImagerOperationBase::setFrameNumber(int FrameNumber)
|
||||||
@ -354,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";
|
||||||
|
|||||||
@ -7,6 +7,7 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <opencv2/core/core.hpp>
|
#include <opencv2/core/core.hpp>
|
||||||
#include "ImagerOperationBase.h"
|
#include "ImagerOperationBase.h"
|
||||||
|
#include "utility_tc.h"
|
||||||
|
|
||||||
class ImagerOperationBase :public QObject
|
class ImagerOperationBase :public QObject
|
||||||
{
|
{
|
||||||
@ -65,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
|
||||||
@ -97,6 +99,9 @@ signals:
|
|||||||
void RecordFinishedSignal_WhenFrameNumberNotMeet();//<2F>ɼ<EFBFBD><C9BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>źţ<C5BA><C5A3><EFBFBD>Ҫ<EFBFBD>ɼ<EFBFBD><C9BC><EFBFBD><EFBFBD><EFBFBD>֡<EFBFBD><D6A1><EFBFBD><EFBFBD>m_iFrameNumber<65><72>û<EFBFBD>вɼ<D0B2><C9BC><EFBFBD><EFBFBD>ɣ<EFBFBD><C9A3><EFBFBD>;ֹͣ<CDA3>ɼ<EFBFBD>
|
void RecordFinishedSignal_WhenFrameNumberNotMeet();//<2F>ɼ<EFBFBD><C9BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>źţ<C5BA><C5A3><EFBFBD>Ҫ<EFBFBD>ɼ<EFBFBD><C9BC><EFBFBD><EFBFBD><EFBFBD>֡<EFBFBD><D6A1><EFBFBD><EFBFBD>m_iFrameNumber<65><72>û<EFBFBD>вɼ<D0B2><C9BC><EFBFBD><EFBFBD>ɣ<EFBFBD><C9A3><EFBFBD>;ֹͣ<CDA3>ɼ<EFBFBD>
|
||||||
void SpectralSignal(int);//<2F><><EFBFBD><EFBFBD>1<EFBFBD><31><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڵ<EFBFBD><DAB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƹ<EFBFBD><C6B9>ף<EFBFBD><D7A3><EFBFBD><EFBFBD><EFBFBD>0<EFBFBD><30>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɣ<EFBFBD>
|
void SpectralSignal(int);//<2F><><EFBFBD><EFBFBD>1<EFBFBD><31><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڵ<EFBFBD><DAB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƹ<EFBFBD><C6B9>ף<EFBFBD><D7A3><EFBFBD><EFBFBD><EFBFBD>0<EFBFBD><30>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɣ<EFBFBD>
|
||||||
|
|
||||||
|
void RecordWhiteFinishSignal();
|
||||||
|
void RecordDarlFinishSignal();
|
||||||
|
|
||||||
|
|
||||||
void testImagerStatus();//<2F><>ʾ<EFBFBD><CABE><EFBFBD>Բ<EFBFBD><D4B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>״̬<D7B4><CCAC><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD>ӣ<EFBFBD><D3A3><EFBFBD><EFBFBD><EFBFBD>ӳ<EFBFBD><D3B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
void testImagerStatus();//<2F><>ʾ<EFBFBD><CABE><EFBFBD>Բ<EFBFBD><D4B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>״̬<D7B4><CCAC><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD>ӣ<EFBFBD><D3A3><EFBFBD><EFBFBD><EFBFBD>ӳ<EFBFBD><D3B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
};
|
};
|
||||||
|
|||||||
308
HPPA/PathPlan.cpp
Normal file
308
HPPA/PathPlan.cpp
Normal file
@ -0,0 +1,308 @@
|
|||||||
|
#include "PathPlan.h"
|
||||||
|
#include <iostream>
|
||||||
|
#include <QMessageBox>
|
||||||
|
#include <QFileDialog>
|
||||||
|
#include <fileOperation.h>
|
||||||
|
|
||||||
|
PathPlan::PathPlan(VinceControl* xMotor, VinceControl* yMotor, QMotorDoubleSlider* xSlider, QMotorDoubleSlider* ySlider, QWidget* parent)
|
||||||
|
: QDialog(parent)
|
||||||
|
{
|
||||||
|
ui.setupUi(this);
|
||||||
|
|
||||||
|
m_xMotor = xMotor;
|
||||||
|
m_yMotor = yMotor;
|
||||||
|
|
||||||
|
m_xSlider = xSlider;
|
||||||
|
m_ySlider = ySlider;
|
||||||
|
|
||||||
|
ui.recordLine_tableWidget->setFocusPolicy(Qt::NoFocus);
|
||||||
|
ui.recordLine_tableWidget->setStyleSheet("selection-background-color:rgb(255,209,128)");//<2F><><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD>и<EFBFBD><D0B8><EFBFBD>
|
||||||
|
|
||||||
|
ui.recordLine_tableWidget->setSelectionBehavior(QAbstractItemView::SelectRows);//<2F><><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>λ
|
||||||
|
//ui.recordLine_tableWidget->setSelectionMode(QAbstractItemView::SingleSelection);//<2F><><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1>ģʽ<C4A3><CABD>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
|
//QHeaderView* headerView = ui.recordLine_tableWidget->verticalHeader();
|
||||||
|
//headerView->setHidden(true);//ȥ<><C8A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ĭ<EFBFBD><C4AC><EFBFBD>Դ<EFBFBD><D4B4><EFBFBD><EFBFBD>к<EFBFBD>
|
||||||
|
|
||||||
|
|
||||||
|
ui.recordLine_tableWidget->setColumnCount(2);
|
||||||
|
ui.recordLine_tableWidget->setHorizontalHeaderLabels(QStringList() << "yPosition" << "xMaxPosition");
|
||||||
|
|
||||||
|
connect(ui.addRecordLine_btn, SIGNAL(clicked()), this, SLOT(onAddRecordLine_btn()));
|
||||||
|
connect(ui.removeRecordLine_btn, SIGNAL(clicked()), this, SLOT(onRemoveRecordLine_btn()));
|
||||||
|
connect(ui.generateRecordLine_btn, SIGNAL(clicked()), this, SLOT(onGenerateRecordLine_btn()));
|
||||||
|
connect(ui.deleteRecordLine_btn, SIGNAL(clicked()), this, SLOT(onDeleteRecordLine_btn()));
|
||||||
|
connect(ui.saveRecordLine2File_btn, SIGNAL(clicked()), this, SLOT(onSaveRecordLine2File_btn()));
|
||||||
|
connect(ui.readRecordLineFile_btn, SIGNAL(clicked()), this, SLOT(onReadRecordLineFile_btn()));
|
||||||
|
}
|
||||||
|
|
||||||
|
PathPlan::~PathPlan()
|
||||||
|
{}
|
||||||
|
|
||||||
|
void PathPlan::setMotor(VinceControl* xMotor, VinceControl* yMotor)
|
||||||
|
{
|
||||||
|
m_xMotor = xMotor;
|
||||||
|
m_yMotor = yMotor;
|
||||||
|
}
|
||||||
|
|
||||||
|
QTableWidget* PathPlan::getRecordLineTableWidget()
|
||||||
|
{
|
||||||
|
return ui.recordLine_tableWidget;
|
||||||
|
}
|
||||||
|
|
||||||
|
void PathPlan::onAddRecordLine_btn()
|
||||||
|
{
|
||||||
|
//<><D7BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
|
ByteBack MotorState = m_yMotor->GetState();
|
||||||
|
double currentPosOfYmotor = m_ySlider->getDistanceFromPulse(MotorState.Location);
|
||||||
|
double maxRangeOfXmotro = m_xSlider->maximum();
|
||||||
|
|
||||||
|
//<2F><>ȡѡ<C8A1><D1A1><EFBFBD>е<EFBFBD><D0B5><EFBFBD><EFBFBD><EFBFBD>
|
||||||
|
int currentRow = ui.recordLine_tableWidget->currentRow();
|
||||||
|
std::cout << "currentRow<EFBFBD><EFBFBD>" << currentRow << std::endl;
|
||||||
|
|
||||||
|
QTableWidgetItem* Item1 = new QTableWidgetItem(QString::number(currentPosOfYmotor, 10, 2));
|
||||||
|
QTableWidgetItem* Item2 = new QTableWidgetItem(QString::number(maxRangeOfXmotro, 10, 2));
|
||||||
|
Item1->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
|
||||||
|
Item2->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
|
||||||
|
if (currentRow == -1)//<2F><>û<EFBFBD><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD>ʱ
|
||||||
|
{
|
||||||
|
int RowCount = ui.recordLine_tableWidget->rowCount();//Returns the number of rows. <20><>1<EFBFBD><31>ʼ<EFBFBD><CABC>
|
||||||
|
ui.recordLine_tableWidget->insertRow(RowCount);//<2F><><EFBFBD><EFBFBD>һ<EFBFBD>У<EFBFBD><D0A3>β<EFBFBD><CEB2>Ǵ<EFBFBD>0<EFBFBD><30>ʼ<EFBFBD><CABC>
|
||||||
|
|
||||||
|
ui.recordLine_tableWidget->setItem(RowCount, 0, Item1);
|
||||||
|
ui.recordLine_tableWidget->setItem(RowCount, 1, Item2);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ui.recordLine_tableWidget->insertRow(currentRow + 1);//<2F><><EFBFBD><EFBFBD>һ<EFBFBD>У<EFBFBD><D0A3>β<EFBFBD><CEB2>Ǵ<EFBFBD>0<EFBFBD><30>ʼ<EFBFBD><CABC>
|
||||||
|
|
||||||
|
ui.recordLine_tableWidget->setItem(currentRow + 1, 0, Item1);
|
||||||
|
ui.recordLine_tableWidget->setItem(currentRow + 1, 1, Item2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void PathPlan::onRemoveRecordLine_btn()
|
||||||
|
{
|
||||||
|
int rowIndex = ui.recordLine_tableWidget->currentRow();
|
||||||
|
if (rowIndex != -1)
|
||||||
|
ui.recordLine_tableWidget->removeRow(rowIndex);
|
||||||
|
}
|
||||||
|
|
||||||
|
void PathPlan::onGenerateRecordLine_btn()
|
||||||
|
{
|
||||||
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
|
double height = ui.height_lineEdit->text().toDouble();
|
||||||
|
double fov = ui.fov_lineEdit->text().toDouble();
|
||||||
|
double swath = (height * tan(fov / 2 * PI / 180)) * 2;//tan<61><6E><EFBFBD><EFBFBD><EFBFBD>ǻ<EFBFBD><C7BB><EFBFBD>
|
||||||
|
ui.swath_lineEdit->setText(QString::number(swath));
|
||||||
|
|
||||||
|
|
||||||
|
//<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Χ
|
||||||
|
double xMotorRange = m_xSlider->maximum();
|
||||||
|
double yMotorRange = m_ySlider->maximum();
|
||||||
|
|
||||||
|
|
||||||
|
//ȷ<><C8B7><EFBFBD>ж<EFBFBD><D0B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɼ<EFBFBD><C9BC>ߣ<EFBFBD><DFA3><EFBFBD>ʽ<EFBFBD><CABD>numberOfRecordLine_tmp * swath - repetitiveLength<74><68>numberOfRecordLine_tmp - 1<><31> = overallLength
|
||||||
|
double overallLength = yMotorRange + swath;
|
||||||
|
double repetitiveRate = ui.repetitiveRate_lineEdit->text().toDouble() / 100;
|
||||||
|
double repetitiveLength = repetitiveRate * swath;
|
||||||
|
double offset = ui.offset_lineEdit->text().toDouble();
|
||||||
|
|
||||||
|
double numberOfRecordLine_tmp = (overallLength - repetitiveLength - offset) / (swath - repetitiveLength);
|
||||||
|
double tmp = numberOfRecordLine_tmp - (int)numberOfRecordLine_tmp;
|
||||||
|
int numberOfRecordLine;
|
||||||
|
double threshold = ui.LastLineThreshold_lineEdit->text().toDouble();//<2F><>numberOfRecordLine_tmpΪС<CEAA><D0A1>ʱ<EFBFBD><CAB1><EFBFBD>ж<EFBFBD><D0B6>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD>ɼ<EFBFBD><C9BC><EFBFBD>
|
||||||
|
if (tmp > threshold)
|
||||||
|
{
|
||||||
|
numberOfRecordLine = (int)numberOfRecordLine_tmp + 1;
|
||||||
|
//std::cout << "<22><><EFBFBD>ڣ<EFBFBD>" << threshold << std::endl;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
numberOfRecordLine = (int)numberOfRecordLine_tmp;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//ȥ<><C8A5>tableWidget<65><74><EFBFBD><EFBFBD><EFBFBD>е<EFBFBD><D0B5><EFBFBD>
|
||||||
|
int rowCount = ui.recordLine_tableWidget->rowCount();
|
||||||
|
for (size_t i = 0; i < rowCount; i++)
|
||||||
|
{
|
||||||
|
ui.recordLine_tableWidget->removeRow(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//<2F><>tableWidget<65><74><EFBFBD><EFBFBD><EFBFBD>У<EFBFBD><D0A3>ɼ<EFBFBD><C9BC>ߣ<EFBFBD>
|
||||||
|
QTableWidgetItem* tmpItem;
|
||||||
|
for (size_t i = 0; i < numberOfRecordLine; i++)
|
||||||
|
{
|
||||||
|
//<2F><><EFBFBD><EFBFBD>һ<EFBFBD><D2BB>
|
||||||
|
int RowCount = ui.recordLine_tableWidget->rowCount();
|
||||||
|
ui.recordLine_tableWidget->insertRow(RowCount);
|
||||||
|
|
||||||
|
//<2F><><EFBFBD><EFBFBD>yPosition
|
||||||
|
if (tmp > threshold && i == numberOfRecordLine - 1)//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD>е<EFBFBD>yPosition
|
||||||
|
{
|
||||||
|
tmpItem = new QTableWidgetItem(QString::number(yMotorRange, 10, 2));
|
||||||
|
tmpItem->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
|
||||||
|
ui.recordLine_tableWidget->setItem(i, 0, tmpItem);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
double x = swath * i - i * repetitiveLength + offset;
|
||||||
|
tmpItem = new QTableWidgetItem(QString::number(x, 10, 2));
|
||||||
|
tmpItem->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
|
||||||
|
ui.recordLine_tableWidget->setItem(i, 0, tmpItem);
|
||||||
|
}
|
||||||
|
|
||||||
|
//<2F><><EFBFBD><EFBFBD>x<EFBFBD><78><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˶<EFBFBD>λ<EFBFBD><CEBB> <20><> ֵ<><D6B5><EFBFBD><EFBFBD>Ϊx<CEAA><78><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
|
tmpItem = new QTableWidgetItem(QString::number(xMotorRange, 10, 2));
|
||||||
|
tmpItem->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
|
||||||
|
ui.recordLine_tableWidget->setItem(i, 1, tmpItem);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void PathPlan::onDeleteRecordLine_btn()
|
||||||
|
{
|
||||||
|
int rowCount = ui.recordLine_tableWidget->rowCount();
|
||||||
|
for (size_t i = 0; i < rowCount; i++)
|
||||||
|
{
|
||||||
|
ui.recordLine_tableWidget->removeRow(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void PathPlan::onSaveRecordLine2File_btn()
|
||||||
|
{
|
||||||
|
//ȷ<><C8B7><EFBFBD>ɼ<EFBFBD><C9BC>ߴ<EFBFBD><DFB4><EFBFBD>
|
||||||
|
if (ui.recordLine_tableWidget->rowCount() <= 0)
|
||||||
|
{
|
||||||
|
QMessageBox::information(this, QString::fromLocal8Bit("<EFBFBD><EFBFBD>ʾ"), QString::fromLocal8Bit("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɹ켣<EFBFBD><EFBFBD>"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
double height = ui.height_lineEdit->text().toDouble();
|
||||||
|
double fov = ui.fov_lineEdit->text().toDouble();
|
||||||
|
double swath = ui.swath_lineEdit->text().toDouble();
|
||||||
|
double offset = ui.offset_lineEdit->text().toDouble();
|
||||||
|
double repetitiveRate = ui.repetitiveRate_lineEdit->text().toDouble();
|
||||||
|
double LastLineThreshold = ui.LastLineThreshold_lineEdit->text().toDouble();
|
||||||
|
|
||||||
|
FileOperation* fileOperation = new FileOperation();
|
||||||
|
string directory = fileOperation->getDirectoryOfExe();
|
||||||
|
|
||||||
|
QString RecordLineFilePath = QFileDialog::getSaveFileName(this, tr("Save RecordLine File"),
|
||||||
|
QString::fromStdString(directory),
|
||||||
|
tr("RecordLineFile (*.RecordLine)"));
|
||||||
|
|
||||||
|
if (RecordLineFilePath.isEmpty())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
FILE* RecordLineFileHandle = fopen(RecordLineFilePath.toStdString().c_str(), "wb+");
|
||||||
|
|
||||||
|
fwrite(&height, sizeof(double), 1, RecordLineFileHandle);
|
||||||
|
fwrite(&fov, sizeof(double), 1, RecordLineFileHandle);
|
||||||
|
fwrite(&swath, sizeof(double), 1, RecordLineFileHandle);
|
||||||
|
fwrite(&offset, sizeof(double), 1, RecordLineFileHandle);
|
||||||
|
fwrite(&repetitiveRate, sizeof(double), 1, RecordLineFileHandle);
|
||||||
|
fwrite(&LastLineThreshold, sizeof(double), 1, RecordLineFileHandle);
|
||||||
|
|
||||||
|
double number = ui.recordLine_tableWidget->rowCount() * ui.recordLine_tableWidget->columnCount();
|
||||||
|
fwrite(&number, sizeof(double), 1, RecordLineFileHandle);
|
||||||
|
|
||||||
|
double* data = new double[number];
|
||||||
|
//double data[number];
|
||||||
|
for (size_t i = 0; i < ui.recordLine_tableWidget->rowCount(); i++)
|
||||||
|
{
|
||||||
|
for (size_t j = 0; j < ui.recordLine_tableWidget->columnCount(); j++)
|
||||||
|
{
|
||||||
|
data[i * ui.recordLine_tableWidget->columnCount() + j] = ui.recordLine_tableWidget->item(i, j)->text().toDouble();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fwrite(data, sizeof(double), number, RecordLineFileHandle);
|
||||||
|
|
||||||
|
fclose(RecordLineFileHandle);
|
||||||
|
delete[] data;
|
||||||
|
|
||||||
|
QMessageBox::information(this, QString::fromLocal8Bit("<EFBFBD><EFBFBD>ʾ"), QString::fromLocal8Bit("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD><EFBFBD><EFBFBD>"));
|
||||||
|
}
|
||||||
|
|
||||||
|
void PathPlan::onReadRecordLineFile_btn()
|
||||||
|
{
|
||||||
|
//<2F><><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>
|
||||||
|
FileOperation* fileOperation = new FileOperation();
|
||||||
|
string directory = fileOperation->getDirectoryOfExe();
|
||||||
|
//string RecordLineFilePath = directory + "\\test.RecordLine";
|
||||||
|
|
||||||
|
QString RecordLineFilePath = QFileDialog::getOpenFileName(this, tr("Open RecordLine File"),
|
||||||
|
QString::fromStdString(directory),
|
||||||
|
tr("RecordLineFile (*.RecordLine)"));
|
||||||
|
|
||||||
|
if (RecordLineFilePath.isEmpty())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
FILE* RecordLineFileHandle = fopen(RecordLineFilePath.toStdString().c_str(), "rb");
|
||||||
|
double height, fov, swath, offset, repetitiveRate, LastLineThreshold, number;
|
||||||
|
|
||||||
|
//<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>
|
||||||
|
fread(&height, sizeof(double), 1, RecordLineFileHandle);
|
||||||
|
fread(&fov, sizeof(double), 1, RecordLineFileHandle);
|
||||||
|
fread(&swath, sizeof(double), 1, RecordLineFileHandle);
|
||||||
|
fread(&offset, sizeof(double), 1, RecordLineFileHandle);
|
||||||
|
fread(&repetitiveRate, sizeof(double), 1, RecordLineFileHandle);
|
||||||
|
fread(&LastLineThreshold, sizeof(double), 1, RecordLineFileHandle);
|
||||||
|
fread(&number, sizeof(double), 1, RecordLineFileHandle);
|
||||||
|
|
||||||
|
double* data = new double[number];
|
||||||
|
for (size_t i = 0; i < number; i++)
|
||||||
|
{
|
||||||
|
fread(data + i, sizeof(double), 1, RecordLineFileHandle);
|
||||||
|
//std::cout << *(data + i) << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>д
|
||||||
|
ui.height_lineEdit->setText(QString::number(height));
|
||||||
|
ui.fov_lineEdit->setText(QString::number(fov));
|
||||||
|
ui.swath_lineEdit->setText(QString::number(swath));
|
||||||
|
ui.offset_lineEdit->setText(QString::number(offset));
|
||||||
|
ui.repetitiveRate_lineEdit->setText(QString::number(repetitiveRate));
|
||||||
|
ui.LastLineThreshold_lineEdit->setText(QString::number(LastLineThreshold));
|
||||||
|
|
||||||
|
|
||||||
|
//<2F><>tableWidget<65><74><EFBFBD>Ӳɼ<D3B2><C9BC><EFBFBD>
|
||||||
|
//<2F><>1<EFBFBD><31>ȥ<EFBFBD><C8A5>tableWidget<65><74><EFBFBD><EFBFBD><EFBFBD>е<EFBFBD><D0B5><EFBFBD>
|
||||||
|
int rowCount = ui.recordLine_tableWidget->rowCount();
|
||||||
|
for (size_t i = 0; i < rowCount; i++)
|
||||||
|
{
|
||||||
|
ui.recordLine_tableWidget->removeRow(0);
|
||||||
|
}
|
||||||
|
//<2F><>2<EFBFBD><32><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>У<EFBFBD><D0A3>ɼ<EFBFBD><C9BC>ߣ<EFBFBD>
|
||||||
|
int RecordLineCount = number / ui.recordLine_tableWidget->columnCount();
|
||||||
|
for (size_t i = 0; i < RecordLineCount; i++)
|
||||||
|
{
|
||||||
|
ui.recordLine_tableWidget->insertRow(0);
|
||||||
|
|
||||||
|
}
|
||||||
|
//<2F><>3<EFBFBD><33><EFBFBD><EFBFBD>tableWidget<65><74><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
|
for (size_t i = 0; i < ui.recordLine_tableWidget->rowCount(); i++)
|
||||||
|
{
|
||||||
|
for (size_t j = 0; j < ui.recordLine_tableWidget->columnCount(); j++)
|
||||||
|
{
|
||||||
|
QTableWidgetItem* tmp = new QTableWidgetItem(QString::number(data[i * ui.recordLine_tableWidget->columnCount() + j], 10, 5));
|
||||||
|
tmp->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
|
||||||
|
ui.recordLine_tableWidget->setItem(i, j, tmp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fclose(RecordLineFileHandle);
|
||||||
|
delete[] data;
|
||||||
|
|
||||||
|
QMessageBox::information(this, QString::fromLocal8Bit("<EFBFBD><EFBFBD>ʾ"), QString::fromLocal8Bit("<EFBFBD><EFBFBD>ȡ<EFBFBD>ɹ<EFBFBD><EFBFBD><EFBFBD>"));
|
||||||
|
|
||||||
|
}
|
||||||
37
HPPA/PathPlan.h
Normal file
37
HPPA/PathPlan.h
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <QDialog>
|
||||||
|
#include "ui_PathPlan.h"
|
||||||
|
#include "vincecontrol.h"
|
||||||
|
#include <QMotorDoubleSlider.h>
|
||||||
|
|
||||||
|
#define PI 3.1415926
|
||||||
|
|
||||||
|
class PathPlan : public QDialog
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
PathPlan(VinceControl* xMotor, VinceControl* yMotor, QMotorDoubleSlider* xSlider, QMotorDoubleSlider* ySlider, QWidget* parent = nullptr);
|
||||||
|
~PathPlan();
|
||||||
|
|
||||||
|
void setMotor(VinceControl* xMotor, VinceControl* yMotor);
|
||||||
|
QTableWidget* getRecordLineTableWidget();
|
||||||
|
|
||||||
|
private:
|
||||||
|
Ui::PathPlanClass ui;
|
||||||
|
|
||||||
|
VinceControl* m_xMotor;
|
||||||
|
VinceControl* m_yMotor;
|
||||||
|
|
||||||
|
QMotorDoubleSlider* m_xSlider;
|
||||||
|
QMotorDoubleSlider* m_ySlider;
|
||||||
|
|
||||||
|
public Q_SLOTS:
|
||||||
|
void onAddRecordLine_btn();
|
||||||
|
void onRemoveRecordLine_btn();
|
||||||
|
void onGenerateRecordLine_btn();
|
||||||
|
void onDeleteRecordLine_btn();
|
||||||
|
void onSaveRecordLine2File_btn();
|
||||||
|
void onReadRecordLineFile_btn();
|
||||||
|
};
|
||||||
362
HPPA/PathPlan.ui
Normal file
362
HPPA/PathPlan.ui
Normal file
@ -0,0 +1,362 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>PathPlanClass</class>
|
||||||
|
<widget class="QDialog" name="PathPlanClass">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>566</width>
|
||||||
|
<height>273</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>PathPlan</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
|
<property name="leftMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="spacing">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<item row="0" column="0">
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_16">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_4">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>108</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>高度</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLineEdit" name="height_lineEdit">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>100</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="generateRecordLine_btn">
|
||||||
|
<property name="layoutDirection">
|
||||||
|
<enum>Qt::LeftToRight</enum>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>生成轨迹</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="saveRecordLine2File_btn">
|
||||||
|
<property name="text">
|
||||||
|
<string>保存轨迹</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0">
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_17">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_5">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>108</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>视场角</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLineEdit" name="fov_lineEdit">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>17.6</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="deleteRecordLine_btn">
|
||||||
|
<property name="text">
|
||||||
|
<string>删除轨迹</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="readRecordLineFile_btn">
|
||||||
|
<property name="text">
|
||||||
|
<string>读取轨迹</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="0">
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_18">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_7">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>108</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>偏移</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLineEdit" name="offset_lineEdit">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>0</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="baseSize">
|
||||||
|
<size>
|
||||||
|
<width>0</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>0</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_6">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>0</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>幅宽</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLineEdit" name="swath_lineEdit">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>90</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>0</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignCenter</set>
|
||||||
|
</property>
|
||||||
|
<property name="readOnly">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="addRecordLine_btn">
|
||||||
|
<property name="text">
|
||||||
|
<string>添加</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="0">
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_19">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_12">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>108</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>重复率(%)</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLineEdit" name="repetitiveRate_lineEdit">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>0</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="baseSize">
|
||||||
|
<size>
|
||||||
|
<width>0</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>0</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignCenter</set>
|
||||||
|
</property>
|
||||||
|
<property name="readOnly">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_13">
|
||||||
|
<property name="text">
|
||||||
|
<string>阈值</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLineEdit" name="LastLineThreshold_lineEdit">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>90</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>0.7</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignCenter</set>
|
||||||
|
</property>
|
||||||
|
<property name="readOnly">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="removeRecordLine_btn">
|
||||||
|
<property name="text">
|
||||||
|
<string>移除</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item row="4" column="0">
|
||||||
|
<widget class="QTableWidget" name="recordLine_tableWidget"/>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
<zorder>layoutWidget</zorder>
|
||||||
|
<zorder>layoutWidget_2</zorder>
|
||||||
|
<zorder>recordLine_tableWidget</zorder>
|
||||||
|
<zorder>layoutWidget_3</zorder>
|
||||||
|
<zorder>layoutWidget_4</zorder>
|
||||||
|
<zorder>label_7</zorder>
|
||||||
|
</widget>
|
||||||
|
<layoutdefault spacing="6" margin="11"/>
|
||||||
|
<resources/>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
||||||
55
HPPA/PowerControl.cpp
Normal file
55
HPPA/PowerControl.cpp
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
#include "PowerControl.h"
|
||||||
|
|
||||||
|
PowerControl::PowerControl(QWidget *parent)
|
||||||
|
: QDialog(parent)
|
||||||
|
{
|
||||||
|
ui.setupUi(this);
|
||||||
|
|
||||||
|
connect(ui.lamp_power_open_btn, SIGNAL(clicked()), this, SLOT(onLampPowerOpen_btn()));
|
||||||
|
connect(ui.lamp_power_close_btn, SIGNAL(clicked()), this, SLOT(onLampPowerClose_btn()));
|
||||||
|
|
||||||
|
connect(ui.motor_power_open_btn, SIGNAL(clicked()), this, SLOT(onMotorPowerOpen_btn()));
|
||||||
|
connect(ui.motor_power_close_btn, SIGNAL(clicked()), this, SLOT(onMotorPowerClose_btn()));
|
||||||
|
}
|
||||||
|
|
||||||
|
PowerControl::~PowerControl()
|
||||||
|
{}
|
||||||
|
|
||||||
|
void PowerControl::getRequest(QString str)
|
||||||
|
{
|
||||||
|
QNetworkRequest request;
|
||||||
|
QNetworkAccessManager* naManager = new QNetworkAccessManager(this);
|
||||||
|
QMetaObject::Connection connRet = QObject::connect(naManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(requestFinished(QNetworkReply*)));
|
||||||
|
Q_ASSERT(connRet);
|
||||||
|
|
||||||
|
request.setUrl(QUrl(str));
|
||||||
|
QNetworkReply* reply = naManager->get(request);
|
||||||
|
}
|
||||||
|
|
||||||
|
void PowerControl::onLampPowerOpen_btn()//onLampPowerOpen_btn
|
||||||
|
{
|
||||||
|
QString xx = "http://192.168.1.3/setshutter?Portname=3&Value=1";
|
||||||
|
getRequest(xx);
|
||||||
|
}
|
||||||
|
|
||||||
|
void PowerControl::onLampPowerClose_btn()//onLampPowerClose_btn
|
||||||
|
{
|
||||||
|
QString xx = "http://192.168.1.3/setshutter?Portname=3&Value=0";
|
||||||
|
getRequest(xx);
|
||||||
|
}
|
||||||
|
|
||||||
|
void PowerControl::onMotorPowerOpen_btn()
|
||||||
|
{
|
||||||
|
QString xx = "http://192.168.1.3/setshutter?Portname=1&Value=1";
|
||||||
|
getRequest(xx);
|
||||||
|
|
||||||
|
emit powerOpened();
|
||||||
|
}
|
||||||
|
|
||||||
|
void PowerControl::onMotorPowerClose_btn()
|
||||||
|
{
|
||||||
|
QString xx = "http://192.168.1.3/setshutter?Portname=1&Value=0";
|
||||||
|
getRequest(xx);
|
||||||
|
|
||||||
|
emit powerClosed();
|
||||||
|
}
|
||||||
33
HPPA/PowerControl.h
Normal file
33
HPPA/PowerControl.h
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <QDialog>
|
||||||
|
#include <QNetworkRequest>
|
||||||
|
#include <QNetworkReply>
|
||||||
|
#include <QNetworkAccessManager>
|
||||||
|
|
||||||
|
#include "ui_PowerControl.h"
|
||||||
|
|
||||||
|
class PowerControl : public QDialog
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
PowerControl(QWidget *parent = nullptr);
|
||||||
|
~PowerControl();
|
||||||
|
|
||||||
|
public Q_SLOTS:
|
||||||
|
void onLampPowerOpen_btn();
|
||||||
|
void onLampPowerClose_btn();
|
||||||
|
|
||||||
|
void onMotorPowerOpen_btn();
|
||||||
|
void onMotorPowerClose_btn();
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void powerOpened();
|
||||||
|
void powerClosed();
|
||||||
|
|
||||||
|
private:
|
||||||
|
Ui::PowerControlClass ui;
|
||||||
|
|
||||||
|
void getRequest(QString str);
|
||||||
|
};
|
||||||
126
HPPA/PowerControl.ui
Normal file
126
HPPA/PowerControl.ui
Normal file
@ -0,0 +1,126 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>PowerControlClass</class>
|
||||||
|
<widget class="QDialog" name="PowerControlClass">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>294</width>
|
||||||
|
<height>119</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>PowerControl</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
|
<property name="leftMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="spacing">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<item row="0" column="0">
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_20">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_17">
|
||||||
|
<property name="text">
|
||||||
|
<string>卤素灯</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="lamp_power_open_btn">
|
||||||
|
<property name="text">
|
||||||
|
<string>打开</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="lamp_power_close_btn">
|
||||||
|
<property name="text">
|
||||||
|
<string>关闭</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="horizontalSpacer_19">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0">
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_21">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_18">
|
||||||
|
<property name="text">
|
||||||
|
<string>马 达</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="motor_power_open_btn">
|
||||||
|
<property name="text">
|
||||||
|
<string>打开</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="motor_power_close_btn">
|
||||||
|
<property name="text">
|
||||||
|
<string>关闭</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="horizontalSpacer_20">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="0">
|
||||||
|
<spacer name="verticalSpacer_3">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>20</width>
|
||||||
|
<height>42</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<layoutdefault spacing="6" margin="11"/>
|
||||||
|
<resources/>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
||||||
@ -12,12 +12,30 @@ QMotorDoubleSlider::QMotorDoubleSlider(QWidget* pParent /*= NULL*/) :QSlider(pPa
|
|||||||
m_Multiplier = 0;
|
m_Multiplier = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QMotorDoubleSlider::setMultiplier(float lead, float stepAnglemar, float scaleFactor, int subdivisionMultiples)
|
void QMotorDoubleSlider::setMultiplier(float lead, float stepAnglemar, float scaleFactor, int subdivisionParam)
|
||||||
{
|
{
|
||||||
//<2F><><EFBFBD>ݹ<EFBFBD>ʽ<EFBFBD><CABD><EFBFBD><EFBFBD><EFBFBD>廻<EFBFBD><E5BBBB>Ϊ<EFBFBD><CEAA><EFBFBD>룺1<EBA3BA><31><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>(m_Multiplier)=<3D><><EFBFBD><EFBFBD>/(360/<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>*ϸ<>ֱ<EFBFBD><D6B1><EFBFBD>)<29><><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7>https://wenku.baidu.com/view/4b2ea88bd0d233d4b14e69b8.html
|
//<2F><><EFBFBD>ݹ<EFBFBD>ʽ<EFBFBD><CABD><EFBFBD><EFBFBD><EFBFBD>廻<EFBFBD><E5BBBB>Ϊ<EFBFBD><CEAA><EFBFBD>룺1<EBA3BA><31><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>(m_Multiplier)=<3D><><EFBFBD><EFBFBD>/(360/<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>*ϸ<>ֱ<EFBFBD><D6B1><EFBFBD>)<29><><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7>https://wenku.baidu.com/view/4b2ea88bd0d233d4b14e69b8.html
|
||||||
//m_Multiplier(0.00054496986),//<2F>Ϻ<EFBFBD>ũ<EFBFBD><C5A9>Ժ<EFBFBD><D4BA><EFBFBD><EFBFBD>ǰ<EFBFBD><C7B0>0.00052734375/5=0.00010546875<EFBFBD><EFBFBD><EFBFBD>ĺ<EFBFBD>ȷֵΪ0.000544969862759644<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ0.00054496986/5=0.000108993972<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD>и<EFBFBD><EFBFBD><EFBFBD>еװ<EFBFBD><EFBFBD>1<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>5<EFBFBD><EFBFBD>
|
//m_Multiplier(0.00054496986),//<2F>Ϻ<EFBFBD>ũ<EFBFBD><C5A9>Ժ<EFBFBD><D4BA><EFBFBD><EFBFBD>ǰ<EFBFBD><C7B0>0.00052734375/5=0.00010546875<EFBFBD><EFBFBD><EFBFBD>ĺ<EFBFBD>ȷֵΪ0.000544969862759644<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ0.00054496986/5=0.000108993972<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD>и<EFBFBD><EFBFBD><EFBFBD>еװ<EFBFBD><EFBFBD>1<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>5<EFBFBD><EFBFBD>
|
||||||
//m_Multiplier(0.00054496986)//<2F>˰<EFBFBD><CBB0><EFBFBD>ũ<EFBFBD><C5A9><EFBFBD><EFBFBD>
|
//m_Multiplier(0.00054496986)//<2F>˰<EFBFBD><CBB0><EFBFBD>ũ<EFBFBD><C5A9><EFBFBD><EFBFBD>
|
||||||
m_Multiplier = lead / (360 / stepAnglemar * subdivisionMultiples) * scaleFactor;
|
m_Multiplier = lead / (360 / stepAnglemar * getValidSubdivision(subdivisionParam)) * scaleFactor;
|
||||||
|
}
|
||||||
|
|
||||||
|
int QMotorDoubleSlider::getValidSubdivision(int subdivisionParam)
|
||||||
|
{
|
||||||
|
if (subdivisionParam == 2)
|
||||||
|
return 4;
|
||||||
|
else if (subdivisionParam == 3)
|
||||||
|
return 8;
|
||||||
|
else if (subdivisionParam == 4)
|
||||||
|
return 16;
|
||||||
|
else if (subdivisionParam == 5)
|
||||||
|
return 32;
|
||||||
|
else if (subdivisionParam == 6)
|
||||||
|
return 64;
|
||||||
|
else if (subdivisionParam == 7)
|
||||||
|
return 128;
|
||||||
|
else if (subdivisionParam == 8)
|
||||||
|
return 256;
|
||||||
}
|
}
|
||||||
|
|
||||||
//<2F><><EFBFBD>ⷢ<EFBFBD><E2B7A2>
|
//<2F><><EFBFBD>ⷢ<EFBFBD><E2B7A2>
|
||||||
|
|||||||
@ -12,7 +12,8 @@ class QMotorDoubleSlider : public QSlider
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
QMotorDoubleSlider(QWidget* pParent = NULL);
|
QMotorDoubleSlider(QWidget* pParent = NULL);
|
||||||
void setMultiplier(float lead, float stepAnglemar, float scaleFactor, int subdivisionMultiples);
|
void setMultiplier(float lead, float stepAnglemar, float scaleFactor, int subdivisionParam);
|
||||||
|
int getValidSubdivision(int subdivisionParam);
|
||||||
|
|
||||||
double m_Multiplier;//<2F><><EFBFBD>ݹ<EFBFBD>ʽ<EFBFBD><CABD><EFBFBD><EFBFBD><EFBFBD>廻<EFBFBD><E5BBBB>Ϊ<EFBFBD><CEAA><EFBFBD>룺1<EBA3BA><31><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>(m_Multiplier)=<3D><><EFBFBD><EFBFBD>/(360/<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>*ϸ<>ֱ<EFBFBD><D6B1><EFBFBD>)<29><><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7>https://wenku.baidu.com/view/4b2ea88bd0d233d4b14e69b8.html
|
double m_Multiplier;//<2F><><EFBFBD>ݹ<EFBFBD>ʽ<EFBFBD><CABD><EFBFBD><EFBFBD><EFBFBD>廻<EFBFBD><E5BBBB>Ϊ<EFBFBD><CEAA><EFBFBD>룺1<EBA3BA><31><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>(m_Multiplier)=<3D><><EFBFBD><EFBFBD>/(360/<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>*ϸ<>ֱ<EFBFBD><D6B1><EFBFBD>)<29><><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7>https://wenku.baidu.com/view/4b2ea88bd0d233d4b14e69b8.html
|
||||||
|
|
||||||
|
|||||||
@ -180,13 +180,92 @@ void ResononNirImager::focus()
|
|||||||
|
|
||||||
imagerStopCollect();
|
imagerStopCollect();
|
||||||
|
|
||||||
//reConnectImage();
|
|
||||||
Sleep(20);
|
|
||||||
setFramerate(tmpFrmerate);//Ϊɶ<CEAA><C9B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>֡<EFBFBD><D6A1>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڽ<EFBFBD><DABD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>϶<EFBFBD><CFB6><EFBFBD><EFBFBD><EFBFBD>֡<EFBFBD>ʾͲ<CABE><CDB2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
||||||
|
|
||||||
|
|
||||||
reConnectImage();
|
reConnectImage();
|
||||||
setIntegrationTime(tmpIntegrationTime);
|
setIntegrationTime(tmpIntegrationTime);
|
||||||
|
|
||||||
|
setFramerate(tmpFrmerate);//<2F><><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFA3AC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFA3AC><EFBFBD>д<EFBFBD><D0B4><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
|
}
|
||||||
|
|
||||||
|
void ResononNirImager::record_dark()
|
||||||
|
{
|
||||||
|
std::cout << "<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>" << std::endl;
|
||||||
|
reConnectImage();
|
||||||
|
imagerStartCollect();
|
||||||
|
|
||||||
|
unsigned int* dark_tmp = new unsigned int[m_FrameSize];
|
||||||
|
std::fill(dark_tmp, dark_tmp + m_FrameSize, 0);
|
||||||
|
|
||||||
|
int counter = 50;
|
||||||
|
for (size_t i = 0; i < counter; i++)
|
||||||
|
{
|
||||||
|
getFrame(dark);
|
||||||
|
|
||||||
|
for (size_t j = 0; j < m_FrameSize; j++)
|
||||||
|
{
|
||||||
|
dark_tmp[j] = dark[j] + dark_tmp[j];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (size_t j = 0; j < m_FrameSize; j++)
|
||||||
|
{
|
||||||
|
dark[j] = (unsigned short)(dark_tmp[j] / counter);
|
||||||
|
}
|
||||||
|
delete[] dark_tmp;
|
||||||
|
|
||||||
|
imagerStopCollect();
|
||||||
|
|
||||||
|
m_HasDark = true;
|
||||||
|
|
||||||
|
emit RecordDarlFinishSignal();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ResononNirImager::record_white()
|
||||||
|
{
|
||||||
|
std::cout << "<EFBFBD>ɼ<EFBFBD><EFBFBD>װ壡<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>" << std::endl;
|
||||||
|
reConnectImage();
|
||||||
|
imagerStartCollect();
|
||||||
|
|
||||||
|
unsigned int* white_tmp = new unsigned int[m_FrameSize];
|
||||||
|
std::fill(white_tmp, white_tmp + m_FrameSize, 0);
|
||||||
|
|
||||||
|
int counter = 50;
|
||||||
|
for (size_t i = 0; i < counter; i++)
|
||||||
|
{
|
||||||
|
getFrame(white);
|
||||||
|
|
||||||
|
for (size_t j = 0; j < m_FrameSize; j++)
|
||||||
|
{
|
||||||
|
white_tmp[j] = white[j] + white_tmp[j];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (size_t j = 0; j < m_FrameSize; j++)
|
||||||
|
{
|
||||||
|
white[j] = (unsigned short)(white_tmp[j] / counter);
|
||||||
|
}
|
||||||
|
delete[] white_tmp;
|
||||||
|
|
||||||
|
imagerStopCollect();
|
||||||
|
|
||||||
|
//<2F>װ<EFBFBD><D7B0>۰<EFBFBD><DBB0><EFBFBD><EFBFBD><EFBFBD>
|
||||||
|
if (m_HasDark)
|
||||||
|
{
|
||||||
|
for (size_t i = 0; i < m_FrameSize; i++)
|
||||||
|
{
|
||||||
|
if (white[i] < dark[i])
|
||||||
|
{
|
||||||
|
white[i] = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
white[i] = white[i] - dark[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
m_HasWhite = true;
|
||||||
|
|
||||||
|
emit RecordWhiteFinishSignal();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ResononNirImager::start_record()
|
void ResononNirImager::start_record()
|
||||||
@ -206,15 +285,15 @@ 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.c_str(), "w+b");
|
|
||||||
|
|
||||||
size_t x;
|
size_t x;
|
||||||
double pixelValueTmp;
|
double pixelValueTmp;
|
||||||
|
|
||||||
|
string timesFile = removeFileExtension(m_FileName2Save2) + ".times";
|
||||||
|
FILE* hTimesFile = fopen(timesFile.c_str(), "w+");
|
||||||
|
|
||||||
reConnectImage();//nir<69>ڶ<EFBFBD><DAB6>βɼ<CEB2>ʱ<EFBFBD><CAB1>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>imagerStartCollect()<29>ᱨ<EFBFBD><E1B1A8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
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>
|
||||||
imagerStartCollect();
|
imagerStartCollect();
|
||||||
while (m_bRecordControlState)
|
while (m_bRecordControlState)
|
||||||
@ -222,6 +301,8 @@ void ResononNirImager::start_record()
|
|||||||
m_iFrameCounter++;
|
m_iFrameCounter++;
|
||||||
|
|
||||||
getFrame(buffer);
|
getFrame(buffer);
|
||||||
|
long long timeOs = getNanosecondsSinceMidnight();
|
||||||
|
//qDebug() << "time ns-------------------: " << timeOs;
|
||||||
|
|
||||||
//<2F><>ȥ<EFBFBD><C8A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӦΪbuffer<65><72>dark<72><6B><EFBFBD><EFBFBD>unsigned short<72><74><EFBFBD><EFBFBD><EFBFBD>Ե<EFBFBD>dark>bufferʱ<72><CAB1>buffer-dark=65535
|
//<2F><>ȥ<EFBFBD><C8A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӦΪbuffer<65><72>dark<72><6B><EFBFBD><EFBFBD>unsigned short<72><74><EFBFBD><EFBFBD><EFBFBD>Ե<EFBFBD>dark>bufferʱ<72><CAB1>buffer-dark=65535
|
||||||
if (m_HasDark)
|
if (m_HasDark)
|
||||||
@ -262,6 +343,7 @@ void ResononNirImager::start_record()
|
|||||||
}
|
}
|
||||||
|
|
||||||
x = fwrite(buffer, 2, m_FrameSize, m_fImage);
|
x = fwrite(buffer, 2, m_FrameSize, m_fImage);
|
||||||
|
fprintf(hTimesFile, "%lld\n", timeOs);
|
||||||
|
|
||||||
//<2F><>rgb<67><62><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ա<EFBFBD><D4B1>ڽ<EFBFBD><DABD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ
|
//<2F><>rgb<67><62><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ա<EFBFBD><D4B1>ڽ<EFBFBD><DABD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ
|
||||||
m_RgbImage->FillRgbImage(buffer);//??????????????????????????????????????????????????????????????????????????????????????????????????????
|
m_RgbImage->FillRgbImage(buffer);//??????????????????????????????????????????????????????????????????????????????????????????????????????
|
||||||
@ -277,6 +359,7 @@ void ResononNirImager::start_record()
|
|||||||
if (m_iFrameCounter >= m_iFrameNumber)
|
if (m_iFrameCounter >= m_iFrameNumber)
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
|
//qDebug() << "<22><><EFBFBD><EFBFBD>ֹͣ<CDA3>ɼ<EFBFBD><C9BC><EFBFBD>֡<EFBFBD><D6A1><EFBFBD><EFBFBD><EFBFBD>Ƶ<EFBFBD><C6B5>";
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -301,6 +384,7 @@ void ResononNirImager::start_record()
|
|||||||
|
|
||||||
//QThread::msleep(1001);
|
//QThread::msleep(1001);
|
||||||
fclose(m_fImage);
|
fclose(m_fImage);
|
||||||
|
fclose(hTimesFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ResononNirImager::WriteHdr()
|
void ResononNirImager::WriteHdr()
|
||||||
@ -308,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
|
||||||
{
|
{
|
||||||
@ -43,6 +44,8 @@ private:
|
|||||||
public slots:
|
public slots:
|
||||||
double auto_exposure();
|
double auto_exposure();
|
||||||
void focus();
|
void focus();
|
||||||
|
void record_dark();
|
||||||
|
void record_white();
|
||||||
void start_record();
|
void start_record();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
|||||||
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,8 +9,8 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>753</width>
|
<width>629</width>
|
||||||
<height>490</height>
|
<height>463</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
@ -25,7 +25,7 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>90</x>
|
<x>90</x>
|
||||||
<y>250</y>
|
<y>250</y>
|
||||||
<width>578</width>
|
<width>434</width>
|
||||||
<height>134</height>
|
<height>134</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
@ -65,12 +65,12 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>270</x>
|
<x>270</x>
|
||||||
<y>150</y>
|
<y>150</y>
|
||||||
<width>108</width>
|
<width>141</width>
|
||||||
<height>24</height>
|
<height>24</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>版本:1.8</string>
|
<string>版本:1.8.8</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QLabel" name="label_4">
|
<widget class="QLabel" name="label_4">
|
||||||
|
|||||||
87
HPPA/adjustTable.cpp
Normal file
87
HPPA/adjustTable.cpp
Normal file
@ -0,0 +1,87 @@
|
|||||||
|
#include "adjustTable.h"
|
||||||
|
|
||||||
|
adjustTable::adjustTable(QWidget *parent)
|
||||||
|
: QDialog(parent)
|
||||||
|
{
|
||||||
|
ui.setupUi(this);
|
||||||
|
|
||||||
|
connect(ui.objective_table1_up_btn, SIGNAL(clicked()), this, SLOT(onObjectivTable1Up_btn()));
|
||||||
|
connect(ui.objective_table1_down_btn, SIGNAL(clicked()), this, SLOT(onObjectivTable1Down_btn()));
|
||||||
|
connect(ui.objective_table1_stop_btn, SIGNAL(clicked()), this, SLOT(onObjectivTable1Stop_btn()));
|
||||||
|
|
||||||
|
connect(ui.objective_table2_up_btn, SIGNAL(clicked()), this, SLOT(onObjectivTable2Up_btn()));
|
||||||
|
connect(ui.objective_table2_down_btn, SIGNAL(clicked()), this, SLOT(onObjectivTable2Down_btn()));
|
||||||
|
connect(ui.objective_table2_stop_btn, SIGNAL(clicked()), this, SLOT(onObjectivTable2Stop_btn()));
|
||||||
|
|
||||||
|
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()
|
||||||
|
{}
|
||||||
|
|
||||||
|
void adjustTable::getRequest(QString str)
|
||||||
|
{
|
||||||
|
QNetworkRequest request;
|
||||||
|
QNetworkAccessManager* naManager = new QNetworkAccessManager(this);
|
||||||
|
QMetaObject::Connection connRet = QObject::connect(naManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(requestFinished(QNetworkReply*)));
|
||||||
|
Q_ASSERT(connRet);
|
||||||
|
|
||||||
|
request.setUrl(QUrl(str));
|
||||||
|
QNetworkReply* reply = naManager->get(request);
|
||||||
|
}
|
||||||
|
|
||||||
|
void adjustTable::onObjectivTable1Up_btn()
|
||||||
|
{
|
||||||
|
QString xx = "http://192.168.1.253/set_up";
|
||||||
|
getRequest(xx);
|
||||||
|
}
|
||||||
|
|
||||||
|
void adjustTable::onObjectivTable1Down_btn()
|
||||||
|
{
|
||||||
|
QString xx = "http://192.168.1.253/set_down";
|
||||||
|
getRequest(xx);
|
||||||
|
}
|
||||||
|
|
||||||
|
void adjustTable::onObjectivTable1Stop_btn()
|
||||||
|
{
|
||||||
|
QString xx = "http://192.168.1.253/stopnow";
|
||||||
|
getRequest(xx);
|
||||||
|
}
|
||||||
|
|
||||||
|
void adjustTable::onObjectivTable2Up_btn()
|
||||||
|
{
|
||||||
|
QString xx = "http://192.168.1.254/set_up";
|
||||||
|
getRequest(xx);
|
||||||
|
}
|
||||||
|
|
||||||
|
void adjustTable::onObjectivTable2Down_btn()
|
||||||
|
{
|
||||||
|
QString xx = "http://192.168.1.254/set_down";
|
||||||
|
getRequest(xx);
|
||||||
|
}
|
||||||
|
|
||||||
|
void adjustTable::onObjectivTable2Stop_btn()
|
||||||
|
{
|
||||||
|
QString xx = "http://192.168.1.254/stopnow";
|
||||||
|
getRequest(xx);
|
||||||
|
}
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
35
HPPA/adjustTable.h
Normal file
35
HPPA/adjustTable.h
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <QDialog>
|
||||||
|
#include <QNetworkRequest>
|
||||||
|
#include <QNetworkReply>
|
||||||
|
#include <QNetworkAccessManager>
|
||||||
|
|
||||||
|
#include "ui_adjustTable.h"
|
||||||
|
|
||||||
|
class adjustTable : public QDialog
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
adjustTable(QWidget *parent = nullptr);
|
||||||
|
~adjustTable();
|
||||||
|
|
||||||
|
|
||||||
|
public Q_SLOTS:
|
||||||
|
void onObjectivTable1Up_btn();
|
||||||
|
void onObjectivTable1Down_btn();
|
||||||
|
void onObjectivTable1Stop_btn();
|
||||||
|
void onObjectivTable2Up_btn();
|
||||||
|
void onObjectivTable2Down_btn();
|
||||||
|
void onObjectivTable2Stop_btn();
|
||||||
|
|
||||||
|
void onObjectivTable252Up_btn();
|
||||||
|
void onObjectivTable252Down_btn();
|
||||||
|
void onObjectivTable252Stop_btn();
|
||||||
|
|
||||||
|
private:
|
||||||
|
Ui::adjustTableClass ui;
|
||||||
|
|
||||||
|
void getRequest(QString str);
|
||||||
|
};
|
||||||
166
HPPA/adjustTable.ui
Normal file
166
HPPA/adjustTable.ui
Normal file
@ -0,0 +1,166 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>adjustTableClass</class>
|
||||||
|
<widget class="QDialog" name="adjustTableClass">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>687</width>
|
||||||
|
<height>389</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>adjustTable</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
|
<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">
|
||||||
|
<property name="title">
|
||||||
|
<string>253号升降台</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="2">
|
||||||
|
<widget class="QGroupBox" name="groupBox_6">
|
||||||
|
<property name="title">
|
||||||
|
<string>254号升降台</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QGridLayout" name="gridLayout_9">
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QPushButton" name="objective_table2_up_btn">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Minimum" vsizetype="Expanding">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>上升</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="QPushButton" name="objective_table2_down_btn">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Minimum" vsizetype="Expanding">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>下降</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="0">
|
||||||
|
<widget class="QPushButton" name="objective_table2_stop_btn">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Minimum" vsizetype="Expanding">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>停止</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<layoutdefault spacing="6" margin="11"/>
|
||||||
|
<resources/>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
||||||
@ -303,12 +303,12 @@ bool Configfile::createConfigFile()
|
|||||||
|
|
||||||
Setting& x_StepAnglemar = x.add("StepAnglemar", Setting::TypeFloat) = 1.8;//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
Setting& x_StepAnglemar = x.add("StepAnglemar", Setting::TypeFloat) = 1.8;//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
Setting& x_Lead = x.add("Lead", Setting::TypeFloat) = 13.5;//<2F><><EFBFBD>̣<EFBFBD><CCA3><EFBFBD>λ<EFBFBD><CEBB>cm
|
Setting& x_Lead = x.add("Lead", Setting::TypeFloat) = 13.5;//<2F><><EFBFBD>̣<EFBFBD><CCA3><EFBFBD>λ<EFBFBD><CEBB>cm
|
||||||
Setting& x_SubdivisionMultiples = x.add("SubdivisionMultiples", Setting::TypeInt) = 128;//ϸ<>ֱ<EFBFBD><D6B1><EFBFBD>
|
Setting& x_SubdivisionMultiples = x.add("SubdivisionMultiples", Setting::TypeInt) = 7;//ϸ<>ֱ<EFBFBD><D6B1><EFBFBD>
|
||||||
Setting& x_ScaleFactor = x.add("ScaleFactor", Setting::TypeFloat) = 1.0;//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
Setting& x_ScaleFactor = x.add("ScaleFactor", Setting::TypeFloat) = 1.0;//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
Setting& x_MaxRange = x.add("MaxRange", Setting::TypeFloat) = 120.0;
|
Setting& x_MaxRange = x.add("MaxRange", Setting::TypeFloat) = 120.0;
|
||||||
Setting& y_StepAnglemar = y.add("StepAnglemar", Setting::TypeFloat) = 1.8;
|
Setting& y_StepAnglemar = y.add("StepAnglemar", Setting::TypeFloat) = 1.8;
|
||||||
Setting& y_Lead = y.add("Lead", Setting::TypeFloat) = 13.5;
|
Setting& y_Lead = y.add("Lead", Setting::TypeFloat) = 13.5;
|
||||||
Setting& y_SubdivisionMultiples = y.add("SubdivisionMultiples", Setting::TypeInt) = 128;
|
Setting& y_SubdivisionMultiples = y.add("SubdivisionMultiples", Setting::TypeInt) = 7;
|
||||||
Setting& y_ScaleFactor = y.add("ScaleFactor", Setting::TypeFloat) = 0.2;
|
Setting& y_ScaleFactor = y.add("ScaleFactor", Setting::TypeFloat) = 0.2;
|
||||||
Setting& y_MaxRange = y.add("MaxRange", Setting::TypeFloat) = 120.0;
|
Setting& y_MaxRange = y.add("MaxRange", Setting::TypeFloat) = 120.0;
|
||||||
|
|
||||||
|
|||||||
@ -113,8 +113,9 @@ void CImage::FillRgbImage(unsigned short *datacube)
|
|||||||
|
|
||||||
//m_QRgbImage->save(QString::fromStdString(rgbFilePathNoStrech), "PNG");
|
//m_QRgbImage->save(QString::fromStdString(rgbFilePathNoStrech), "PNG");
|
||||||
|
|
||||||
|
//ImageProcessor imageProcessor;
|
||||||
//cv::imwrite(rgbFilePathNoStrech, *m_matRgbImage);
|
//cv::imwrite(rgbFilePathNoStrech, *m_matRgbImage);
|
||||||
//cv::imwrite(rgbFilePathStrech, CStretch(*m_matRgbImage, 0.01));
|
//cv::imwrite(rgbFilePathStrech, imageProcessor.CStretch(*m_matRgbImage, 0.02));
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -11,6 +11,7 @@
|
|||||||
#include "QImage"
|
#include "QImage"
|
||||||
|
|
||||||
#include "fileOperation.h"
|
#include "fileOperation.h"
|
||||||
|
#include "imageProcessor.h"
|
||||||
|
|
||||||
|
|
||||||
class CImage :public QObject
|
class CImage :public QObject
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
#include "imageProcessor.h"
|
#include "imageProcessor.h"
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
ImageProcessor::ImageProcessor()
|
ImageProcessor::ImageProcessor()
|
||||||
{
|
{
|
||||||
@ -14,8 +15,10 @@ std::vector<cv::Point2f> ImageProcessor::CHistogram(const cv::Mat img)
|
|||||||
cv::Mat mimg = img.clone();
|
cv::Mat mimg = img.clone();
|
||||||
int rows = mimg.rows;
|
int rows = mimg.rows;
|
||||||
int cols = mimg.cols;
|
int cols = mimg.cols;
|
||||||
|
int maxValue = *std::max_element(mimg.begin<unsigned short>(), mimg.end<unsigned short>());
|
||||||
|
maxValue = 65535;
|
||||||
//ͳ<><CDB3>ÿ<EFBFBD><C3BF><EFBFBD>Ҷȳ<D2B6><C8B3>ֵĴ<D6B5><C4B4><EFBFBD>
|
//ͳ<><CDB3>ÿ<EFBFBD><C3BF><EFBFBD>Ҷȳ<D2B6><C8B3>ֵĴ<D6B5><C4B4><EFBFBD>
|
||||||
std::vector<long int> hisnum(4096, 0);//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
std::vector<long int> hisnum(maxValue, 0);//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
for (int i(0); i < rows; ++i)
|
for (int i(0); i < rows; ++i)
|
||||||
{
|
{
|
||||||
//std::cout << "i<><69>" << i << std::endl;
|
//std::cout << "i<><69>" << i << std::endl;
|
||||||
@ -27,7 +30,7 @@ std::vector<cv::Point2f> ImageProcessor::CHistogram(const cv::Mat img)
|
|||||||
|
|
||||||
//<2F>Է<EFBFBD><D4B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>и<EFBFBD>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͷ<EFBFBD>Ǹ<EFBFBD><C7B8><EFBFBD><EFBFBD>ڿ۳<DABF><DBB3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>п<EFBFBD><D0BF><EFBFBD>Ϊ<EFBFBD><CEAA>ֵ
|
//<2F>Է<EFBFBD><D4B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>и<EFBFBD>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͷ<EFBFBD>Ǹ<EFBFBD><C7B8><EFBFBD><EFBFBD>ڿ۳<DABF><DBB3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>п<EFBFBD><D0BF><EFBFBD>Ϊ<EFBFBD><CEAA>ֵ
|
||||||
//<2F><><EFBFBD><EFBFBD>mat<61><74><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ΪCV_16UC3<43><33><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>и<EFBFBD>ֵʱ<D6B5><CAB1><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD>Ϊ65535
|
//<2F><><EFBFBD><EFBFBD>mat<61><74><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ΪCV_16UC3<43><33><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>и<EFBFBD>ֵʱ<D6B5><CAB1><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD>Ϊ65535
|
||||||
if (gv >= 4096)
|
if (gv >= maxValue)
|
||||||
{
|
{
|
||||||
++hisnum[0];
|
++hisnum[0];
|
||||||
}
|
}
|
||||||
@ -35,8 +38,6 @@ std::vector<cv::Point2f> ImageProcessor::CHistogram(const cv::Mat img)
|
|||||||
{
|
{
|
||||||
++hisnum[gv];
|
++hisnum[gv];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//<2F><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD>Ҷ<EFBFBD>Ƶ<EFBFBD><C6B5>
|
//<2F><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD>Ҷ<EFBFBD>Ƶ<EFBFBD><C6B5>
|
||||||
|
|||||||
@ -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);
|
||||||
@ -121,3 +132,28 @@ QList<QString> getFileInfo(QString file)
|
|||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
long long getNanosecondsSinceMidnight()
|
||||||
|
{
|
||||||
|
// 获取当前系统时间
|
||||||
|
auto now = std::chrono::system_clock::now();
|
||||||
|
|
||||||
|
// 转换为 time_t(秒级别的时间戳)
|
||||||
|
std::time_t t = std::chrono::system_clock::to_time_t(now);
|
||||||
|
std::tm local_tm = *std::localtime(&t); // 获取本地时间结构
|
||||||
|
|
||||||
|
// 将时间结构调整到当天 00:00:00
|
||||||
|
local_tm.tm_hour = 0;
|
||||||
|
local_tm.tm_min = 0;
|
||||||
|
local_tm.tm_sec = 0;
|
||||||
|
local_tm.tm_isdst = -1; // 让 mktime 自动判断夏令时
|
||||||
|
|
||||||
|
// 获取当天 00:00:00 的时间点
|
||||||
|
auto midnight = std::chrono::system_clock::from_time_t(std::mktime(&local_tm));
|
||||||
|
|
||||||
|
// 计算从当天 00:00:00 到现在的时间差
|
||||||
|
auto nanoseconds_since_midnight = std::chrono::duration_cast<std::chrono::nanoseconds>(now - midnight);
|
||||||
|
|
||||||
|
// 返回纳秒数
|
||||||
|
return nanoseconds_since_midnight.count();
|
||||||
|
}
|
||||||
|
|||||||
@ -3,9 +3,11 @@
|
|||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <ctime>
|
#include <ctime>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
#include <chrono>
|
||||||
|
|
||||||
QString getFileNameBaseOnTime();
|
QString getFileNameBaseOnTime();
|
||||||
|
|
||||||
@ -17,7 +19,10 @@ 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);
|
||||||
|
|
||||||
|
long long getNanosecondsSinceMidnight();
|
||||||
|
|
||||||
#endif // UTILITY_TC_H
|
#endif // UTILITY_TC_H
|
||||||
|
|||||||
28
readme.txt
Normal file
28
readme.txt
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
1、HPPA拼接
|
||||||
|
每条航线的开始帧的位置不一样,无法直接将相邻航线拼接一起,否则航向有错位。
|
||||||
|
1.1 步骤
|
||||||
|
(1)采集每帧的同时,获取线性平台的位置,并写入文件;
|
||||||
|
(2)根据位置信息匹配帧号,然后进行拼接;
|
||||||
|
1.2 存在的问题及解决办法
|
||||||
|
(1)马达库不知道是否能够支持20hz及以上的访问频率;
|
||||||
|
或者按照一定频率采集线性平台位置,通过时间进行插值获取每帧位置;
|
||||||
|
(2)列之间的重叠
|
||||||
|
通过一个可调参数进行旁向拼接设置;
|
||||||
|
1.3 拼接后裁剪
|
||||||
|
|
||||||
|
1.4 根据每个像素的xy坐标进行拼接:放弃
|
||||||
|
|
||||||
|
2、bug修复
|
||||||
|
(1)反射率图像条纹:白板和暗电流都采集30帧进行平均;
|
||||||
|
(2)轨迹2位小数
|
||||||
|
(3)速度输入接受小数
|
||||||
|
|
||||||
|
3、hppa升降桌无线控制模块
|
||||||
|
如果没有配置过,那么默认ip为http://192.168.1.254,且默认wifi以iris1开头,默认wifi密码为123456789。
|
||||||
|
配置网页为http://192.168.1.254/wificonfig.html,配置密码是licahk*******
|
||||||
|
|
||||||
|
如果已经配置为252,那么可用下面网址控制
|
||||||
|
http://192.168.1.252/stopnow
|
||||||
|
http://192.168.1.252/set_up
|
||||||
|
http://192.168.1.252/set_down
|
||||||
|
http://192.168.1.252/wificonfig.html
|
||||||
Reference in New Issue
Block a user