ai로그 추가
This commit is contained in:
@@ -175,7 +175,7 @@ namespace Project
|
||||
/// <summary>
|
||||
/// 시스템로그
|
||||
/// </summary>
|
||||
public static AR.Log log, logagv, logplc, logbms, logxbee;
|
||||
public static AR.Log log, logagv, logplc, logbms, logxbee,logdebug;
|
||||
|
||||
public static Boolean bPlayMusic = false;
|
||||
|
||||
@@ -223,10 +223,14 @@ namespace Project
|
||||
logxbee = new AR.Log();
|
||||
logxbee.Textenc = System.Text.Encoding.UTF8;
|
||||
|
||||
logdebug = new Log();
|
||||
logdebug.Textenc = System.Text.Encoding.UTF8;
|
||||
|
||||
logagv.FileNameFormat = "{yyyyMMdd}_agv";
|
||||
logplc.FileNameFormat = "{yyyyMMdd}_plc";
|
||||
logbms.FileNameFormat = "{yyyyMMdd}_bms";
|
||||
logxbee.FileNameFormat = "{yyyyMMdd}_cal";
|
||||
logdebug.FileNameFormat = "{yyyyMMdd}_dgb";
|
||||
|
||||
//popupmessage
|
||||
popup = new MessageWindow();
|
||||
@@ -656,6 +660,7 @@ namespace Project
|
||||
PUB.logplc.Flush();
|
||||
PUB.logbms.Flush();
|
||||
PUB.logxbee.Flush();
|
||||
PUB.logdebug.Flush();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -40,6 +40,7 @@ namespace Project
|
||||
//스텝이 변경되었다면?
|
||||
if (PUB.sm.RunStep != PUB.sm.RunStepNew)
|
||||
{
|
||||
PUB.logdebug.Add($"[AI_TRACE] RunStep Transition: {PUB.sm.RunStep} -> {PUB.sm.RunStepNew}");
|
||||
runStepisFirst = true;
|
||||
PUB.sm.ApplyRunStep();
|
||||
}
|
||||
@@ -72,6 +73,7 @@ namespace Project
|
||||
var tsSpeak = DateTime.Now - LastSpeakTime;
|
||||
if (tsSpeak.TotalSeconds >= PUB.setting.alarmSoundTerm)
|
||||
{
|
||||
PUB.logdebug.Add($"[AI_TRACE] Blocking: stop_by_front_detect=true (LIDAR Obstacle)");
|
||||
PUB.Speak(Lang.전방에물체가감지되었습니다);
|
||||
LastSpeakTime = DateTime.Now;
|
||||
}
|
||||
@@ -84,6 +86,7 @@ namespace Project
|
||||
var tsSpeak = DateTime.Now - LastSpeakTime;
|
||||
if (tsSpeak.TotalSeconds >= PUB.setting.alarmSoundTerm)
|
||||
{
|
||||
PUB.logdebug.Add($"[AI_TRACE] Blocking: runerror_by_no_magent_line=true (Magnetic Line Lost)");
|
||||
PUB.Speak(Lang.선로를이탈했습니다);
|
||||
LastSpeakTime = DateTime.Now;
|
||||
}
|
||||
|
||||
@@ -33,6 +33,7 @@ namespace Project
|
||||
if ((DateTime.Now - _lastLidarOffTime_IN).TotalSeconds > 2)
|
||||
{
|
||||
PUB.log.Add($"[{funcname}] 버퍼 작업 중 라이다 강제 OFF 시도");
|
||||
PUB.logdebug.Add($"[AI_TRACE] {funcname} LIDAR/Dist Safety Override: Sensor={PUB.AGV.PBSSensor}, Dist={PUB.AGV.data.Distance}");
|
||||
PUB.AGV.AGVMoveSet(new arDev.Narumi.BunkiData
|
||||
{
|
||||
Bunki = arDev.Narumi.eBunki.Strate,
|
||||
@@ -45,6 +46,9 @@ namespace Project
|
||||
return false; // 라이다가 꺼질 때까지 진행 스톱 (명령이 적용될 때까지 대기)
|
||||
}
|
||||
|
||||
// [AI_TRACE] Log Step Progress
|
||||
PUB.logdebug.Add($"[AI_TRACE] {funcname} Step {PUB.sm.RunStepSeq} execution");
|
||||
|
||||
// [State Save] 현재 진행 단계를 저장한다
|
||||
SaveBufferStep(PUB._virtualAGV.CurrentNode, PUB.sm.RunStepSeq, PUB.NextWorkCmd);
|
||||
|
||||
@@ -453,6 +457,7 @@ namespace Project
|
||||
|
||||
// [State Clear] 작업 완료 시 저장된 상태를 지운다
|
||||
ClearBufferStep(PUB._virtualAGV.CurrentNode);
|
||||
PUB.logdebug.Add($"[AI_TRACE] {funcname} Completed Successfully.");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,6 +32,7 @@ namespace Project
|
||||
if ((DateTime.Now - _lastLidarOffTime_OUT).TotalSeconds > 2)
|
||||
{
|
||||
PUB.log.Add($"[{funcname}] 버퍼 작업 중 라이다 강제 OFF 시도");
|
||||
PUB.logdebug.Add($"[AI_TRACE] {funcname} LIDAR/Dist Safety Override: Sensor={PUB.AGV.PBSSensor}, Dist={PUB.AGV.data.Distance}");
|
||||
PUB.AGV.AGVMoveSet(new arDev.Narumi.BunkiData
|
||||
{
|
||||
Bunki = arDev.Narumi.eBunki.Strate,
|
||||
@@ -44,6 +45,9 @@ namespace Project
|
||||
return false; // 라이다가 꺼질 때까지 진행 스톱 (명령이 적용될 때까지 대기)
|
||||
}
|
||||
|
||||
// [AI_TRACE] Log Step Progress
|
||||
PUB.logdebug.Add($"[AI_TRACE] {funcname} Step {PUB.sm.RunStepSeq} execution");
|
||||
|
||||
// [State Save] 현재 진행 단계를 저장한다
|
||||
SaveBufferStep(PUB._virtualAGV.CurrentNode, PUB.sm.RunStepSeq, PUB.NextWorkCmd);
|
||||
|
||||
@@ -127,6 +131,7 @@ namespace Project
|
||||
if (PUB.AGV.signal1.mark_sensor == true && PUB._virtualAGV.Turn == AGVNavigationCore.Models.AGVTurn.L90)
|
||||
{
|
||||
PUB.log.Add($"[{funcname}-{PUB.sm.RunStepSeq}] 이미 마크센서 감지됨. 전진 이동을 생략합니다.");
|
||||
PUB.logdebug.Add($"[AI_TRACE] {funcname} Smart Restart Skip Movement: MarkSensor=true, Turn=L90");
|
||||
PUB.sm.SetStepSeq((byte)(idx + 4)); // Turn 스텝으로 직행 (현재 idx부터 4단계 뒤)
|
||||
return false;
|
||||
}
|
||||
@@ -261,6 +266,7 @@ namespace Project
|
||||
if (PUB.AGV.signal1.mark_sensor == false && seqtime.TotalSeconds < 1.0)
|
||||
{
|
||||
PUB.log.Add($"[{funcname}-{PUB.sm.RunStepSeq}] 재시작 감지됨. 하지만 목적지(마크) 도착 불확실. 이동을 재시도합니다.");
|
||||
PUB.logdebug.Add($"[AI_TRACE] {funcname} Resume Safety Check Failed (Mark OFF at Stop Step). Rolling back to Step 6.");
|
||||
PUB.sm.SetStepSeq(6); // Speed Set 스텝(이동 시작 단계)으로 복귀
|
||||
return false;
|
||||
}
|
||||
@@ -486,6 +492,7 @@ namespace Project
|
||||
|
||||
// [State Clear] 작업 완료 시 저장된 상태를 지운다
|
||||
ClearBufferStep(PUB._virtualAGV.CurrentNode);
|
||||
PUB.logdebug.Add($"[AI_TRACE] {funcname} Completed Successfully.");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -87,6 +87,7 @@ namespace Project
|
||||
{
|
||||
//충전시작 명령을 전송한다
|
||||
PUB.log.Add($"충전:충전명령전송");
|
||||
PUB.logdebug.Add($"[AI_TRACE] {funcname} Step {PUB.sm.RunStepSeq}: Sending Charge Start Command to ChargerID={PUB.setting.ChargerID}");
|
||||
PUB.Speak(Lang.충전시작명령을전송합니다);
|
||||
PUB.AGV.AGVCharge(PUB.setting.ChargerID, true);
|
||||
VAR.BOOL[eVarBool.WAIT_CHARGEACK] = true;
|
||||
@@ -102,6 +103,7 @@ namespace Project
|
||||
if (PUB.AGV.ACKData.Equals("CBT"))
|
||||
{
|
||||
PUB.log.Add($"충전명령 회신 확인");
|
||||
PUB.logdebug.Add($"[AI_TRACE] {funcname} Step {PUB.sm.RunStepSeq}: Charge Command ACK Received (CBT)");
|
||||
PUB.sm.UpdateRunStepSeq();
|
||||
}
|
||||
else
|
||||
|
||||
@@ -85,10 +85,12 @@ namespace Project
|
||||
if (PUB._virtualAGV.TargetNode == null)
|
||||
{
|
||||
PUB.log.Add($"대상노드가 없어 이동을할 수 없습니다");
|
||||
PUB.logdebug.Add($"[AI_TRACE] {funcname} REJECTED: TargetNode is NULL");
|
||||
PUB.sm.SetNewRunStep(ERunStep.READY);
|
||||
return false;
|
||||
}
|
||||
PUB.log.Add($"[GOTO] Step {idx - 1}: TargetNode Checked ({PUB._virtualAGV.TargetNode.ID2})");
|
||||
PUB.logdebug.Add($"[AI_TRACE] {funcname} TargetNode Confirmed: {PUB._virtualAGV.TargetNode.ID2} (RFID: {PUB._virtualAGV.TargetNode.RfidId})");
|
||||
PUB.sm.UpdateRunStepSeq();
|
||||
return false;
|
||||
}
|
||||
@@ -112,6 +114,7 @@ namespace Project
|
||||
|
||||
//ㅇ목적지 완료신호를 ACS에전송한다.
|
||||
PUB.XBE.SendMoveComplete(PUB._virtualAGV.TargetNode.RfidId.ToString("0000"));
|
||||
PUB.logdebug.Add($"[AI_TRACE] {funcname} Navigation Complete. ACS Notified. Node={PUB._virtualAGV.TargetNode.ID2}");
|
||||
PUB.sm.UpdateRunStepSeq();
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -402,6 +402,7 @@ namespace Project
|
||||
void sm_StepChanged(object sender, StateMachine.StateMachine.StepChangeEventArgs e)
|
||||
{
|
||||
//상태머신의 스텝이 변경될때 발생함
|
||||
PUB.logdebug.Add($"[AI_TRACE] Global State Change: {e.Old} -> {e.New}");
|
||||
//Pub.log.Add(string.Format("SM:Step Changed {0} to {1}",e.Old,e.New));
|
||||
VAR.BOOL[eVarBool.FLAG_AUTORUN] = e.New == eSMStep.RUN;
|
||||
VAR.BOOL[eVarBool.FLAG_SYNC] = (e.New == eSMStep.SYNC);
|
||||
|
||||
@@ -19,6 +19,7 @@ namespace Project
|
||||
|
||||
private void XBE_ProtocReceived(object sender, ENIG.EEProtocol.DataEventArgs e)
|
||||
{
|
||||
PUB.logdebug.Add($"[AI_TRACE] XBEE Protoc Received: Cmd={e.ReceivedPacket.Command}, ID={e.ReceivedPacket.ID}, DataLen={e.ReceivedPacket.Data.Length}");
|
||||
//TODO : 기능 처리필요 (XBee 메세지 데이터처리)
|
||||
//PUB.CheckManualChargeMode() : 수동충전확인
|
||||
//VAR.BOOL[eVarBool.FLAG_AUTORUN] : 자동실행
|
||||
@@ -87,6 +88,7 @@ namespace Project
|
||||
{
|
||||
Resultclear();
|
||||
PUB.log.AddI($"XBEE:작업명령수신:{cmd}");
|
||||
PUB.logdebug.Add($"[AI_TRACE] Processing WorkCommand: {cmd}");
|
||||
|
||||
// 현재 위치 확인 (TargetNode가 아닌 CurrentNode 기준)
|
||||
var currNode = PUB._virtualAGV.CurrentNode;
|
||||
@@ -167,6 +169,7 @@ namespace Project
|
||||
{
|
||||
Resultclear();
|
||||
PUB.log.AddI($"XBEE:작업명령수신:{cmd}");
|
||||
PUB.logdebug.Add($"[AI_TRACE] Processing Exit WorkCommand: {cmd}");
|
||||
|
||||
// 현재 위치 확인 (TargetNode가 아닌 CurrentNode 기준)
|
||||
var currNode = PUB._virtualAGV.CurrentNode;
|
||||
@@ -198,6 +201,7 @@ namespace Project
|
||||
case StationType.Buffer: nextStep = ERunStep.BUFFER_OUT; break;
|
||||
case StationType.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})은 작업을 지원하지 않습니다.");
|
||||
return;
|
||||
}
|
||||
@@ -238,6 +242,7 @@ namespace Project
|
||||
{
|
||||
Resultclear();
|
||||
PUB.log.AddI($"XBEE:충전명령수신");
|
||||
PUB.logdebug.Add($"[AI_TRACE] Processing Charger Command");
|
||||
|
||||
// 버퍼 작업 중일 경우 충전 명령 거부
|
||||
if (PUB._virtualAGV.Turn != AGVTurn.None)
|
||||
@@ -275,12 +280,11 @@ namespace Project
|
||||
//자동상태가아니라면 처리하지 않는다.
|
||||
if (VAR.BOOL[eVarBool.FLAG_AUTORUN] == false)
|
||||
{
|
||||
PUB.logdebug.Add($"[AI_TRACE] REJECTED: Manual mode (AutoRun=false) for Goto {currTag}");
|
||||
SetRunStepError(ENIGProtocol.AGVErrorCode.ManualMode, $"[{logPrefix}-Goto] 자동실행상태가 아닙니다");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//노드가 들어왔는데. 일반 노드라면.. 턴 정보를 제거한다.
|
||||
if (PUB._virtualAGV.CurrentNode != null &&
|
||||
PUB._virtualAGV.CurrentNode.StationType != StationType.Buffer &&
|
||||
@@ -290,7 +294,6 @@ namespace Project
|
||||
PUB._virtualAGV.Turn = AGVTurn.None;
|
||||
}
|
||||
|
||||
|
||||
//s/w턴이 걸려있다면 이동 불가로한다.(버퍼 작업중이다)
|
||||
if (PUB._virtualAGV.Turn != AGVTurn.None)
|
||||
{
|
||||
@@ -298,7 +301,6 @@ namespace Project
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//목적지
|
||||
PUB._virtualAGV.TargetNode = targetNode;
|
||||
if (targetNode == null)
|
||||
|
||||
Reference in New Issue
Block a user