..
This commit is contained in:
@@ -151,11 +151,6 @@ namespace AGVNavigationCore.Models
|
||||
|
||||
#region Path Execution Methods
|
||||
|
||||
/// <summary>
|
||||
/// 경로 실행
|
||||
/// </summary>
|
||||
void ExecutePath(AGVPathResult path, List<MapNode> mapNodes);
|
||||
|
||||
/// <summary>
|
||||
/// 경로 정지
|
||||
/// </summary>
|
||||
|
||||
@@ -258,62 +258,8 @@ namespace AGVNavigationCore.Models
|
||||
|
||||
#region Public Methods - 경로 실행
|
||||
|
||||
/// <summary>
|
||||
/// 경로 실행 시작
|
||||
/// </summary>
|
||||
/// <param name="path">실행할 경로</param>
|
||||
/// <param name="mapNodes">맵 노드 목록</param>
|
||||
public void ExecutePath(AGVPathResult path, List<MapNode> mapNodes)
|
||||
{
|
||||
if (path == null || !path.Success)
|
||||
{
|
||||
OnError("유효하지 않은 경로입니다.");
|
||||
return;
|
||||
}
|
||||
|
||||
_currentPath = path;
|
||||
_remainingNodes = new List<string>(path.Path.Select(n => n.NodeId).ToList());
|
||||
_currentNodeIndex = 0;
|
||||
|
||||
// 시작 노드와 목표 노드 설정
|
||||
if (_remainingNodes.Count > 0)
|
||||
{
|
||||
var startNode = mapNodes.FirstOrDefault(n => n.NodeId == _remainingNodes[0]);
|
||||
if (startNode != null)
|
||||
{
|
||||
_currentNode = startNode;
|
||||
|
||||
// 목표 노드 설정 (경로의 마지막 노드)
|
||||
if (_remainingNodes.Count > 1)
|
||||
{
|
||||
var targetNodeId = _remainingNodes[_remainingNodes.Count - 1];
|
||||
var targetNode = mapNodes.FirstOrDefault(n => n.NodeId == targetNodeId);
|
||||
|
||||
// 목표 노드의 타입에 따라 도킹 방향 결정
|
||||
if (targetNode != null)
|
||||
{
|
||||
_dockingDirection = GetDockingDirection(targetNode.Type);
|
||||
_prevNode = targetNode;
|
||||
}
|
||||
}
|
||||
|
||||
StartMovement();
|
||||
}
|
||||
else
|
||||
{
|
||||
OnError($"시작 노드를 찾을 수 없습니다: {_remainingNodes[0]}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 간단한 경로 실행 (경로 객체 없이 노드만)
|
||||
/// </summary>
|
||||
public void StartPath(AGVPathResult path, List<MapNode> mapNodes)
|
||||
{
|
||||
ExecutePath(path, mapNodes);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 경로 정지
|
||||
/// </summary>
|
||||
@@ -428,14 +374,15 @@ namespace AGVNavigationCore.Models
|
||||
{
|
||||
_prevPosition = _currentPosition; // 이전 위치
|
||||
_prevNode = _currentNode;
|
||||
}
|
||||
|
||||
//모터방향이 다르다면 적용한다
|
||||
if (_currentDirection != motorDirection)
|
||||
{
|
||||
_prevDirection = _currentDirection;
|
||||
}
|
||||
|
||||
////모터방향이 다르다면 적용한다
|
||||
//if (_currentDirection != motorDirection)
|
||||
//{
|
||||
// _prevDirection = motorDirection;
|
||||
//}
|
||||
|
||||
// 새로운 위치 설정
|
||||
_currentPosition = node.Position;
|
||||
_currentDirection = motorDirection;
|
||||
|
||||
Reference in New Issue
Block a user