add,计划采集10:
解决偶发单反唤起失败问题; 任务文件要求: 1、高光谱必须在前面,没有顺序要求,因为在执行高光谱任务前会预热卤素灯,所有高光谱任务完成后才关闭卤素灯; 2、单反/深度必须在后面,没有顺序要求; 3、必须要有高光谱任务:单反存在唤醒程序和一定反应时间,所以必须依赖前一个任务进行唤醒; (1)当单反已经是唤醒状态时,重新上电(先下电后上电)后可马上重新唤醒单反:单反适配器剩余电量马上耗尽,所以才能马上重新唤醒单反; (2)当单反在上电的状态下,从唤醒状态自动进入休眠状态时,重新下电后需要等待2分15秒(135秒)后,再重新上电才能唤醒单反:等待135秒的目的是将适配器中电容的剩余电量耗尽;
This commit is contained in:
@ -87,6 +87,7 @@ void TwoMotionCaptureCoordinator::getLocBeforeStart()
|
|||||||
QMetaObject::Connection conn = QObject::connect(m_motorCtrl, &IrisMultiMotorController::locationSignal,
|
QMetaObject::Connection conn = QObject::connect(m_motorCtrl, &IrisMultiMotorController::locationSignal,
|
||||||
[&](std::vector<double> pos) {
|
[&](std::vector<double> pos) {
|
||||||
m_locBeforeStart = pos;
|
m_locBeforeStart = pos;
|
||||||
|
std::cout << "start pos: "<< pos[0] <<", " << pos[1] << std::endl;
|
||||||
received = true;
|
received = true;
|
||||||
loop.quit();
|
loop.quit();
|
||||||
});
|
});
|
||||||
@ -348,6 +349,7 @@ void TwoMotionCaptureCoordinator::startRecordHsi()
|
|||||||
emit moveTo(0, tmp.targetXMaxPosition, tmp.speedTargetXMaxPosition, 1000);
|
emit moveTo(0, tmp.targetXMaxPosition, tmp.speedTargetXMaxPosition, 1000);
|
||||||
|
|
||||||
emit startRecordHSISignal(m_numCurrentPathLine);
|
emit startRecordHSISignal(m_numCurrentPathLine);
|
||||||
|
emit startRecordLineNumSignal(m_numCurrentPathLine);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -409,7 +411,7 @@ void TwoMotionCaptureCoordinator::processNextPathLine()
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::cout << "\nNew path line: " << m_numCurrentPathLine << std::endl;
|
std::cout << "\nNew path line: " << m_numCurrentPathLine << std::endl;
|
||||||
emit startRecordLineNumSignal(m_numCurrentPathLine);
|
emit gotoRecordLineNumSignal(m_numCurrentPathLine);
|
||||||
m_isValidCapturing = true;
|
m_isValidCapturing = true;
|
||||||
|
|
||||||
PathLine &tmp = m_pathLines[m_numCurrentPathLine];
|
PathLine &tmp = m_pathLines[m_numCurrentPathLine];
|
||||||
|
|||||||
@ -47,6 +47,7 @@ public:
|
|||||||
signals:
|
signals:
|
||||||
void sequenceComplete(int);//0:所有采集线正常运行完成,1:用户主动取消采集
|
void sequenceComplete(int);//0:所有采集线正常运行完成,1:用户主动取消采集
|
||||||
void back2OriginSignal();
|
void back2OriginSignal();
|
||||||
|
void gotoRecordLineNumSignal(int lineNum);
|
||||||
void startRecordLineNumSignal(int lineNum);
|
void startRecordLineNumSignal(int lineNum);
|
||||||
void finishRecordLineNumSignal(int lineNum);
|
void finishRecordLineNumSignal(int lineNum);
|
||||||
|
|
||||||
|
|||||||
@ -609,11 +609,6 @@ void HPPA::initTimedDataCollection()
|
|||||||
// 相机/马达 → 定时采集控制器
|
// 相机/马达 → 定时采集控制器
|
||||||
connect(m_tmc, &TwoMotorControl::sequenceComplete, mTimedDataCollectionWindow, &TimedDataCollection::subTaskCompleted);
|
connect(m_tmc, &TwoMotorControl::sequenceComplete, mTimedDataCollectionWindow, &TimedDataCollection::subTaskCompleted);
|
||||||
connect(m_tmc, &TwoMotorControl::back2OriginSignal_TimedDataCollection, mTimedDataCollectionWindow, &TimedDataCollection::onBack2Origin);
|
connect(m_tmc, &TwoMotorControl::back2OriginSignal_TimedDataCollection, mTimedDataCollectionWindow, &TimedDataCollection::onBack2Origin);
|
||||||
|
|
||||||
//电源控制m_pc3D
|
|
||||||
|
|
||||||
|
|
||||||
//连接马达控制和单反/深度
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void HPPA::setTimedDataCollectionHyperCamParm(int camType, double f, double e, QString filePath, QString fileName)
|
void HPPA::setTimedDataCollectionHyperCamParm(int camType, double f, double e, QString filePath, QString fileName)
|
||||||
|
|||||||
@ -160,6 +160,7 @@ QJsonObject TimedDataCollectionDataStructuresReaderWriter::timedTaskToJson(const
|
|||||||
obj["durationSeconds"] = task.durationSeconds;
|
obj["durationSeconds"] = task.durationSeconds;
|
||||||
obj["savePath"] = task.savePath;
|
obj["savePath"] = task.savePath;
|
||||||
obj["status"] = taskStatusToString(task.status);
|
obj["status"] = taskStatusToString(task.status);
|
||||||
|
obj["HalogenLampPreheatingTime_Minute"] = task.HalogenLampPreheatingTime_Minute;
|
||||||
|
|
||||||
QJsonArray subTasksArray;
|
QJsonArray subTasksArray;
|
||||||
for (const auto& subTask : task.subTasks) {
|
for (const auto& subTask : task.subTasks) {
|
||||||
@ -179,6 +180,7 @@ bool TimedDataCollectionDataStructuresReaderWriter::jsonToTimedTask(const QJsonO
|
|||||||
task.durationSeconds = json["durationSeconds"].toInt();
|
task.durationSeconds = json["durationSeconds"].toInt();
|
||||||
task.savePath = json["savePath"].toString();
|
task.savePath = json["savePath"].toString();
|
||||||
task.status = stringToTaskStatus(json["status"].toString());
|
task.status = stringToTaskStatus(json["status"].toString());
|
||||||
|
task.HalogenLampPreheatingTime_Minute = json["HalogenLampPreheatingTime_Minute"].toDouble();
|
||||||
|
|
||||||
QJsonArray subTasksArray = json["subTasks"].toArray();
|
QJsonArray subTasksArray = json["subTasks"].toArray();
|
||||||
task.subTasks.clear();
|
task.subTasks.clear();
|
||||||
@ -224,10 +226,20 @@ void TaskExecutor::execute(const TimedTask& task)
|
|||||||
|
|
||||||
// 打开卤素灯预热
|
// 打开卤素灯预热
|
||||||
emit switchHalogenLampSignal(1);
|
emit switchHalogenLampSignal(1);
|
||||||
|
printMsgAndTime("open HalogenLamp");
|
||||||
|
|
||||||
makeFolder(m_task.savePath);
|
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()
|
void TaskExecutor::stop()
|
||||||
@ -283,6 +295,7 @@ void TaskExecutor::onSequenceComplete(int status)
|
|||||||
case SubTaskType::SingleLensReflex:
|
case SubTaskType::SingleLensReflex:
|
||||||
{
|
{
|
||||||
emit switchD65LampSignal(0);
|
emit switchD65LampSignal(0);
|
||||||
|
emit switchSlrSignal(0);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case SubTaskType::DepthCamera:
|
case SubTaskType::DepthCamera:
|
||||||
@ -320,8 +333,18 @@ void TaskExecutor::onBack2Origin()
|
|||||||
m_currentSubTaskIndex++;
|
m_currentSubTaskIndex++;
|
||||||
if (m_currentSubTaskIndex < m_task.subTasks.size()) {
|
if (m_currentSubTaskIndex < m_task.subTasks.size()) {
|
||||||
// 执行下一个子任务
|
// 执行下一个子任务
|
||||||
|
if(m_task.subTasks[m_currentSubTaskIndex].type== SubTaskType::SingleLensReflex)
|
||||||
|
{
|
||||||
|
printMsgAndTime("Slr task,for weak up,please wait 135 seconds!");
|
||||||
|
emit switchSlrSignal(0);
|
||||||
|
|
||||||
|
QTimer::singleShot(135*1000, this, &TaskExecutor::executeNextSubTask);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
QTimer::singleShot(1000, this, &TaskExecutor::executeNextSubTask);
|
QTimer::singleShot(1000, this, &TaskExecutor::executeNextSubTask);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
// 所有子任务完成
|
// 所有子任务完成
|
||||||
m_isRunning = false;
|
m_isRunning = false;
|
||||||
@ -346,14 +369,16 @@ void TaskExecutor::executeNextSubTask()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::cerr << "TaskExecutor::executeNextSubTask,执行子任务" << std::endl;
|
|
||||||
|
|
||||||
SubTask& subTask = m_task.subTasks[m_currentSubTaskIndex];
|
SubTask& subTask = m_task.subTasks[m_currentSubTaskIndex];
|
||||||
subTask.status = TaskStatus::Running;
|
subTask.status = TaskStatus::Running;
|
||||||
subTask.startTime = QDateTime::currentDateTime();
|
subTask.startTime = QDateTime::currentDateTime();
|
||||||
|
|
||||||
qDebug() << "TaskExecutor: Starting subtask" << m_currentSubTaskIndex
|
QString tmp = "TaskExecutor: Starting subtask" + QString::number(m_currentSubTaskIndex) + "type:" + static_cast<int>(subTask.type);
|
||||||
<< "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);
|
emit subTaskStarted(m_currentSubTaskIndex, subTask.type);
|
||||||
|
|
||||||
@ -364,7 +389,6 @@ void TaskExecutor::executeNextSubTask()
|
|||||||
{
|
{
|
||||||
case SubTaskType::HyperSpectual400_1000nm:
|
case SubTaskType::HyperSpectual400_1000nm:
|
||||||
{
|
{
|
||||||
//提前需做:需要打开卤素灯进行预热5分钟,具体的实现方式:通过QTcpServer通讯,ip:192.168.1.2:6003,
|
|
||||||
camType = 0;
|
camType = 0;
|
||||||
emit hyperCamParm(camType, subTask.frameRate, subTask.exposureTime, makeSubTaskDataFolder("L"), "test");
|
emit hyperCamParm(camType, subTask.frameRate, subTask.exposureTime, makeSubTaskDataFolder("L"), "test");
|
||||||
|
|
||||||
@ -372,7 +396,6 @@ void TaskExecutor::executeNextSubTask()
|
|||||||
}
|
}
|
||||||
case SubTaskType::HyperSpectual1000_1700nm:
|
case SubTaskType::HyperSpectual1000_1700nm:
|
||||||
{
|
{
|
||||||
//提前需做:需要打开卤素灯进行预热5分钟
|
|
||||||
camType = 1;
|
camType = 1;
|
||||||
emit hyperCamParm(camType, subTask.frameRate, subTask.exposureTime, makeSubTaskDataFolder("NIR"), "test");
|
emit hyperCamParm(camType, subTask.frameRate, subTask.exposureTime, makeSubTaskDataFolder("NIR"), "test");
|
||||||
|
|
||||||
@ -380,19 +403,18 @@ void TaskExecutor::executeNextSubTask()
|
|||||||
}
|
}
|
||||||
case SubTaskType::SingleLensReflex:
|
case SubTaskType::SingleLensReflex:
|
||||||
{
|
{
|
||||||
//提前需做:(1)需要打开D65灯(2)需要将单反的电源重新上电
|
|
||||||
camType = 2;
|
camType = 2;
|
||||||
emit camParm(camType, 3, makeSubTaskDataFolder("SLR"));
|
emit camParm(camType, 3, makeSubTaskDataFolder("SLR"));
|
||||||
|
|
||||||
emit switchD65LampSignal(1);
|
emit switchD65LampSignal(1);
|
||||||
|
|
||||||
QThread::msleep(1000);
|
|
||||||
|
emit switchSlrSignal(1);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case SubTaskType::DepthCamera:
|
case SubTaskType::DepthCamera:
|
||||||
{
|
{
|
||||||
//提前需做:需要打开D65灯
|
|
||||||
camType = 3;
|
camType = 3;
|
||||||
emit camParm(camType, 3, makeSubTaskDataFolder("DepthCamera"));
|
emit camParm(camType, 3, makeSubTaskDataFolder("DepthCamera"));
|
||||||
|
|
||||||
|
|||||||
@ -56,6 +56,7 @@ struct TimedTask {
|
|||||||
QString savePath; // 数据保存路径
|
QString savePath; // 数据保存路径
|
||||||
QVector<SubTask> subTasks; // 子任务列表
|
QVector<SubTask> subTasks; // 子任务列表
|
||||||
TaskStatus status = TaskStatus::Waiting; // 状态
|
TaskStatus status = TaskStatus::Waiting; // 状态
|
||||||
|
double HalogenLampPreheatingTime_Minute;
|
||||||
|
|
||||||
// 计算所有子任务的预计总时间
|
// 计算所有子任务的预计总时间
|
||||||
int totalEstimatedDuration() const {
|
int totalEstimatedDuration() const {
|
||||||
@ -157,6 +158,8 @@ public slots:
|
|||||||
private:
|
private:
|
||||||
void executeNextSubTask();
|
void executeNextSubTask();
|
||||||
|
|
||||||
|
void printMsgAndTime(QString msg);
|
||||||
|
|
||||||
TimedTask m_task;
|
TimedTask m_task;
|
||||||
int m_currentSubTaskIndex;
|
int m_currentSubTaskIndex;
|
||||||
bool m_isRunning;
|
bool m_isRunning;
|
||||||
|
|||||||
Reference in New Issue
Block a user