diff --git a/Cs_HMI/AGVLogic/AGVNavigationCore/Controls/UnifiedAGVCanvas.cs b/Cs_HMI/AGVLogic/AGVNavigationCore/Controls/UnifiedAGVCanvas.cs index c7f3c88..ca8c67e 100644 --- a/Cs_HMI/AGVLogic/AGVNavigationCore/Controls/UnifiedAGVCanvas.cs +++ b/Cs_HMI/AGVLogic/AGVNavigationCore/Controls/UnifiedAGVCanvas.cs @@ -144,10 +144,6 @@ namespace AGVNavigationCore.Controls public event EventHandler<(MapNode From, MapNode To)> ConnectionDeleted; public event EventHandler MapChanged; - // AGV 이벤트 - public event EventHandler AGVSelected; - public event EventHandler AGVStateChanged; - #endregion #region Properties diff --git a/Cs_HMI/AGVLogic/AGVNavigationCore/Models/VirtualAGV.cs b/Cs_HMI/AGVLogic/AGVNavigationCore/Models/VirtualAGV.cs index 28ab682..47ca282 100644 --- a/Cs_HMI/AGVLogic/AGVNavigationCore/Models/VirtualAGV.cs +++ b/Cs_HMI/AGVLogic/AGVNavigationCore/Models/VirtualAGV.cs @@ -50,8 +50,6 @@ namespace AGVNavigationCore.Models private string _agvId; private Point _currentPosition; private Point _prevPosition; - private string _targetId; - private string _currentId; private AgvDirection _currentDirection; private AgvDirection _prevDirection; private AGVState _currentState; @@ -75,7 +73,6 @@ namespace AGVNavigationCore.Models // 시뮬레이션 설정 private readonly float _moveSpeed = 50.0f; // 픽셀/초 - private readonly float _rotationSpeed = 90.0f; // 도/초 private bool _isMoving; #endregion diff --git a/Cs_HMI/AGVLogic/AGVNavigationCore/PathFinding/Planning/AGVPathfinder.cs b/Cs_HMI/AGVLogic/AGVNavigationCore/PathFinding/Planning/AGVPathfinder.cs index 80b6de6..201ae08 100644 --- a/Cs_HMI/AGVLogic/AGVNavigationCore/PathFinding/Planning/AGVPathfinder.cs +++ b/Cs_HMI/AGVLogic/AGVNavigationCore/PathFinding/Planning/AGVPathfinder.cs @@ -261,169 +261,5 @@ namespace AGVNavigationCore.PathFinding.Planning } - - /// - /// 기본 경로를 상세 경로로 변환 - /// - private List ConvertToDetailedPath(List simplePath, AgvDirection initialDirection) - { - var detailedPath = new List(); - var currentDirection = initialDirection; - - for (int i = 0; i < simplePath.Count; i++) - { - string currentNodeId = simplePath[i]; - string nextNodeId = (i + 1 < simplePath.Count) ? simplePath[i + 1] : null; - - // 마그넷 방향 계산 - MagnetDirection magnetDirection = MagnetDirection.Straight; - if (i > 0 && nextNodeId != null) - { - string prevNodeId = simplePath[i - 1]; - magnetDirection = _junctionAnalyzer.GetRequiredMagnetDirection(prevNodeId, currentNodeId, nextNodeId, currentDirection); - } - - // 노드 정보 생성 - var nodeMotorInfo = new NodeMotorInfo( - currentNodeId, - currentDirection, - nextNodeId, - magnetDirection - ); - - // 회전 가능 노드 설정 - var mapNode = _mapNodes.FirstOrDefault(n => n.NodeId == currentNodeId); - if (mapNode != null) - { - nodeMotorInfo.CanRotate = mapNode.CanRotate; - } - - detailedPath.Add(nodeMotorInfo); - } - - return detailedPath; - } - - - /// - /// 경로 총 거리 계산 - /// - private float CalculatePathDistance(List detailedPath) - { - float totalDistance = 0; - - for (int i = 0; i < detailedPath.Count - 1; i++) - { - var currentNode = _mapNodes.FirstOrDefault(n => n.NodeId == detailedPath[i].NodeId); - var nextNode = _mapNodes.FirstOrDefault(n => n.NodeId == detailedPath[i + 1].NodeId); - - if (currentNode != null && nextNode != null) - { - float dx = nextNode.Position.X - currentNode.Position.X; - float dy = nextNode.Position.Y - currentNode.Position.Y; - totalDistance += (float)Math.Sqrt(dx * dx + dy * dy); - } - } - - return totalDistance; - } - - /// - /// 경로 유효성 검증 - /// - public bool ValidatePath(List detailedPath) - { - if (detailedPath == null || detailedPath.Count == 0) - return false; - - // 1. 모든 노드가 존재하는지 확인 - foreach (var nodeInfo in detailedPath) - { - if (!_mapNodes.Any(n => n.NodeId == nodeInfo.NodeId)) - return false; - } - - // 2. 연결성 확인 - for (int i = 0; i < detailedPath.Count - 1; i++) - { - string currentId = detailedPath[i].NodeId; - string nextId = detailedPath[i + 1].NodeId; - - if (!_basicPathfinder.AreNodesConnected(currentId, nextId)) - return false; - } - - // 3. 물리적 제약사항 확인 - return ValidatePhysicalConstraints(detailedPath); - } - - /// - /// 물리적 제약사항 검증 - /// - private bool ValidatePhysicalConstraints(List detailedPath) - { - for (int i = 1; i < detailedPath.Count; i++) - { - var prevNode = detailedPath[i - 1]; - var currentNode = detailedPath[i]; - - // 급작스러운 방향 전환 검증 - if (prevNode.MotorDirection != currentNode.MotorDirection) - { - // 방향 전환은 반드시 회전 가능 노드에서만 - if (!currentNode.CanRotate && !currentNode.IsDirectionChangePoint) - { - return false; - } - } - } - - return true; - } - - /// - /// 경로 최적화 - /// - public AGVPathResult OptimizePath(AGVPathResult originalResult) - { - if (!originalResult.Success) - return originalResult; - - // TODO: 경로 최적화 로직 구현 - // - 불필요한 중간 노드 제거 - // - 마그넷 방향 최적화 - // - 방향 전환 최소화 - - return originalResult; - } - - /// - /// 디버깅용 경로 정보 - /// - public string GetPathSummary(AGVPathResult result) - { - if (!result.Success) - return $"경로 계산 실패: {result.ErrorMessage}"; - - var summary = new List - { - $"=== AGV 고급 경로 계획 결과 ===", - $"총 노드 수: {result.DetailedPath.Count}", - $"총 거리: {result.TotalDistance:F1}px", - $"계산 시간: {result.CalculationTimeMs}ms", - $"방향 전환: {(result.RequiredDirectionChange ? $"필요 (노드: {result.DirectionChangeNode})" : "불필요")}", - $"설명: {result.PlanDescription}", - "", - "=== 상세 경로 ===", - }; - - foreach (var nodeInfo in result.DetailedPath) - { - summary.Add(nodeInfo.ToString()); - } - - return string.Join("\n", summary); - } - } } \ No newline at end of file