add,计划采集10:

解决偶发单反唤起失败问题;

任务文件要求:
1、高光谱必须在前面,没有顺序要求,因为在执行高光谱任务前会预热卤素灯,所有高光谱任务完成后才关闭卤素灯;
2、单反/深度必须在后面,没有顺序要求;
3、必须要有高光谱任务:单反存在唤醒程序和一定反应时间,所以必须依赖前一个任务进行唤醒;
 (1)当单反已经是唤醒状态时,重新上电(先下电后上电)后可马上重新唤醒单反:单反适配器剩余电量马上耗尽,所以才能马上重新唤醒单反;
 (2)当单反在上电的状态下,从唤醒状态自动进入休眠状态时,重新下电后需要等待2分15秒(135秒)后,再重新上电才能唤醒单反:等待135秒的目的是将适配器中电容的剩余电量耗尽;
This commit is contained in:
tangchao0503
2026-06-11 15:27:02 +08:00
parent 509f4b0767
commit f69edcf2c9
5 changed files with 40 additions and 17 deletions

View File

@ -87,6 +87,7 @@ void TwoMotionCaptureCoordinator::getLocBeforeStart()
QMetaObject::Connection conn = QObject::connect(m_motorCtrl, &IrisMultiMotorController::locationSignal,
[&](std::vector<double> pos) {
m_locBeforeStart = pos;
std::cout << "start pos: "<< pos[0] <<", " << pos[1] << std::endl;
received = true;
loop.quit();
});
@ -348,6 +349,7 @@ void TwoMotionCaptureCoordinator::startRecordHsi()
emit moveTo(0, tmp.targetXMaxPosition, tmp.speedTargetXMaxPosition, 1000);
emit startRecordHSISignal(m_numCurrentPathLine);
emit startRecordLineNumSignal(m_numCurrentPathLine);
}
}
@ -409,7 +411,7 @@ void TwoMotionCaptureCoordinator::processNextPathLine()
}
std::cout << "\nNew path line: " << m_numCurrentPathLine << std::endl;
emit startRecordLineNumSignal(m_numCurrentPathLine);
emit gotoRecordLineNumSignal(m_numCurrentPathLine);
m_isValidCapturing = true;
PathLine &tmp = m_pathLines[m_numCurrentPathLine];

View File

@ -47,6 +47,7 @@ public:
signals:
void sequenceComplete(int);//0所有采集线正常运行完成1用户主动取消采集
void back2OriginSignal();
void gotoRecordLineNumSignal(int lineNum);
void startRecordLineNumSignal(int lineNum);
void finishRecordLineNumSignal(int lineNum);

View File

@ -609,11 +609,6 @@ void HPPA::initTimedDataCollection()
// 相机/马达 → 定时采集控制器
connect(m_tmc, &TwoMotorControl::sequenceComplete, mTimedDataCollectionWindow, &TimedDataCollection::subTaskCompleted);
connect(m_tmc, &TwoMotorControl::back2OriginSignal_TimedDataCollection, mTimedDataCollectionWindow, &TimedDataCollection::onBack2Origin);
//电源控制m_pc3D
//连接马达控制和单反/深度
}
void HPPA::setTimedDataCollectionHyperCamParm(int camType, double f, double e, QString filePath, QString fileName)

View File

@ -160,6 +160,7 @@ QJsonObject TimedDataCollectionDataStructuresReaderWriter::timedTaskToJson(const
obj["durationSeconds"] = task.durationSeconds;
obj["savePath"] = task.savePath;
obj["status"] = taskStatusToString(task.status);
obj["HalogenLampPreheatingTime_Minute"] = task.HalogenLampPreheatingTime_Minute;
QJsonArray subTasksArray;
for (const auto& subTask : task.subTasks) {
@ -179,6 +180,7 @@ bool TimedDataCollectionDataStructuresReaderWriter::jsonToTimedTask(const QJsonO
task.durationSeconds = json["durationSeconds"].toInt();
task.savePath = json["savePath"].toString();
task.status = stringToTaskStatus(json["status"].toString());
task.HalogenLampPreheatingTime_Minute = json["HalogenLampPreheatingTime_Minute"].toDouble();
QJsonArray subTasksArray = json["subTasks"].toArray();
task.subTasks.clear();
@ -224,10 +226,20 @@ void TaskExecutor::execute(const TimedTask& task)
// 打开卤素灯预热
emit switchHalogenLampSignal(1);
printMsgAndTime("open HalogenLamp");
makeFolder(m_task.savePath);
// 开始执行第一个子任务
QTimer::singleShot(20*1000, this, &TaskExecutor::executeNextSubTask);
double sleepTimeSecond = m_task.HalogenLampPreheatingTime_Minute * 60;
QTimer::singleShot(sleepTimeSecond *1000, this, &TaskExecutor::executeNextSubTask);
}
void TaskExecutor::printMsgAndTime(QString msg)
{
QDateTime now = QDateTime::currentDateTime();
QString timeString = now.toString("yyyy-MM-dd hh:mm:ss.zzz");
qDebug() << msg + " time:" << timeString;
}
void TaskExecutor::stop()
@ -283,6 +295,7 @@ void TaskExecutor::onSequenceComplete(int status)
case SubTaskType::SingleLensReflex:
{
emit switchD65LampSignal(0);
emit switchSlrSignal(0);
break;
}
case SubTaskType::DepthCamera:
@ -320,8 +333,18 @@ void TaskExecutor::onBack2Origin()
m_currentSubTaskIndex++;
if (m_currentSubTaskIndex < m_task.subTasks.size()) {
// 执行下一个子任务
if(m_task.subTasks[m_currentSubTaskIndex].type== SubTaskType::SingleLensReflex)
{
printMsgAndTime("Slr taskfor weak upplease wait 135 seconds!");
emit switchSlrSignal(0);
QTimer::singleShot(135*1000, this, &TaskExecutor::executeNextSubTask);
}
else
{
QTimer::singleShot(1000, this, &TaskExecutor::executeNextSubTask);
}
}
else {
// 所有子任务完成
m_isRunning = false;
@ -346,14 +369,16 @@ void TaskExecutor::executeNextSubTask()
return;
}
std::cerr << "TaskExecutor::executeNextSubTask执行子任务" << std::endl;
SubTask& subTask = m_task.subTasks[m_currentSubTaskIndex];
subTask.status = TaskStatus::Running;
subTask.startTime = QDateTime::currentDateTime();
qDebug() << "TaskExecutor: Starting subtask" << m_currentSubTaskIndex
<< "type:" << static_cast<int>(subTask.type);
QString tmp = "TaskExecutor: Starting subtask" + QString::number(m_currentSubTaskIndex) + "type:" + static_cast<int>(subTask.type);
printMsgAndTime(tmp);
//printMsgAndTime("excute " + QString::number(m_currentSubTaskIndex) + " subTask: ");
//qDebug() << "TaskExecutor: Starting subtask" << m_currentSubTaskIndex
// << "type:" << static_cast<int>(subTask.type);
emit subTaskStarted(m_currentSubTaskIndex, subTask.type);
@ -364,7 +389,6 @@ void TaskExecutor::executeNextSubTask()
{
case SubTaskType::HyperSpectual400_1000nm:
{
//提前需做需要打开卤素灯进行预热5分钟具体的实现方式通过QTcpServer通讯ip192.168.1.2:6003
camType = 0;
emit hyperCamParm(camType, subTask.frameRate, subTask.exposureTime, makeSubTaskDataFolder("L"), "test");
@ -372,7 +396,6 @@ void TaskExecutor::executeNextSubTask()
}
case SubTaskType::HyperSpectual1000_1700nm:
{
//提前需做需要打开卤素灯进行预热5分钟
camType = 1;
emit hyperCamParm(camType, subTask.frameRate, subTask.exposureTime, makeSubTaskDataFolder("NIR"), "test");
@ -380,19 +403,18 @@ void TaskExecutor::executeNextSubTask()
}
case SubTaskType::SingleLensReflex:
{
//提前需做1需要打开D65灯2需要将单反的电源重新上电
camType = 2;
emit camParm(camType, 3, makeSubTaskDataFolder("SLR"));
emit switchD65LampSignal(1);
QThread::msleep(1000);
emit switchSlrSignal(1);
break;
}
case SubTaskType::DepthCamera:
{
//提前需做需要打开D65灯
camType = 3;
emit camParm(camType, 3, makeSubTaskDataFolder("DepthCamera"));

View File

@ -56,6 +56,7 @@ struct TimedTask {
QString savePath; // 数据保存路径
QVector<SubTask> subTasks; // 子任务列表
TaskStatus status = TaskStatus::Waiting; // 状态
double HalogenLampPreheatingTime_Minute;
// 计算所有子任务的预计总时间
int totalEstimatedDuration() const {
@ -157,6 +158,8 @@ public slots:
private:
void executeNextSubTask();
void printMsgAndTime(QString msg);
TimedTask m_task;
int m_currentSubTaskIndex;
bool m_isRunning;