Refactor AGV error handling: Standardize AGVErrorCode usage and update SetRunStepError
This commit is contained in:
@@ -46,6 +46,7 @@ namespace Project
|
||||
{
|
||||
|
||||
case ENIGProtocol.AGVCommandHE.SetCurrent: //Set Current Position
|
||||
Resultclear();
|
||||
|
||||
if (data.Length > 4)
|
||||
{
|
||||
@@ -75,6 +76,7 @@ namespace Project
|
||||
case ENIGProtocol.AGVCommandHE.PickOnEnter: // 110
|
||||
case ENIGProtocol.AGVCommandHE.PickOffEnter: // 111
|
||||
{
|
||||
Resultclear();
|
||||
PUB.log.AddI($"XBEE:작업명령수신:{cmd}");
|
||||
|
||||
// 현재 위치 확인 (TargetNode가 아닌 CurrentNode 기준)
|
||||
@@ -120,6 +122,7 @@ namespace Project
|
||||
|
||||
case ENIGProtocol.AGVCommandHE.Charger: // 112
|
||||
{
|
||||
Resultclear();
|
||||
PUB.log.AddI($"XBEE:충전명령수신");
|
||||
PUB.NextWorkCmd = ENIGProtocol.AGVCommandHE.Charger;
|
||||
PUB.sm.SetNewRunStep(ERunStep.GOCHARGE);
|
||||
@@ -128,6 +131,7 @@ namespace Project
|
||||
|
||||
case ENIGProtocol.AGVCommandHE.GotoAlias:
|
||||
case ENIGProtocol.AGVCommandHE.Goto: //move to tag
|
||||
Resultclear();
|
||||
var datalength = cmd == ENIGProtocol.AGVCommandHE.GotoAlias ? 2 : 1;
|
||||
if (data.Length > datalength)
|
||||
{
|
||||
@@ -210,10 +214,11 @@ namespace Project
|
||||
break;
|
||||
case ENIGProtocol.AGVCommandHE.Reset: //Error Reset
|
||||
PUB.log.Add($"[{logPrefix}-Reset]");
|
||||
PUB.AGV.AGVErrorReset();
|
||||
ResetSystemError();
|
||||
break;
|
||||
|
||||
case ENIGProtocol.AGVCommandHE.Manual: //Manual Move (Direction, speed, runtime)
|
||||
Resultclear();
|
||||
var Direction = data[1]; //0=back, 1=forward, 2=left, 3=right
|
||||
var Speed = data[2]; //0=slow, 1=normal, 2=fast
|
||||
|
||||
@@ -234,6 +239,7 @@ namespace Project
|
||||
break;
|
||||
|
||||
case ENIGProtocol.AGVCommandHE.AutoMove:
|
||||
Resultclear();
|
||||
var MotDirection = data[1]; //0=back, 1=forward
|
||||
var MagDirection = data[2]; //0=straight, 1=left, 2=right
|
||||
var AutSpeed = data[3]; //0=slow, 1=normal, 2=fast
|
||||
@@ -310,31 +316,6 @@ namespace Project
|
||||
else PUB.log.Add(e.Message);
|
||||
}
|
||||
|
||||
AGVPathResult CalcPath(MapNode startNode, MapNode targetNode)
|
||||
{
|
||||
var nodes = PUB._mapCanvas.Nodes;
|
||||
var _simulatorCanvas = PUB._mapCanvas;
|
||||
var _mapNodes = PUB._mapCanvas.Nodes;
|
||||
|
||||
// 현재 AGV 방향 가져오기
|
||||
var selectedAGV = PUB._virtualAGV;
|
||||
var currentDirection = selectedAGV.CurrentDirection;
|
||||
|
||||
// AGV의 이전 위치에서 가장 가까운 노드 찾기
|
||||
var prevNode = selectedAGV.PrevNode;
|
||||
var prevDir = selectedAGV.PrevDirection;
|
||||
|
||||
// Core Logic으로 이관됨
|
||||
var pathFinder = new AGVPathfinder(nodes);
|
||||
var result = pathFinder.CalculatePath(startNode, targetNode, prevNode, prevDir);
|
||||
|
||||
//게이트웨이노드를 하이라이트강조 한단
|
||||
_simulatorCanvas.HighlightNodeId = (result.Gateway?.Id ?? string.Empty);
|
||||
return result;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user