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;