add,计划采集9:

基本计划采集功能:采集流程电源通断控制ok
This commit is contained in:
tangchao0503
2026-06-10 18:10:47 +08:00
parent 4a62d9a007
commit 509f4b0767
8 changed files with 128 additions and 4 deletions

View File

@ -222,9 +222,12 @@ void TaskExecutor::execute(const TimedTask& task)
qDebug() << "TaskExecutor: Starting task" << task.id;
// 开始执行第一个子任务
// 打开卤素灯预热
emit switchHalogenLampSignal(1);
makeFolder(m_task.savePath);
executeNextSubTask();
// 开始执行第一个子任务
QTimer::singleShot(20*1000, this, &TaskExecutor::executeNextSubTask);
}
void TaskExecutor::stop()
@ -273,6 +276,42 @@ void TaskExecutor::onSequenceComplete(int status)
emit subTaskFinished(m_currentSubTaskIndex, subTask.type, (status == 0));
}
//
switch (m_task.subTasks[m_currentSubTaskIndex].type)
{
case SubTaskType::SingleLensReflex:
{
emit switchD65LampSignal(0);
break;
}
case SubTaskType::DepthCamera:
{
emit switchD65LampSignal(0);
break;
}
}
// 判断下一次的任务是否为高光谱任务,如果不是关闭卤素灯
int nestSubTaskIndex = m_currentSubTaskIndex + 1;
if (nestSubTaskIndex >= m_task.subTasks.size())
{
emit switchHalogenLampSignal(0);
return;
}
switch (m_task.subTasks[nestSubTaskIndex].type)
{
case SubTaskType::SingleLensReflex:
{
emit switchHalogenLampSignal(0);
break;
}
case SubTaskType::DepthCamera:
{
emit switchHalogenLampSignal(0);
break;
}
}
}
void TaskExecutor::onBack2Origin()
@ -281,7 +320,7 @@ void TaskExecutor::onBack2Origin()
m_currentSubTaskIndex++;
if (m_currentSubTaskIndex < m_task.subTasks.size()) {
// 执行下一个子任务
QTimer::singleShot(100, this, &TaskExecutor::executeNextSubTask);
QTimer::singleShot(1000, this, &TaskExecutor::executeNextSubTask);
}
else {
// 所有子任务完成
@ -325,6 +364,7 @@ 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");
@ -332,6 +372,7 @@ void TaskExecutor::executeNextSubTask()
}
case SubTaskType::HyperSpectual1000_1700nm:
{
//提前需做需要打开卤素灯进行预热5分钟
camType = 1;
emit hyperCamParm(camType, subTask.frameRate, subTask.exposureTime, makeSubTaskDataFolder("NIR"), "test");
@ -339,16 +380,24 @@ void TaskExecutor::executeNextSubTask()
}
case SubTaskType::SingleLensReflex:
{
//提前需做1需要打开D65灯2需要将单反的电源重新上电
camType = 2;
emit camParm(camType, 3, makeSubTaskDataFolder("SLR"));
emit switchD65LampSignal(1);
QThread::msleep(1000);
break;
}
case SubTaskType::DepthCamera:
{
//提前需做需要打开D65灯
camType = 3;
emit camParm(camType, 3, makeSubTaskDataFolder("DepthCamera"));
emit switchD65LampSignal(1);
break;
}
}
@ -501,6 +550,10 @@ void TaskScheduler::executeTask(TimedTask& task)
connect(m_currentExecutor, &TaskExecutor::startRecordSignal,
this, &TaskScheduler::startRecordSignal);
connect(m_currentExecutor, &TaskExecutor::switchHalogenLampSignal, this, &TaskScheduler::switchHalogenLampSignal);
connect(m_currentExecutor, &TaskExecutor::switchD65LampSignal, this, &TaskScheduler::switchD65LampSignal);
connect(m_currentExecutor, &TaskExecutor::switchSlrSignal, this, &TaskScheduler::switchSlrSignal);
connect(this, &TaskScheduler::sequenceCompleteSignal, m_currentExecutor, &TaskExecutor::onSequenceComplete);
connect(this, &TaskScheduler::Back2OriginSignal, m_currentExecutor, &TaskExecutor::onBack2Origin);