From 83a4a0e7aa9bdeb95d3547fd5d379fdcbd890fca Mon Sep 17 00:00:00 2001 From: tian <11429339@qq.com> Date: Fri, 10 Oct 2025 23:27:46 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=A5=BC=E6=A2=AF=E5=9C=BA?= =?UTF-8?q?=E6=99=AF=E8=B7=AF=E5=BE=84=E4=B8=8D=E8=83=BD=E5=88=B0=E8=BE=BE?= =?UTF-8?q?=E5=8D=B4=E6=98=BE=E7=A4=BA=E5=88=B0=E8=BE=BE=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/PathPlanning/AutoPathFinder.cs | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/PathPlanning/AutoPathFinder.cs b/src/PathPlanning/AutoPathFinder.cs index af5cab8..8404cb5 100644 --- a/src/PathPlanning/AutoPathFinder.cs +++ b/src/PathPlanning/AutoPathFinder.cs @@ -556,14 +556,14 @@ namespace NavisworksTransport.PathPlanning { var lastInfo = graph3D.NodeInfo[lastNode]; - // 检查最后节点是否到达终点网格(使用前面已定义的endGridPos) - if (lastInfo.X == endGridPos.X && lastInfo.Y == endGridPos.Y) + // 检查最后节点是否到达终点(网格坐标和高度层都要匹配) + if (lastInfo.X == endGridPos.X && lastInfo.Y == endGridPos.Y && lastInfo.LayerIndex == endInfo.LayerIndex) { - // 到达终点网格,路径完整 + // 到达终点网格和高度层,路径完整 isComplete = true; actualEnd = path3D[path3D.Count - 1]; completionPercentage = 100.0; - LogManager.Info($"[3D路径规划] 找到完整路径,到达终点网格({endGridPos.X},{endGridPos.Y})"); + LogManager.Info($"[3D路径规划] 找到完整路径,到达终点网格({endGridPos.X},{endGridPos.Y}) Layer{endInfo.LayerIndex}"); } else { @@ -585,7 +585,15 @@ namespace NavisworksTransport.PathPlanning completionPercentage = totalDistance > 0 ? (actualDistance / totalDistance) * 100 : 0; - LogManager.Warning($"[3D路径规划] 部分路径:到达网格({lastInfo.X},{lastInfo.Y}),距离终点网格({endGridPos.X},{endGridPos.Y})还有距离"); + // 判断是否到达了目标网格但高度层不对 + if (lastInfo.X == endGridPos.X && lastInfo.Y == endGridPos.Y) + { + LogManager.Warning($"[3D路径规划] 部分路径:到达目标网格({lastInfo.X},{lastInfo.Y})但高度层不匹配 - 实际Layer{lastInfo.LayerIndex}, 目标Layer{endInfo.LayerIndex}"); + } + else + { + LogManager.Warning($"[3D路径规划] 部分路径:到达网格({lastInfo.X},{lastInfo.Y}) Layer{lastInfo.LayerIndex},距离终点网格({endGridPos.X},{endGridPos.Y}) Layer{endInfo.LayerIndex}还有距离"); + } LogManager.Info($"[3D路径规划] 完成度: {completionPercentage:F1}%,实际终点: ({actualEnd.X:F2}, {actualEnd.Y:F2}, Z={actualEnd.Z:F2})"); } }