2 Commits

Author SHA1 Message Date
f00fc6fdea 输出相机连接时的报错,方便排查; 2026-07-31 17:29:08 +08:00
10beb03843 修复:
由于兼容贡嘎山采集导致的一轴模式的采集逻辑bug
2026-07-22 18:29:20 +08:00
7 changed files with 66 additions and 21 deletions

View File

@ -467,7 +467,7 @@ OneMotionCaptureCoordinator::~OneMotionCaptureCoordinator()
this, &OneMotionCaptureCoordinator::handleMotorStoped);
}
void OneMotionCaptureCoordinator::startStepMotion(OneMotionCapturePathLine pathLine)
void OneMotionCaptureCoordinator::startStepMotion(OneMotionCapturePathLine pathLine)//这个函数为啥被调用了2次
{
QMutexLocker locker(&m_dataMutex);
@ -498,13 +498,14 @@ void OneMotionCaptureCoordinator::stopStepMotion()
m_cameraCtrl->stop_record();
}
//emit stopMotorSignal(0);
move2LocBeforeStart();
emit stopMotorSignal(0);
m_isHypercamStopRecord = true;
}
void OneMotionCaptureCoordinator::handleCaptureCompleteWhenFrameNumberMeet()
{
emit stopMotorSignal(0);
m_isHypercamStopRecord = true;
}
void OneMotionCaptureCoordinator::getLocBeforeStart()
@ -568,25 +569,32 @@ bool OneMotionCaptureCoordinator::saveToCsv(const QString& filename)
void OneMotionCaptureCoordinator::handleMotorStoped(int motorID, double pos)
{
if (!m_isRunning) return;
QMutexLocker locker(&m_dataMutex);
// 记录位置信息
m_pathLine.stopPosition = pos;
m_pathLine.timestamp2 = QDateTime::currentDateTime();
//光谱仪停止采集,马达回到初始位置
emit stopRecordHSISignal();
if (m_cameraCtrl != nullptr)
if (m_isHypercamStopRecord == true)
{
m_cameraCtrl->stop_record();
}
move2LocBeforeStart();
m_isHypercamStopRecord = false;
// emit sequenceComplete last: the slot connected to it may delete this object,
// so no member access is allowed after this point.
emit sequenceComplete(0);
// 记录位置信息
m_pathLine.stopPosition = pos;
m_pathLine.timestamp2 = QDateTime::currentDateTime();
//光谱仪停止采集,马达回到初始位置
emit stopRecordHSISignal();
if (m_cameraCtrl != nullptr)
{
m_cameraCtrl->stop_record();
}
move2LocBeforeStart();
emit sequenceComplete_cam_stop_before_motorback(0);
}
else
{
// emit sequenceComplete last: the slot connected to it may delete this object,
// so no member access is allowed after this point.
emit sequenceComplete(0);
}
}
void OneMotionCaptureCoordinator::handleCaptureComplete(double index)

View File

@ -144,6 +144,7 @@ public slots:
void handleCaptureCompleteWhenFrameNumberMeet();
signals:
void sequenceComplete_cam_stop_before_motorback(int);
void sequenceComplete(int);
void errorOccurred(const QString& error);
void moveTo(int, double, double, int);
@ -165,6 +166,7 @@ private:
mutable QMutex m_dataMutex;
bool m_isRunning;
bool m_isHypercamStopRecord = false;
std::vector<double> m_locBeforeStart;
void getLocBeforeStart();

View File

@ -2396,7 +2396,7 @@ void HPPA::disconnectImagerAndCleanup()
{
m_RecordThread->quit();
m_RecordThread->wait(3000);
delete m_RecordThread;
m_RecordThread->deleteLater();
m_RecordThread = nullptr;
}
@ -2563,6 +2563,15 @@ void HPPA::onconnect()
std::cerr << "Error: " << e.what() << std::endl;
QString errorFilePath = QCoreApplication::applicationDirPath() + "/camerror.txt";
QFile file(errorFilePath);
if (file.open(QIODevice::WriteOnly | QIODevice::Append | QIODevice::Text))
{
QTextStream out(&file);
out << QDateTime::currentDateTime().toString("yyyy-MM-dd hh:mm:ss") << " - std::exception: " << e.what() << "\n";
file.close();
}
delete m_Imager;
m_Imager = nullptr;
@ -2572,6 +2581,15 @@ void HPPA::onconnect()
{
ui.action_connect_imager->setIcon(QIcon(":/svg/resources/icons/svg/connect_imager.svg"));
QString errorFilePath = QCoreApplication::applicationDirPath() + "/camerror.txt";
QFile file(errorFilePath);
if (file.open(QIODevice::WriteOnly | QIODevice::Append | QIODevice::Text))
{
QTextStream out(&file);
out << QDateTime::currentDateTime().toString("yyyy-MM-dd hh:mm:ss") << " - int exception: " << e << "\n";
file.close();
}
delete m_Imager;
m_Imager = nullptr;

View File

@ -221,6 +221,16 @@ void ImagerOperationBase::record_white()
void ImagerOperationBase::start_record()
{
QObject* obj = sender();
if (obj)
{
qDebug() << "ImagerOperationBase::start_record, sender name:" << obj->objectName();
}
else
{
qDebug() << "ImagerOperationBase::start_record, sender is null";
}
using namespace std;
//std::cout << "------------------------------------------------------" << std::endl;

View File

@ -223,8 +223,14 @@ void OneMotorControl::record_white()
void OneMotorControl::run()
{
if (m_coordinator)//当高光谱相机停止采集后马达还未回到原点时上次任务的m_coordinator还没有被销毁
{
onSequenceComplete(0);
}
qRegisterMetaType<OneMotionCapturePathLine>("OneMotionCapturePathLine");
m_coordinator = new OneMotionCaptureCoordinator(m_multiAxisController, m_Imager);
m_coordinator->setObjectName("testOneMotionCaptureCoordinator");
connect(this, SIGNAL(start(OneMotionCapturePathLine)), m_coordinator, SLOT(startStepMotion(OneMotionCapturePathLine)));
connect(this, SIGNAL(stopStepMotionSignal()), m_coordinator, SLOT(stopStepMotion()));

View File

@ -1,6 +1,7 @@
#pragma once
#include <QThread>
#include <QMessageBox>
#include <QPointer>
#include "ui_oneMotorControl.h"
@ -68,7 +69,7 @@ private:
QThread m_motorThread;
IrisMultiMotorController* m_multiAxisController = nullptr;
OneMotionCaptureCoordinator* m_coordinator = nullptr;
QPointer<OneMotionCaptureCoordinator> m_coordinator;
ImagerOperationBase* m_Imager;
DarkAndWhiteCaptureCoordinator* m_darkCaptureCoordinator = nullptr;

View File

@ -288,7 +288,7 @@ QPushButton:pressed
}</string>
</property>
<property name="text">
<string>版本3.1.1</string>
<string>版本3.1.2</string>
</property>
</widget>
</item>