This commit is contained in:
backuppc
2026-01-06 17:35:34 +09:00
parent 649d87cae3
commit 90340f4a7d
39 changed files with 2127 additions and 685 deletions

View File

@@ -66,7 +66,7 @@ namespace Project
if (PUB._virtualAGV.CurrentDirection != syncDir)
PUB.UpdateAGVDirection(syncDir);
}
// [Sync] Update VirtualAGV State
AGVState syncState = AGVState.Idle;
@@ -106,7 +106,7 @@ namespace Project
PUB.log.Add($"충전상태전환 {agv_chg}");
VAR.BOOL[eVarBool.FLAG_CHARGEONA] = agv_chg;
}
if (PUB.AGV.error.Charger_pos_error != VAR.BOOL[eVarBool.CHG_POSERR])
{
@@ -199,9 +199,11 @@ namespace Project
else
{
//모터방향 확인해서 UI와 AGV클래스에 적용한다
var MotDireciton = PUB.AGV.data.Direction == 'B' ? AGVNavigationCore.Models.AgvDirection.Backward : AGVNavigationCore.Models.AgvDirection.Forward;
var MotDireciton = PUB.AGV.data.Direction == 'B' ? AgvDirection.Backward : AgvDirection.Forward;
PUB._mapCanvas.SetAGVPosition(PUB.setting.MCID, CurrentNode, MotDireciton);
PUB._virtualAGV.SetPosition(CurrentNode, MotDireciton);
//방향을 다시 확인하여. 기존 경로의 무결성을 검증한다, 필요한 경우 다시 계산할 필요가 있다.
}
//태그를 읽었다면 상태를 바로 전송한다
@@ -221,16 +223,42 @@ namespace Project
if (PUB._mapCanvas != null && PUB._virtualAGV != null)
{
var nextAction = PUB._virtualAGV.Predict();
var message = $"[다음 행동 예측]\n\n" +
$"모터: {nextAction.Motor}\n" +
var message = $"[다음 행동 예측]\n\n";
if (VAR.BOOL[eVarBool.FLAG_AUTORUN] == false)
message += "[수동모드]\n\n";
var node = PUB._virtualAGV.CurrentNode;
var curpos = PUB._virtualAGV.CurrentNodeID2;
var targetpos = PUB._virtualAGV.TargetNode?.ID2 ?? "(X)";
var pathdetail = "";
if (PUB._virtualAGV.CurrentPath != null && PUB._virtualAGV.CurrentPath.DetailedPath.Any())
{
var idx = 0;
foreach (var item in PUB._virtualAGV.CurrentPath.DetailedPath)
{
idx += 1;
if (pathdetail.isEmpty() == false) pathdetail += "->";
if (idx % 6 == 0) pathdetail += "\n";
pathdetail += $"{item.RfidId:0000}({item.MotorDirection.ToString().Substring(0, 1)}{item.MagnetDirection.ToString().Substring(0, 1)}{item.Speed.ToString().Substring(0, 1)})";
if (item.IsPass) pathdetail += "(O)";
}
}
message += $"모터: {nextAction.Motor}\n" +
$"마그넷: {nextAction.Magnet}\n" +
$"속도: {nextAction.Speed}\n" +
$"이유: {nextAction.Message}\n\n" +
$"이유: {nextAction.Message}\n" +
$"상태머신:{PUB.sm.Step}:{PUB.sm.RunStep}:{PUB.sm.RunStepSeq}\n"+
$"---\n" +
$"현재 상태: {PUB._virtualAGV.CurrentState}\n" +
$"현재 방향: {PUB._virtualAGV.CurrentDirection}\n" +
$"턴: {PUB._virtualAGV.Turn}\n" +
$"위치 확정: {PUB._virtualAGV.IsPositionConfirmed} (RFID {PUB._virtualAGV.DetectedRfidCount}개)\n" +
$"현재 노드: {PUB._virtualAGV.CurrentNode.Id ?? ""}";
$"현재 노드: {curpos}\n" +
$"대상 노드: {targetpos}\n" +
$"상세 경로: {pathdetail}";
PUB._mapCanvas.PredictMessage = message;
}