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

@ -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,7 +333,17 @@ void TaskExecutor::onBack2Origin()
m_currentSubTaskIndex++;
if (m_currentSubTaskIndex < m_task.subTasks.size()) {
// 执行下一个子任务
QTimer::singleShot(1000, this, &TaskExecutor::executeNextSubTask);
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 {
// 所有子任务完成
@ -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"));