경로로직

This commit is contained in:
backuppc
2026-03-03 17:29:27 +09:00
parent 1a4b8a6a54
commit 30e1ce41ee
17 changed files with 462 additions and 598 deletions

View File

@@ -424,7 +424,7 @@ namespace AGVMapEditor.Forms
var nodeId = GenerateNodeId();
var position = new Point(100 + this._mapCanvas.Nodes.Count * 50, 100 + this._mapCanvas.Nodes.Count * 50);
var node = new MapNode(nodeId, position, StationType.Normal);
var node = new MapNode(nodeId, position, Station.Normal);
this._mapCanvas.Nodes.Add(node);
_hasChanges = true;
@@ -850,9 +850,9 @@ namespace AGVMapEditor.Forms
case NodeType.Normal:
var item = node as MapNode;
if (item.StationType == StationType.Normal)
if (item.StationType == Station.Normal)
foreColor = Color.DimGray;
else if (item.StationType == StationType.Charger)
else if (item.StationType == Station.Charger)
foreColor = Color.Red;
else
foreColor = Color.DarkGreen;

View File

@@ -980,7 +980,7 @@ namespace AGVNavigationCore.Controls
{
case NodeType.Normal:
var item = _selectedNode as MapNode;
if (item.StationType == StationType.Charger)
if (item.StationType == Station.Charger)
DrawTriangleGhost(g, ghostBrush);
else
DrawPentagonGhost(g, ghostBrush);
@@ -1169,16 +1169,16 @@ namespace AGVNavigationCore.Controls
switch (node.StationType)
{
case StationType.Loader:
case StationType.Cleaner:
case StationType.Plating:
case StationType.Buffer:
case Station.Loder:
case Station.Cleaner:
case Station.Plating:
case Station.Buffer:
DrawPentagonNodeShape(g, node, brush);
break;
case StationType.Charger:
case Station.Charger:
DrawTriangleNodeShape(g, node, brush);
break;
case StationType.Limit:
case Station.Lmt:
DrawRectangleNodeShape(g, node, brush);
break;
default:
@@ -1616,20 +1616,20 @@ namespace AGVNavigationCore.Controls
Color bgColor = Color.White;
switch (node.StationType)
{
case StationType.Charger:
case Station.Charger:
fgColor = Color.White;
bgColor = Color.Tomato;
break;
case StationType.Buffer:
case Station.Buffer:
fgColor = Color.Black;
bgColor = Color.White;
break;
case StationType.Plating:
case Station.Plating:
fgColor = Color.Black;
bgColor = Color.DeepSkyBlue;
break;
case StationType.Loader:
case StationType.Cleaner:
case Station.Loder:
case Station.Cleaner:
fgColor = Color.Black;
bgColor = Color.Gold;
break;
@@ -1915,18 +1915,18 @@ namespace AGVNavigationCore.Controls
switch (node.StationType)
{
case StationType.Normal:
case Station.Normal:
if (node.CanTurnLeft || node.CanTurnRight)
bgColor = Color.Violet;
else
bgColor = Color.DeepSkyBlue;
break;
case StationType.Charger: bgColor = Color.Tomato; break;
case StationType.Loader:
case StationType.Cleaner: bgColor = Color.Gold; break;
case StationType.Plating: bgColor = Color.DeepSkyBlue; break;
case StationType.Buffer: bgColor = Color.WhiteSmoke; break;
case StationType.Limit: bgColor = Color.Red; break;
case Station.Charger: bgColor = Color.Tomato; break;
case Station.Loder:
case Station.Cleaner: bgColor = Color.Gold; break;
case Station.Plating: bgColor = Color.DeepSkyBlue; break;
case Station.Buffer: bgColor = Color.WhiteSmoke; break;
case Station.Lmt: bgColor = Color.Red; break;
default: bgColor = Color.White; break;
}

View File

@@ -582,12 +582,12 @@ namespace AGVNavigationCore.Controls
{
switch (node.StationType)
{
case StationType.Loader:
case StationType.Cleaner:
case StationType.Plating:
case StationType.Buffer:
case Station.Loder:
case Station.Cleaner:
case Station.Plating:
case Station.Buffer:
return IsPointInPentagon(point, node);
case StationType.Charger:
case Station.Charger:
return IsPointInTriangle(point, node);
default:
return IsPointInCircle(point, node);

View File

@@ -58,14 +58,14 @@ namespace AGVNavigationCore.Models
/// <summary>
/// 장비 타입 열거형
/// </summary>
public enum StationType
public enum Station
{
/// <summary>
/// 일반노드
/// </summary>
Normal,
/// <summary>로더</summary>
Loader,
Loder,
/// <summary>클리너</summary>
Plating,
/// <summary>오프로더</summary>
@@ -78,7 +78,7 @@ namespace AGVNavigationCore.Models
/// <summary>
/// 끝점(더이상 이동불가)
/// </summary>
Limit,
Lmt,
}

View File

@@ -17,18 +17,18 @@ namespace AGVNavigationCore.Models
public StationType StationType { get; set; }
public Station StationType { get; set; }
[Browsable(false)]
public bool CanDocking
{
get
{
if (StationType == StationType.Buffer) return true;
if (StationType == StationType.Loader) return true;
if (StationType == StationType.Cleaner) return true;
if (StationType == StationType.Plating) return true;
if (StationType == StationType.Charger) return true;
if (StationType == Station.Buffer) return true;
if (StationType == Station.Loder) return true;
if (StationType == Station.Cleaner) return true;
if (StationType == Station.Plating) return true;
if (StationType == Station.Charger) return true;
return false;
}
}
@@ -111,7 +111,7 @@ namespace AGVNavigationCore.Models
Type = NodeType.Normal;
}
public MapNode(string nodeId, Point position, StationType type) : base(nodeId, position)
public MapNode(string nodeId, Point position, Station type) : base(nodeId, position)
{
Type = NodeType.Normal;
}
@@ -122,9 +122,9 @@ namespace AGVNavigationCore.Models
{
get
{
if (StationType == StationType.Charger || StationType == StationType.Buffer ||
StationType == StationType.Plating || StationType == StationType.Loader ||
StationType == StationType.Cleaner) return true;
if (StationType == Station.Charger || StationType == Station.Buffer ||
StationType == Station.Plating || StationType == Station.Loder ||
StationType == Station.Cleaner) return true;
return false;
}
}

View File

@@ -367,7 +367,7 @@ namespace AGVNavigationCore.Models
//도킹노드라면 markstop 을 나머지는 바로 스탑한다.
eAGVCommandReason reason = eAGVCommandReason.MarkStop;
if (TargetNode.StationType == StationType.Normal || TargetNode.StationType == StationType.Limit)
if (TargetNode.StationType == Station.Normal || TargetNode.StationType == Station.Lmt)
{
//일반노드는 마크스탑포인트가 없으니 바로 종료되도록 한다
reason = eAGVCommandReason.Complete;

View File

@@ -1598,7 +1598,7 @@ namespace AGVSimulator.Forms
MotorDirection = directionName,
CurrentPosition = GetNodeDisplayName(currentNode),
TargetPosition = GetNodeDisplayName(targetNode),
DockingPosition = (targetNode.StationType == StationType.Charger) ? "충전기" : "장비"
DockingPosition = (targetNode.StationType == Station.Charger) ? "충전기" : "장비"
};
if (calcResult.Success)

View File

@@ -123,7 +123,7 @@ namespace Project
switch (target.StationType)
{
case AGVNavigationCore.Models.StationType.Buffer:
case AGVNavigationCore.Models.Station.Buffer:
var lastPath = PUB._virtualAGV.CurrentPath.DetailedPath.LastOrDefault();
if (lastPath.NodeId.Equals(PUB._virtualAGV.CurrentNode.Id))
{
@@ -139,19 +139,19 @@ namespace Project
PUB.sm.SetNewRunStep(ERunStep.ERROR);
}
break;
case AGVNavigationCore.Models.StationType.Charger:
case AGVNavigationCore.Models.Station.Charger:
break;
case AGVNavigationCore.Models.StationType.Loader:
case AGVNavigationCore.Models.Station.Loder:
PUB.XBE.StepMC = Device.eDocStep.ReadyForEnter;
break;
case AGVNavigationCore.Models.StationType.Plating:
case AGVNavigationCore.Models.Station.Plating:
PUB.XBE.StepMC = Device.eDocStep.ReadyForEnter;
break;
case AGVNavigationCore.Models.StationType.Cleaner:
case AGVNavigationCore.Models.Station.Cleaner:
PUB.XBE.StepMC = Device.eDocStep.ReadyForEnter;
break;

View File

@@ -69,7 +69,7 @@ namespace Project
else if (PUB.sm.RunStepSeq == idx++)
{
//버퍼 노드 여부 확인
if (PUB._virtualAGV.CurrentNode.StationType != AGVNavigationCore.Models.StationType.Buffer)
if (PUB._virtualAGV.CurrentNode.StationType != AGVNavigationCore.Models.Station.Buffer)
{
SetRunStepError(ENIGProtocol.AGVErrorCode.NOT_BUFFERPOINT, $"[{funcname}-{PUB.sm.RunStepSeq}] 현재 위치가 버퍼가 아닙니다({PUB._virtualAGV.CurrentNode.StationType})");
return false;

View File

@@ -71,7 +71,7 @@ namespace Project
else if (PUB.sm.RunStepSeq == idx++)
{
//버퍼 노드 여부 확인
if (PUB._virtualAGV.CurrentNode.StationType != AGVNavigationCore.Models.StationType.Buffer)
if (PUB._virtualAGV.CurrentNode.StationType != AGVNavigationCore.Models.Station.Buffer)
{
SetRunStepError(ENIGProtocol.AGVErrorCode.NOT_BUFFERPOINT, $"[{funcname}-{PUB.sm.RunStepSeq}] 현재 위치가 버퍼가 아닙니다({PUB._virtualAGV.CurrentNode.StationType})");
return false;

View File

@@ -38,9 +38,9 @@ namespace Project
else if (PUB.sm.RunStepSeq == idx++)
{
//장비 노드 여부 확인 (버퍼가 아닌 도킹 가능 노드여야 함)
if (PUB._virtualAGV.CurrentNode.StationType != StationType.Loader &&
PUB._virtualAGV.CurrentNode.StationType != StationType.Plating &&
PUB._virtualAGV.CurrentNode.StationType != StationType.Cleaner)
if (PUB._virtualAGV.CurrentNode.StationType != Station.Loder &&
PUB._virtualAGV.CurrentNode.StationType != Station.Plating &&
PUB._virtualAGV.CurrentNode.StationType != Station.Cleaner)
{
SetRunStepError(ENIGProtocol.AGVErrorCode.NOT_EQUIPMENTPOINT, $"[{funcname}-{PUB.sm.RunStepSeq}] 현재 위치가 장비 노드가 아닙니다({PUB._virtualAGV.CurrentNode.StationType})");
return false;

View File

@@ -39,9 +39,9 @@ namespace Project
else if (PUB.sm.RunStepSeq == idx++)
{
//장비 노드 여부 확인 (버퍼가 아닌 도킹 가능 노드여야 함)
if (PUB._virtualAGV.CurrentNode.StationType != StationType.Loader &&
PUB._virtualAGV.CurrentNode.StationType != StationType.Plating &&
PUB._virtualAGV.CurrentNode.StationType != StationType.Cleaner)
if (PUB._virtualAGV.CurrentNode.StationType != Station.Loder &&
PUB._virtualAGV.CurrentNode.StationType != Station.Plating &&
PUB._virtualAGV.CurrentNode.StationType != Station.Cleaner)
{
SetRunStepError(ENIGProtocol.AGVErrorCode.NOT_EQUIPMENTPOINT, $"[{funcname}-{PUB.sm.RunStepSeq}] 현재 위치가 장비 노드가 아닙니다({PUB._virtualAGV.CurrentNode.StationType})");
return false;

View File

@@ -319,7 +319,7 @@ namespace Project
// 목적지 도착 여부 확인
if (PUB.AGV.signal1.mark_sensor == false)
{
if (PUB._virtualAGV.TargetNode.StationType != StationType.Normal)
if (PUB._virtualAGV.TargetNode.StationType != Station.Normal)
{
PUB.log.AddAT($"목표({PUB._virtualAGV.TargetNode.RfidId})도착되었으나 마크센서가 감지되지 않아 완료처리 하지않습니다");
return false;

View File

@@ -72,7 +72,7 @@ namespace Project
PUB.log.Add($"AGV Turn Complete:{e.Direction}");
//일반노드에서 턴작업이 진행되었다면, 이전경로와 현재경로의 모터 방향을 바꿔준다(일반노드에서만 사용)
if (PUB._virtualAGV.CurrentNode != null && PUB._virtualAGV.CurrentNode.StationType == StationType.Normal)
if (PUB._virtualAGV.CurrentNode != null && PUB._virtualAGV.CurrentNode.StationType == Station.Normal)
{
var prevnodeid = PUB._virtualAGV.PrevNode;//.Id;
var currnodeid = PUB._virtualAGV.CurrentNode;//.Id;
@@ -270,7 +270,7 @@ namespace Project
PUB.SaveLastPosition();
//노드가 들어왔는데. 일반 노드라면.. 턴 정보를 제거한다.
if (CurrentNode.StationType != StationType.Buffer && PUB._virtualAGV.Turn != AGVTurn.None)
if (CurrentNode.StationType != Station.Buffer && PUB._virtualAGV.Turn != AGVTurn.None)
{
PUB.log.AddAT($"현재노드위치가 버퍼가 아니라서 턴정보를 초기화합니다{PUB._virtualAGV.Turn}");
PUB._virtualAGV.Turn = AGVTurn.None;

View File

@@ -109,16 +109,16 @@ namespace Project
//버퍼의 경우 직전에 멈추기 때문에 스테이션종류를 보정해준다
var StationType = currNode.StationType;
if (StationType == StationType.Normal && targetNode.StationType == StationType.Buffer)
StationType = StationType.Buffer;
if (StationType == Station.Normal && targetNode.StationType == Station.Buffer)
StationType = Station.Buffer;
ERunStep nextStep = ERunStep.READY;
switch (StationType)
{
case StationType.Loader: nextStep = ERunStep.LOADER_IN; break;
case StationType.Cleaner: nextStep = ERunStep.UNLOADER_IN; break;
case StationType.Buffer: nextStep = ERunStep.BUFFER_IN; break;
case StationType.Plating: nextStep = ERunStep.CLEANER_IN; break;
case Station.Loder: nextStep = ERunStep.LOADER_IN; break;
case Station.Cleaner: nextStep = ERunStep.UNLOADER_IN; break;
case Station.Buffer: nextStep = ERunStep.BUFFER_IN; break;
case Station.Plating: nextStep = ERunStep.CLEANER_IN; break;
default:
PUB.log.AddE($"[{logPrefix}-{cmd}] 해당 노드타입({StationType})은 작업을 지원하지 않습니다.");
return;
@@ -190,16 +190,16 @@ namespace Project
//버퍼의 경우 직전에 멈추기 때문에 스테이션종류를 보정해준다
var StationType = currNode.StationType;
if (StationType == StationType.Normal && targetNode.StationType == StationType.Buffer)
StationType = StationType.Buffer;
if (StationType == Station.Normal && targetNode.StationType == Station.Buffer)
StationType = Station.Buffer;
ERunStep nextStep = ERunStep.READY;
switch (StationType)
{
case StationType.Loader: nextStep = ERunStep.LOADER_OUT; break;
case StationType.Cleaner: nextStep = ERunStep.UNLOADER_OUT; break;
case StationType.Buffer: nextStep = ERunStep.BUFFER_OUT; break;
case StationType.Plating: nextStep = ERunStep.CLEANER_OUT; break;
case Station.Loder: nextStep = ERunStep.LOADER_OUT; break;
case Station.Cleaner: nextStep = ERunStep.UNLOADER_OUT; break;
case Station.Buffer: nextStep = ERunStep.BUFFER_OUT; break;
case Station.Plating: nextStep = ERunStep.CLEANER_OUT; break;
default:
PUB.logdebug.Add($"[AI_TRACE] REJECTED: Unsupported station type {StationType} for command {cmd}");
PUB.log.AddE($"[{logPrefix}-{cmd}] 해당 노드타입({StationType})은 작업을 지원하지 않습니다.");
@@ -287,7 +287,7 @@ namespace Project
//노드가 들어왔는데. 일반 노드라면.. 턴 정보를 제거한다.
if (PUB._virtualAGV.CurrentNode != null &&
PUB._virtualAGV.CurrentNode.StationType != StationType.Buffer &&
PUB._virtualAGV.CurrentNode.StationType != Station.Buffer &&
PUB._virtualAGV.Turn != AGVTurn.None)
{
PUB.log.AddAT($"[{logPrefix}-Goto] 현재노드위치가 버퍼가 아니라서 턴정보를 초기화합니다{PUB._virtualAGV.Turn}");

View File

@@ -76,7 +76,7 @@ namespace Project.ViewForm
menu.Items.Add(pickOff);
// Charge
if (mapnode.StationType == StationType.Charger )
if (mapnode.StationType == Station.Charger )
{
var charge = new ToolStripMenuItem("Charge (Move & Charge)");
charge.Click += (s, args) => ExecuteManualCommand(mapnode, ENIGProtocol.AGVCommandHE.Charger);
@@ -209,7 +209,7 @@ namespace Project.ViewForm
ENIGProtocol.AGVCommandHE targetCmd = ENIGProtocol.AGVCommandHE.Goto;
string confirmMsg = "";
if (targetNode.StationType == StationType.Charger)
if (targetNode.StationType == Station.Charger)
{
if (MessageBox.Show($"[{targetNode.Id}] 충전기로 이동하여 충전을 진행하시겠습니까?", "작업 확인", MessageBoxButtons.YesNo) == DialogResult.Yes)
{