This commit is contained in:
Alvin-lyq 2026-05-07 15:38:13 +08:00
parent 681fa81409
commit 3a4c1191c0

View File

@ -411,9 +411,12 @@ void PL_ProcThread()
task_status = TaskStatus::PATH_FINISHED; // 单路径完成 task_status = TaskStatus::PATH_FINISHED; // 单路径完成
LOG_INFO("设置任务状态为 PATH_FINISHED"); LOG_INFO("设置任务状态为 PATH_FINISHED");
// 短暂休眠,确保车辆停稳 // 短暂休眠,确保车辆停稳,同时检查退出标志
LOG_INFO("车辆停稳中..."); LOG_INFO("车辆停稳中...");
sleep(3); for (int i = 0; i < 30 && !thread_exit_flag; ++i)
{
std::this_thread::sleep_for(std::chrono::milliseconds(100));
}
continue; continue;
} }
else if (des_pos != -1) else if (des_pos != -1)
@ -447,7 +450,20 @@ void PL_ProcThread()
void* pl_thread(void* args) void* pl_thread(void* args)
{ {
(void)args; (void)args;
sleep(3); // 等待3秒但每100ms检查一次退出标志
for (int i = 0; i < 30 && !thread_exit_flag; ++i)
{
std::this_thread::sleep_for(std::chrono::milliseconds(100));
}
if (thread_exit_flag)
{
LOG_INFO("pl_thread 收到退出信号,提前退出");
return NULL;
}
// 重置最近点索引,允许在新任务上自由搜索
g_last_road_pos = -1;
if (!load_path_file()) if (!load_path_file())
{ {