..
This commit is contained in:
@@ -116,7 +116,11 @@ namespace AGVNavigationCore.PathFinding.Planning
|
||||
// 기본값으로 경로 탐색 (이전 위치 = 현재 위치, 방향 = 전진)
|
||||
return FindPath(startNode, targetNode, startNode, AgvDirection.Forward, AgvDirection.Forward, false);
|
||||
}
|
||||
|
||||
public AGVPathResult FindPathAStar(MapNode startNode, MapNode targetNode)
|
||||
{
|
||||
// 기본값으로 경로 탐색 (이전 위치 = 현재 위치, 방향 = 전진)
|
||||
return _basicPathfinder.FindPathAStar(startNode.Id, targetNode.Id);
|
||||
}
|
||||
public AGVPathResult FindPath(MapNode startNode, MapNode targetNode,
|
||||
MapNode prevNode, AgvDirection prevDirection, AgvDirection currentDirection, bool crossignore = false)
|
||||
{
|
||||
@@ -434,6 +438,48 @@ namespace AGVNavigationCore.PathFinding.Planning
|
||||
/// <summary>
|
||||
/// 이 작업후에 MakeMagnetDirection 를 추가로 실행 하세요
|
||||
/// </summary>
|
||||
|
||||
/// <summary>
|
||||
/// 단순 경로 찾기 (복잡한 제약조건/방향전환 로직 없이 A* 결과만 반환)
|
||||
/// </summary>
|
||||
public AGVPathResult FindBasicPath(MapNode startNode, MapNode targetNode, MapNode prevNode, AgvDirection prevDirection)
|
||||
{
|
||||
// 1. 입력 검증
|
||||
if (startNode == null || targetNode == null)
|
||||
return AGVPathResult.CreateFailure("노드 정보 오류", 0, 0);
|
||||
|
||||
// 2. A* 경로 탐색
|
||||
var pathResult = _basicPathfinder.FindPathAStar(startNode.Id, targetNode.Id);
|
||||
pathResult.PrevNode = prevNode;
|
||||
pathResult.PrevDirection = prevDirection;
|
||||
|
||||
if (!pathResult.Success)
|
||||
return AGVPathResult.CreateFailure(pathResult.ErrorMessage ?? "경로 없음", 0, 0);
|
||||
|
||||
// 3. 상세 데이터 생성 (단순화: 방향 전환 없이 현재 방향 유지)
|
||||
if (pathResult.Path != null && pathResult.Path.Count > 0)
|
||||
{
|
||||
var detailedPath = new List<NodeMotorInfo>();
|
||||
for (int i = 0; i < pathResult.Path.Count; i++)
|
||||
{
|
||||
var node = pathResult.Path[i];
|
||||
string nextNodeId = (i + 1 < pathResult.Path.Count) ? pathResult.Path[i + 1].Id : null;
|
||||
|
||||
// 단순화: 입력된 현재 방향을 그대로 사용
|
||||
var nodeInfo = new NodeMotorInfo(i + 1, node.Id, node.RfidId, prevDirection, nextNodeId, MagnetDirection.Straight);
|
||||
|
||||
// 속도 설정
|
||||
var mapNode = _mapNodes.FirstOrDefault(n => n.Id == node.Id);
|
||||
if (mapNode != null) nodeInfo.Speed = mapNode.SpeedLimit;
|
||||
|
||||
detailedPath.Add(nodeInfo);
|
||||
}
|
||||
pathResult.DetailedPath = detailedPath;
|
||||
}
|
||||
|
||||
return pathResult;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 이 작업후에 MakeMagnetDirection 를 추가로 실행 하세요
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user