From e8b9fceb881f9289835733cda12aeda222d0047f Mon Sep 17 00:00:00 2001 From: backuppc Date: Tue, 28 Oct 2025 17:32:59 +0900 Subject: [PATCH] fix: Prevent returning to previous node when direction is maintained MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 방향 유지 시 이전 노드로 되돌아가는 문제 수정 - 방향 유지(prevDirection == direction): 이전 노드 제외 - 방향 전환(prevDirection != direction): 모든 연결 노드 허용 (U-turn 가능) 수정 파일: DirectionalHelper.cs:61-73 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- .../AGVNavigationCore/Utils/DirectionalHelper.cs | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/Cs_HMI/AGVLogic/AGVNavigationCore/Utils/DirectionalHelper.cs b/Cs_HMI/AGVLogic/AGVNavigationCore/Utils/DirectionalHelper.cs index 9ca99f4..7ee251e 100644 --- a/Cs_HMI/AGVLogic/AGVNavigationCore/Utils/DirectionalHelper.cs +++ b/Cs_HMI/AGVLogic/AGVNavigationCore/Utils/DirectionalHelper.cs @@ -58,9 +58,19 @@ namespace AGVNavigationCore.Utils if (connectedNodeIds == null || connectedNodeIds.Count == 0) return null; - var candidateNodes = allNodes.Where(n => + List candidateNodes = new List(); + if (prevDirection == direction) + { + candidateNodes = allNodes.Where(n => n.NodeId != prevNode.NodeId && connectedNodeIds.Contains(n.NodeId) - ).ToList(); + ).ToList(); + } + else + { + candidateNodes = allNodes.Where(n => + connectedNodeIds.Contains(n.NodeId) + ).ToList(); + } if (candidateNodes.Count == 0) return null;