프로토콜 조정

This commit is contained in:
backuppc
2025-11-14 15:03:51 +09:00
parent 028e9ab35f
commit 97b2a3076f
14 changed files with 612 additions and 251 deletions

View File

@@ -5,14 +5,10 @@ VisualStudioVersion = 15.0.36324.19
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Sub", "Sub", "{C423C39A-44E7-4F09-B2F7-7943975FF948}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Test", "Test", "{7AF32085-E7A6-4D06-BA6E-C6B1EBAEA99A}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StateMachine", "StateMachine\StateMachine.csproj", "{BBC9BCCF-6262-4355-9CC2-37FF678AC499}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "agvControl", "SubProject\AGVControl\agvControl.csproj", "{8CB883C0-99C3-4DD4-B017-F9B92010A806}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Test_BMS", "TestProject\Test_BMS\Test_BMS.csproj", "{CE3FFF9F-6ACA-44BD-B64A-33FF4AD5E82E}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BMS", "SubProject\BMS\BMS.csproj", "{7A94C30C-6772-4F71-BF9C-0DF071A1BC70}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SWPatch", "SubProject\Patch\SWPatch.csproj", "{37DC0BAE-50BF-41E4-BAAB-B0E211467AD1}"
@@ -21,8 +17,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NARUMI", "SubProject\AGV\NA
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CommData", "SubProject\CommData\CommData.csproj", "{14E8C9A5-013E-49BA-B435-EFEFC77DD623}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Test_Narumi", "TestProject\Test_Narumi\Test_Narumi.csproj", "{EB77976F-4DE4-46A5-8B25-D07226204C32}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ENIGProtocol", "SubProject\EnigProtocol\enigprotocol\ENIGProtocol.csproj", "{9365803B-933D-4237-93C7-B502C855A71C}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AGV4", "Project\AGV4.csproj", "{D6B3880D-7D5C-44E2-B6A5-CF6D881A8A38}"
@@ -44,10 +38,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AGVMapEditor", "AGVLogic\AG
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AGVSimulator", "AGVLogic\AGVSimulator\AGVSimulator.csproj", "{B2C3D4E5-0000-0000-0000-000000000000}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Test_Port", "TestProject\Test_Port\Test_Port.csproj", "{CCFA2CE7-A539-4ADC-B803-F759284C3463}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Test_ACS", "TestProject\Test_ACS\Test_ACS.csproj", "{A1B2C3D4-E5F6-4A5B-8C9D-0E1F2A3B4C5D}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -82,18 +72,6 @@ Global
{8CB883C0-99C3-4DD4-B017-F9B92010A806}.Release|x64.Build.0 = Release|Any CPU
{8CB883C0-99C3-4DD4-B017-F9B92010A806}.Release|x86.ActiveCfg = Release|Any CPU
{8CB883C0-99C3-4DD4-B017-F9B92010A806}.Release|x86.Build.0 = Release|Any CPU
{CE3FFF9F-6ACA-44BD-B64A-33FF4AD5E82E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{CE3FFF9F-6ACA-44BD-B64A-33FF4AD5E82E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CE3FFF9F-6ACA-44BD-B64A-33FF4AD5E82E}.Debug|x64.ActiveCfg = Debug|Any CPU
{CE3FFF9F-6ACA-44BD-B64A-33FF4AD5E82E}.Debug|x64.Build.0 = Debug|Any CPU
{CE3FFF9F-6ACA-44BD-B64A-33FF4AD5E82E}.Debug|x86.ActiveCfg = Debug|Any CPU
{CE3FFF9F-6ACA-44BD-B64A-33FF4AD5E82E}.Debug|x86.Build.0 = Debug|Any CPU
{CE3FFF9F-6ACA-44BD-B64A-33FF4AD5E82E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CE3FFF9F-6ACA-44BD-B64A-33FF4AD5E82E}.Release|Any CPU.Build.0 = Release|Any CPU
{CE3FFF9F-6ACA-44BD-B64A-33FF4AD5E82E}.Release|x64.ActiveCfg = Release|Any CPU
{CE3FFF9F-6ACA-44BD-B64A-33FF4AD5E82E}.Release|x64.Build.0 = Release|Any CPU
{CE3FFF9F-6ACA-44BD-B64A-33FF4AD5E82E}.Release|x86.ActiveCfg = Release|Any CPU
{CE3FFF9F-6ACA-44BD-B64A-33FF4AD5E82E}.Release|x86.Build.0 = Release|Any CPU
{7A94C30C-6772-4F71-BF9C-0DF071A1BC70}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7A94C30C-6772-4F71-BF9C-0DF071A1BC70}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7A94C30C-6772-4F71-BF9C-0DF071A1BC70}.Debug|x64.ActiveCfg = Debug|Any CPU
@@ -142,18 +120,6 @@ Global
{14E8C9A5-013E-49BA-B435-EFEFC77DD623}.Release|x64.Build.0 = Release|Any CPU
{14E8C9A5-013E-49BA-B435-EFEFC77DD623}.Release|x86.ActiveCfg = Release|Any CPU
{14E8C9A5-013E-49BA-B435-EFEFC77DD623}.Release|x86.Build.0 = Release|Any CPU
{EB77976F-4DE4-46A5-8B25-D07226204C32}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{EB77976F-4DE4-46A5-8B25-D07226204C32}.Debug|Any CPU.Build.0 = Debug|Any CPU
{EB77976F-4DE4-46A5-8B25-D07226204C32}.Debug|x64.ActiveCfg = Debug|Any CPU
{EB77976F-4DE4-46A5-8B25-D07226204C32}.Debug|x64.Build.0 = Debug|Any CPU
{EB77976F-4DE4-46A5-8B25-D07226204C32}.Debug|x86.ActiveCfg = Debug|Any CPU
{EB77976F-4DE4-46A5-8B25-D07226204C32}.Debug|x86.Build.0 = Debug|Any CPU
{EB77976F-4DE4-46A5-8B25-D07226204C32}.Release|Any CPU.ActiveCfg = Release|Any CPU
{EB77976F-4DE4-46A5-8B25-D07226204C32}.Release|Any CPU.Build.0 = Release|Any CPU
{EB77976F-4DE4-46A5-8B25-D07226204C32}.Release|x64.ActiveCfg = Release|Any CPU
{EB77976F-4DE4-46A5-8B25-D07226204C32}.Release|x64.Build.0 = Release|Any CPU
{EB77976F-4DE4-46A5-8B25-D07226204C32}.Release|x86.ActiveCfg = Release|Any CPU
{EB77976F-4DE4-46A5-8B25-D07226204C32}.Release|x86.Build.0 = Release|Any CPU
{9365803B-933D-4237-93C7-B502C855A71C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9365803B-933D-4237-93C7-B502C855A71C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9365803B-933D-4237-93C7-B502C855A71C}.Debug|x64.ActiveCfg = Debug|Any CPU
@@ -214,47 +180,19 @@ Global
{B2C3D4E5-0000-0000-0000-000000000000}.Release|x64.Build.0 = Release|Any CPU
{B2C3D4E5-0000-0000-0000-000000000000}.Release|x86.ActiveCfg = Release|Any CPU
{B2C3D4E5-0000-0000-0000-000000000000}.Release|x86.Build.0 = Release|Any CPU
{CCFA2CE7-A539-4ADC-B803-F759284C3463}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{CCFA2CE7-A539-4ADC-B803-F759284C3463}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CCFA2CE7-A539-4ADC-B803-F759284C3463}.Debug|x64.ActiveCfg = Debug|Any CPU
{CCFA2CE7-A539-4ADC-B803-F759284C3463}.Debug|x64.Build.0 = Debug|Any CPU
{CCFA2CE7-A539-4ADC-B803-F759284C3463}.Debug|x86.ActiveCfg = Debug|Any CPU
{CCFA2CE7-A539-4ADC-B803-F759284C3463}.Debug|x86.Build.0 = Debug|Any CPU
{CCFA2CE7-A539-4ADC-B803-F759284C3463}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CCFA2CE7-A539-4ADC-B803-F759284C3463}.Release|Any CPU.Build.0 = Release|Any CPU
{CCFA2CE7-A539-4ADC-B803-F759284C3463}.Release|x64.ActiveCfg = Release|Any CPU
{CCFA2CE7-A539-4ADC-B803-F759284C3463}.Release|x64.Build.0 = Release|Any CPU
{CCFA2CE7-A539-4ADC-B803-F759284C3463}.Release|x86.ActiveCfg = Release|Any CPU
{CCFA2CE7-A539-4ADC-B803-F759284C3463}.Release|x86.Build.0 = Release|Any CPU
{A1B2C3D4-E5F6-4A5B-8C9D-0E1F2A3B4C5D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A1B2C3D4-E5F6-4A5B-8C9D-0E1F2A3B4C5D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A1B2C3D4-E5F6-4A5B-8C9D-0E1F2A3B4C5D}.Debug|x64.ActiveCfg = Debug|Any CPU
{A1B2C3D4-E5F6-4A5B-8C9D-0E1F2A3B4C5D}.Debug|x64.Build.0 = Debug|Any CPU
{A1B2C3D4-E5F6-4A5B-8C9D-0E1F2A3B4C5D}.Debug|x86.ActiveCfg = Debug|Any CPU
{A1B2C3D4-E5F6-4A5B-8C9D-0E1F2A3B4C5D}.Debug|x86.Build.0 = Debug|Any CPU
{A1B2C3D4-E5F6-4A5B-8C9D-0E1F2A3B4C5D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A1B2C3D4-E5F6-4A5B-8C9D-0E1F2A3B4C5D}.Release|Any CPU.Build.0 = Release|Any CPU
{A1B2C3D4-E5F6-4A5B-8C9D-0E1F2A3B4C5D}.Release|x64.ActiveCfg = Release|Any CPU
{A1B2C3D4-E5F6-4A5B-8C9D-0E1F2A3B4C5D}.Release|x64.Build.0 = Release|Any CPU
{A1B2C3D4-E5F6-4A5B-8C9D-0E1F2A3B4C5D}.Release|x86.ActiveCfg = Release|Any CPU
{A1B2C3D4-E5F6-4A5B-8C9D-0E1F2A3B4C5D}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{8CB883C0-99C3-4DD4-B017-F9B92010A806} = {C423C39A-44E7-4F09-B2F7-7943975FF948}
{CE3FFF9F-6ACA-44BD-B64A-33FF4AD5E82E} = {7AF32085-E7A6-4D06-BA6E-C6B1EBAEA99A}
{7A94C30C-6772-4F71-BF9C-0DF071A1BC70} = {C423C39A-44E7-4F09-B2F7-7943975FF948}
{8BAE0EAC-3D25-402F-9A65-2BA1ECFE28B7} = {C423C39A-44E7-4F09-B2F7-7943975FF948}
{14E8C9A5-013E-49BA-B435-EFEFC77DD623} = {C423C39A-44E7-4F09-B2F7-7943975FF948}
{EB77976F-4DE4-46A5-8B25-D07226204C32} = {7AF32085-E7A6-4D06-BA6E-C6B1EBAEA99A}
{9365803B-933D-4237-93C7-B502C855A71C} = {C423C39A-44E7-4F09-B2F7-7943975FF948}
{C5F7A8B2-8D3E-4A1B-9C6E-7F4D5E2A9B1C} = {E5C75D32-5AD6-44DD-8F27-E32023206EBB}
{A1B2C3D4-E5F6-7890-ABCD-EF1234567890} = {E5C75D32-5AD6-44DD-8F27-E32023206EBB}
{B2C3D4E5-0000-0000-0000-000000000000} = {E5C75D32-5AD6-44DD-8F27-E32023206EBB}
{CCFA2CE7-A539-4ADC-B803-F759284C3463} = {7AF32085-E7A6-4D06-BA6E-C6B1EBAEA99A}
{A1B2C3D4-E5F6-4A5B-8C9D-0E1F2A3B4C5D} = {7AF32085-E7A6-4D06-BA6E-C6B1EBAEA99A}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {B5B1FD72-356F-4840-83E8-B070AC21C8D9}

View File

@@ -173,7 +173,7 @@ namespace Project.Device
*/
try
{
byte[] data = new byte[13]; // 총 13바이트 데이터
byte[] data = new byte[12]; // 총 12바이트 데이터
// Mode
data[0] = (byte)(VAR.BOOL[eVarBool.FLAG_AUTORUN] ? 1 : 0);
@@ -186,47 +186,56 @@ namespace Project.Device
else
data[1] = 0; // stop
// Direction
if (PUB.AGV.system1.stop_by_front_detect)
data[2] = 3; // markstop
else if (VAR.BOOL[eVarBool.FLAG_LEFT_RUN])
data[2] = 1; // left
else if (VAR.BOOL[eVarBool.FLAG_RIGHT_RUN])
data[2] = 2; // right
// Motor Direction
if (PUB.AGV.data.Direction == 'F')
data[2] = 0;
else if (PUB.AGV.data.Direction == 'B')
data[2] = 1;
else
data[2] = 0; // straight
data[2] = 0xff; //unknown
// Magnet Direction
if (PUB.AGV.data.Sts == 'L')
data[3] = 1; // left
else if (PUB.AGV.data.Sts == 'R')
data[3] = 2; // right
else if (PUB.AGV.data.Sts == 'S')
data[3] = 0; // straight
else
data[3] = 0xFF; //unknown
// Inposition
data[3] = (byte)(PUB.AGV.system1.agv_stop ? 1 : 0);
data[4] = (byte)(PUB.AGV.system1.agv_stop ? 1 : 0);
// ChargeSt
data[4] = (byte)((VAR.BOOL[eVarBool.FLAG_CHARGEONA] || VAR.BOOL[eVarBool.FLAG_CHARGEONM]) ? 1 : 0);
data[5] = (byte)((VAR.BOOL[eVarBool.FLAG_CHARGEONA] || VAR.BOOL[eVarBool.FLAG_CHARGEONM]) ? 1 : 0);
// CartSt
if (PUB.AGV.signal.cart_detect1 && PUB.AGV.signal.cart_detect2)
data[5] = 1; // 센서두개가 모두 감지되는 경우
data[6] = 1; // 센서두개가 모두 감지되는 경우
else if (PUB.AGV.signal.cart_detect1 == false && PUB.AGV.signal.cart_detect2 == false)
data[5] = 0; // 센서두개가 모두 감지되지 않는 경우
data[6] = 0; // 센서두개가 모두 감지되지 않는 경우
else
data[5] = 2; // 센서하나만 감지되는 경우
data[6] = 2; // 센서하나만 감지되는 경우
// LiftSt
if (PUB.AGV.signal.lift_up)
data[6] = 1; // 위로 올라가는 경우
data[7] = 1; // 위로 올라가는 경우
else if (PUB.AGV.signal.lift_down)
data[6] = 0; // 아래로 내려가는 경우
data[7] = 0; // 아래로 내려가는 경우
else
data[6] = 2; // unknown (기본값)
data[7] = 2; // unknown (기본값)
// LastTag
string lastTag = PUB.AGV.data.TagNo.ToString("000000") ?? "000000";
byte[] tagBytes = Encoding.ASCII.GetBytes(lastTag.PadRight(6, '0'));
Array.Copy(tagBytes, 0, data, 7, 6);
string lastTag = PUB.AGV.data.TagNo.ToString("0000") ?? "0000";
byte[] tagBytes = Encoding.ASCII.GetBytes(lastTag.PadRight(4, '0'));
Array.Copy(tagBytes, 0, data, 8, lastTag.Length);
// 데이터 전송
var cmd = (byte)ENIGProtocol.AGVCommandEH.Status;
var packet = proto.CreatePacket(PUB.setting.XBE_ID, cmd, data);
Send(packet);
if (Send(packet))
PUB.logxbee.AddI($"Send status {packet.Length} {packet.HexString()}");
LastStatusSendTime = DateTime.Now;
}
catch (Exception ex)

View File

@@ -195,7 +195,7 @@ namespace Project
//모터방향 확인해서 UI와 AGV클래스에 적용한다
var MotDireciton = PUB.AGV.data.Direction == 'B' ? AGVNavigationCore.Models.AgvDirection.Backward : AGVNavigationCore.Models.AgvDirection.Forward;
PUB._virtualAGV.SetPosition(CurrentNode, MotDireciton);
PUB._mapCanvas.SetAGVPosition("AGV", CurrentNode, MotDireciton);
PUB._mapCanvas.SetAGVPosition(PUB.setting.MCID, CurrentNode, MotDireciton);
}
break;
case arDev.Narumi.DataType.ACK:

View File

@@ -3,6 +3,8 @@ using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using AGVNavigationCore.Models;
using AGVNavigationCore.Utils;
using AR;
using arDev;
using COMM;
@@ -22,82 +24,88 @@ namespace Project
//ACS 수신 데이터 처리(타 장비는 확인하지 않는다)
if (e.ReceivedPacket.ID == 0)
{
var logPrefix = "ACS";
var data = e.ReceivedPacket.Data;
var dataStr = System.Text.Encoding.Default.GetString(data);
var cmd = (ENIGProtocol.AGVCommandHE)e.ReceivedPacket.Command;
var TargetID = 0;
if (dataStr.Length >= 2)
{
//대상디바이스
TargetID = Convert.ToByte(dataStr.Substring(0, 2), 16);
//데이터영역을 다시 설정
if (dataStr.Length > 2) dataStr = dataStr.Substring(2);
else dataStr = string.Empty;
}
else
if (data.Length < 1)
{
PUB.log.Add($"ACS 데이터에서 TARGET ID가 없습니다(data : first byte)");
return;
}
//대상디바이스
var TargetID = data[0];
if (PUB.setting.XBE_ID != TargetID)
return;
//해당 패킷의 대상이 나라면 처리한다.
if (PUB.setting.XBE_ID != TargetID) return;
switch (cmd)
{
case ENIGProtocol.AGVCommandHE.SetCurrent: //Set Current Position
if (dataStr.Length == 6)
if (data.Length > 4)
{
var targID = dataStr.Substring(0, 2);
var targstr = dataStr.Substring(2);
if (byte.TryParse(targID, out byte tID))
var currTag = System.Text.Encoding.Default.GetString(data, 1, data.Length - 1);
var node = PUB._mapNodes.FirstOrDefault(t => t.RfidId == currTag);
if (node == null)
{
if (PUB.setting.XBE_ID == tID)
{
if (ushort.TryParse(targstr, out ushort tagno))
{
//if (PUB.mapctl.SetCurrentPosition(tagno) == true)
//{
// PUB.log.AddI($"Set Position:{tagno}");
//}
//else PUB.log.AddE($"Position Set Error:{tagno}");
}
else PUB.log.AddE($"Position Param(tagstr) Error:{dataStr}");
}
else PUB.log.AddI($"Another Target {tID}:{PUB.setting.XBE_ID}");
PUB.log.AddE($"[{logPrefix}-SetCurrent] 노드정보를 찾을 수 없습니다 RFID:{currTag}");
PUB.XBE.SendError(ENIGProtocol.AGVErrorCode.EmptyNode, $"{currTag}");
return;
}
else PUB.log.AddE($"Position Param(targetid) Error:{dataStr}");
PUB._mapCanvas.SetAGVPosition(PUB.setting.MCID, node, PUB._virtualAGV.CurrentDirection);
}
else PUB.log.AddE($"Position Param Error:{dataStr}");
else PUB.log.AddE($"[{logPrefix}-SetCurrent] TagString Lenght Errorr:{data.Length}");
break;
case ENIGProtocol.AGVCommandHE.Goto: //move to tag
if (uint.TryParse(dataStr, out uint tagno2))
if (data.Length > 4)
{
//var currPos = PUB.mapctl.Manager.agv.CurrentRFID;///.AGVMoveToRFID(;
//if (PUB.mapctl.SetTargetPosition(tagno2))
// PUB.log.AddI($"New Target {tagno2}");
//else
// PUB.log.AddE($"Path Error {tagno2}");
var currTag = System.Text.Encoding.Default.GetString(data, 1, data.Length - 1);
var targetNode = PUB._mapNodes.FirstOrDefault(t => t.RfidId == currTag);
if (targetNode == null)
{
PUB.log.AddE($"[{logPrefix}-Goto] 노드정보를 찾을 수 없습니다 RFID:{currTag}");
PUB.XBE.SendError(ENIGProtocol.AGVErrorCode.EmptyNode, $"{currTag}");
return;
}
var startNode = PUB._mapNodes.FirstOrDefault(t => t.RfidId == PUB._virtualAGV.CurrentNodeId);
if (startNode == null)
{
PUB.log.AddE($"[{logPrefix}-Goto] 노드정보를 찾을 수 없습니다 RFID:{PUB._virtualAGV.CurrentNodeId}");
PUB.XBE.SendError(ENIGProtocol.AGVErrorCode.EmptyNode, $"{PUB._virtualAGV.CurrentNodeId}");
return;
}
var rltGoto = CalcPath(startNode, targetNode);
if (rltGoto.result == false)
{
PUB.log.AddE($"[{logPrefix}-Goto] {rltGoto.message}");
PUB.XBE.SendError(ENIGProtocol.AGVErrorCode.Goto, rltGoto.message);
return;
}
//Move to
PUB.log.Add($"[{logPrefix}-Goto] {startNode.RfidId} -> {targetNode.RfidId}");
}
else PUB.log.AddE($"Path Param Error :{dataStr}");
else PUB.log.AddE($"[{logPrefix}-Goto] TagString Lenght Errorr:{data.Length}");
break;
case ENIGProtocol.AGVCommandHE.Stop: //stop
PUB.log.Add($"[{logPrefix}-Stop]");
PUB.AGV.AGVMoveStop("xbee");
break;
case ENIGProtocol.AGVCommandHE.Reset: //Error Reset
PUB.log.Add($"[{logPrefix}-Reset]");
PUB.AGV.AGVErrorReset();
break;
case ENIGProtocol.AGVCommandHE.Manual: //Manual Move (Direction, speed, runtime)
var Direction = data[0]; //0=back, 1=forward, 2=left, 3=right
var Speed = data[1]; //0=slow, 1=normal, 2=fast
var Runtime = data[2]; // running seconds
var Direction = data[1]; //0=back, 1=forward, 2=left, 3=right
var Speed = data[2]; //0=slow, 1=normal, 2=fast
arDev.Narumi.ManulOpt opt = arDev.Narumi.ManulOpt.BS;
arDev.Narumi.Speed spd = arDev.Narumi.Speed.Low;
@@ -111,27 +119,63 @@ namespace Project
else if (Direction == 2) opt = arDev.Narumi.ManulOpt.LT;
else if (Direction == 3) opt = arDev.Narumi.ManulOpt.RT;
PUB.log.Add($"[{logPrefix}-Manual] DIR:{opt},SPD:{spd}");
PUB.AGV.AGVMoveManual(opt, spd, arDev.Narumi.Sensor.PBSOn);
break;
case ENIGProtocol.AGVCommandHE.MarkStop: //Set MarkStop
var MarkStop = data[0]; //0=off, 1=on
case ENIGProtocol.AGVCommandHE.AutoMove:
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
var bunkidata = new arDev.Narumi.BunkiData();
//speed;
if (AutSpeed == 1) bunkidata.Speed = arDev.Narumi.eMoveSpd.Middle;
else if (AutSpeed == 2) bunkidata.Speed = arDev.Narumi.eMoveSpd.High;
else bunkidata.Speed = arDev.Narumi.eMoveSpd.Low;
//motor direction
if (MotDirection == 0) bunkidata.Direction = arDev.Narumi.eMoveDir.Backward;
else bunkidata.Direction = arDev.Narumi.eMoveDir.Forward;
if (MagDirection == 2) bunkidata.Bunki = arDev.Narumi.eBunki.Right;
else if (MagDirection == 1) bunkidata.Bunki = arDev.Narumi.eBunki.Left;
else bunkidata.Bunki = arDev.Narumi.eBunki.Strate;
PUB.log.Add($"[{logPrefix}-AutoMove] DIR:{bunkidata.Direction}-{bunkidata.Bunki},SPD:{bunkidata.Speed}");
PUB.AGV.AGVMoveSet(bunkidata);
PUB.AGV.AGVMoveRun();
break;
case ENIGProtocol.AGVCommandHE.MarkStop: //Set MarkStop
//마크센서에서 멈추게 한다
PUB.log.Add($"[{logPrefix}-MarkStop]");
PUB.AGV.AGVMoveStop("Xbee", arDev.Narumi.eStopOpt.MarkStop);
break;
case ENIGProtocol.AGVCommandHE.LiftControl: //Lift Control
var LiftCommand = data[0]; //0=stop, 1=up, 2=down
var LiftCommand = data[1]; //0=stop, 1=up, 2=down
arDev.Narumi.LiftCommand LCmd = arDev.Narumi.LiftCommand.STP;
if (LiftCommand == 1) LCmd = arDev.Narumi.LiftCommand.UP;
else if (LiftCommand == 2) LCmd = arDev.Narumi.LiftCommand.DN;
//리프트제어
PUB.AGV.LiftControl(LCmd);
PUB.log.Add($"[{logPrefix}-LiftControl] {LCmd}");
PUB.AGV.LiftControl(LCmd); //리프트제어
break;
case ENIGProtocol.AGVCommandHE.ChargeControl: //충전을 제어한다
var chargeAction = data[1] == 1; //0= off, 1=on
//충전시퀀스가 진행되지 않았다면 진행한다
if(PUB.sm.RunStep == StateMachine.ERunStep.GOCHARGE && PUB.sm.RunStepNew != StateMachine.ERunStep.GOCHARGE)
{
PUB.sm.SetNewRunStep(StateMachine.ERunStep.GOCHARGE);
PUB.log.AddI($"충전을 시작합니다");
}
break;
}
}
}
@@ -142,6 +186,60 @@ namespace Project
else PUB.log.Add(e.Message);
}
AGVNavigationCore.PathFinding.Planning.AGVPathfinder _advancedPathfinder = null;
(bool result, string message) CalcPath(MapNode startNode, MapNode targetNode)
{
var _mapNodes = PUB._mapNodes;
// 시작 RFID가 없으면 AGV 현재 위치로 설정
if (startNode == null || targetNode == null)
return (false, "시작 RFID와 목표 RFID를 선택해주세요.");
//경로계산기확인
if (_advancedPathfinder == null)
_advancedPathfinder = new AGVNavigationCore.PathFinding.Planning.AGVPathfinder(_mapNodes);
// 현재 AGV 방향 가져오기
var selectedAGV = PUB._virtualAGV;
var currentDirection = selectedAGV.CurrentDirection;
// AGV의 이전 위치에서 가장 가까운 노드 찾기
var prevNode = selectedAGV.PrevNode;
var prevDir = selectedAGV.PrevDirection;
// 고급 경로 계획 사용 (노드 객체 직접 전달)
var advancedResult = _advancedPathfinder.FindPath(startNode, targetNode, prevNode, prevDir, currentDirection);
var _simulatorCanvas = PUB._mapCanvas;
_simulatorCanvas.FitToNodes();
if (advancedResult.Success)
{
// 도킹 검증이 없는 경우 추가 검증 수행
if (advancedResult.DockingValidation == null || !advancedResult.DockingValidation.IsValidationRequired)
advancedResult.DockingValidation = DockingValidator.ValidateDockingDirection(advancedResult, _mapNodes);
_simulatorCanvas.CurrentPath = advancedResult;
//_pathLengthLabel.Text = $"경로 길이: {advancedResult.TotalDistance:F1}";
//_statusLabel.Text = $"경로 계산 완료 ({advancedResult.CalculationTimeMs}ms)";
// 🔥 VirtualAGV에도 경로 설정 (Predict()가 동작하려면 필요)
selectedAGV.SetPath(advancedResult);
// 도킹 검증 결과 확인 및 UI 표시
//CheckAndDisplayDockingValidation(advancedResult);
// 고급 경로 디버깅 정보 표시
//UpdateAdvancedPathDebugInfo(advancedResult);
return (true, string.Empty);
}
else
{
// 경로 실패시 디버깅 정보 초기화
//_pathDebugLabel.Text = $"경로: 실패 - {advancedResult.ErrorMessage}";
return (false, $"경로를 찾을 수 없습니다:\n{advancedResult.ErrorMessage}");
}
}
}
}

Submodule Cs_HMI/SubProject/EnigProtocol updated: 6c8ed6d2f2...4f360f33a7

View File

@@ -0,0 +1,75 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Express 15 for Windows Desktop
VisualStudioVersion = 15.0.36324.19
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Test_ACS", "Test_ACS\Test_ACS.csproj", "{A1B2C3D4-E5F6-4A5B-8C9D-0E1F2A3B4C5D}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Test_BMS", "Test_BMS\Test_BMS.csproj", "{CE3FFF9F-6ACA-44BD-B64A-33FF4AD5E82E}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Test_Narumi", "Test_Narumi\Test_Narumi.csproj", "{EB77976F-4DE4-46A5-8B25-D07226204C32}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Test_Port", "Test_Port\Test_Port.csproj", "{CCFA2CE7-A539-4ADC-B803-F759284C3463}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Library", "Library", "{530A4517-6210-422B-8CB4-B7D194EE70BE}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BMS", "..\SubProject\BMS\BMS.csproj", "{7A94C30C-6772-4F71-BF9C-0DF071A1BC70}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CommData", "..\SubProject\CommData\CommData.csproj", "{14E8C9A5-013E-49BA-B435-EFEFC77DD623}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ENIGProtocol", "..\SubProject\EnigProtocol\enigprotocol\ENIGProtocol.csproj", "{9365803B-933D-4237-93C7-B502C855A71C}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NARUMI", "..\SubProject\AGV\NARUMI.csproj", "{8BAE0EAC-3D25-402F-9A65-2BA1ECFE28B7}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{A1B2C3D4-E5F6-4A5B-8C9D-0E1F2A3B4C5D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A1B2C3D4-E5F6-4A5B-8C9D-0E1F2A3B4C5D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A1B2C3D4-E5F6-4A5B-8C9D-0E1F2A3B4C5D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A1B2C3D4-E5F6-4A5B-8C9D-0E1F2A3B4C5D}.Release|Any CPU.Build.0 = Release|Any CPU
{CE3FFF9F-6ACA-44BD-B64A-33FF4AD5E82E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{CE3FFF9F-6ACA-44BD-B64A-33FF4AD5E82E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CE3FFF9F-6ACA-44BD-B64A-33FF4AD5E82E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CE3FFF9F-6ACA-44BD-B64A-33FF4AD5E82E}.Release|Any CPU.Build.0 = Release|Any CPU
{EB77976F-4DE4-46A5-8B25-D07226204C32}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{EB77976F-4DE4-46A5-8B25-D07226204C32}.Debug|Any CPU.Build.0 = Debug|Any CPU
{EB77976F-4DE4-46A5-8B25-D07226204C32}.Release|Any CPU.ActiveCfg = Release|Any CPU
{EB77976F-4DE4-46A5-8B25-D07226204C32}.Release|Any CPU.Build.0 = Release|Any CPU
{CCFA2CE7-A539-4ADC-B803-F759284C3463}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{CCFA2CE7-A539-4ADC-B803-F759284C3463}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CCFA2CE7-A539-4ADC-B803-F759284C3463}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CCFA2CE7-A539-4ADC-B803-F759284C3463}.Release|Any CPU.Build.0 = Release|Any CPU
{7A94C30C-6772-4F71-BF9C-0DF071A1BC70}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7A94C30C-6772-4F71-BF9C-0DF071A1BC70}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7A94C30C-6772-4F71-BF9C-0DF071A1BC70}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7A94C30C-6772-4F71-BF9C-0DF071A1BC70}.Release|Any CPU.Build.0 = Release|Any CPU
{14E8C9A5-013E-49BA-B435-EFEFC77DD623}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{14E8C9A5-013E-49BA-B435-EFEFC77DD623}.Debug|Any CPU.Build.0 = Debug|Any CPU
{14E8C9A5-013E-49BA-B435-EFEFC77DD623}.Release|Any CPU.ActiveCfg = Release|Any CPU
{14E8C9A5-013E-49BA-B435-EFEFC77DD623}.Release|Any CPU.Build.0 = Release|Any CPU
{9365803B-933D-4237-93C7-B502C855A71C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9365803B-933D-4237-93C7-B502C855A71C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9365803B-933D-4237-93C7-B502C855A71C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9365803B-933D-4237-93C7-B502C855A71C}.Release|Any CPU.Build.0 = Release|Any CPU
{8BAE0EAC-3D25-402F-9A65-2BA1ECFE28B7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8BAE0EAC-3D25-402F-9A65-2BA1ECFE28B7}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8BAE0EAC-3D25-402F-9A65-2BA1ECFE28B7}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8BAE0EAC-3D25-402F-9A65-2BA1ECFE28B7}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{7A94C30C-6772-4F71-BF9C-0DF071A1BC70} = {530A4517-6210-422B-8CB4-B7D194EE70BE}
{14E8C9A5-013E-49BA-B435-EFEFC77DD623} = {530A4517-6210-422B-8CB4-B7D194EE70BE}
{9365803B-933D-4237-93C7-B502C855A71C} = {530A4517-6210-422B-8CB4-B7D194EE70BE}
{8BAE0EAC-3D25-402F-9A65-2BA1ECFE28B7} = {530A4517-6210-422B-8CB4-B7D194EE70BE}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {E9528217-EC4E-4991-B3C9-AE371EDFA28F}
EndGlobalSection
EndGlobal

View File

@@ -17,6 +17,7 @@ namespace Test_ACS
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MainForm));
this.grpConnection = new System.Windows.Forms.GroupBox();
this.btnRefresh = new System.Windows.Forms.Button();
this.btnConnect = new System.Windows.Forms.Button();
@@ -33,13 +34,12 @@ namespace Test_ACS
this.btnLiftDown = new System.Windows.Forms.Button();
this.btnLiftUp = new System.Windows.Forms.Button();
this.grpManual = new System.Windows.Forms.GroupBox();
this.btnManual = new System.Windows.Forms.Button();
this.btMMove = new System.Windows.Forms.Button();
this.numRuntime = new System.Windows.Forms.NumericUpDown();
this.lblRuntime = new System.Windows.Forms.Label();
this.cmbSpeed = new System.Windows.Forms.ComboBox();
this.lblSpeed = new System.Windows.Forms.Label();
this.cmbDirection = new System.Windows.Forms.ComboBox();
this.lblDirection = new System.Windows.Forms.Label();
this.chkMarkStop = new System.Windows.Forms.CheckBox();
this.btnMarkStop = new System.Windows.Forms.Button();
this.btnReset = new System.Windows.Forms.Button();
@@ -49,16 +49,21 @@ namespace Test_ACS
this.btnSetCurrent = new System.Windows.Forms.Button();
this.txtAlias = new System.Windows.Forms.TextBox();
this.lblAlias = new System.Windows.Forms.Label();
this.txtRFID = new System.Windows.Forms.TextBox();
this.txtRFID = new System.Windows.Forms.NumericUpDown();
this.lblRFID = new System.Windows.Forms.Label();
this.lblDirection = new System.Windows.Forms.Label();
this.grpLogs = new System.Windows.Forms.GroupBox();
this.tabLogs = new System.Windows.Forms.TabControl();
this.tabRX = new System.Windows.Forms.TabPage();
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
this.txtRxLog = new System.Windows.Forms.TextBox();
this.tabTX = new System.Windows.Forms.TabPage();
this.txtTxLog = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.tabInfo = new System.Windows.Forms.TabPage();
this.txtInfoLog = new System.Windows.Forms.TextBox();
this.tabPage1 = new System.Windows.Forms.TabPage();
this.richTextBox1 = new System.Windows.Forms.RichTextBox();
this.grpAGVStatus = new System.Windows.Forms.GroupBox();
this.lblLastTagValue = new System.Windows.Forms.Label();
this.lblLastTag = new System.Windows.Forms.Label();
@@ -75,18 +80,29 @@ namespace Test_ACS
this.lblRunSt = new System.Windows.Forms.Label();
this.lblModeValue = new System.Windows.Forms.Label();
this.lblMode = new System.Windows.Forms.Label();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.btAMove = new System.Windows.Forms.Button();
this.cmbAutoSpeed = new System.Windows.Forms.ComboBox();
this.label4 = new System.Windows.Forms.Label();
this.cmbMotDirection = new System.Windows.Forms.ComboBox();
this.label5 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.cmbMagDirection = new System.Windows.Forms.ComboBox();
this.grpConnection.SuspendLayout();
this.grpAGV.SuspendLayout();
this.grpCommands.SuspendLayout();
this.grpLift.SuspendLayout();
this.grpManual.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.numRuntime)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.txtRFID)).BeginInit();
this.grpLogs.SuspendLayout();
this.tabLogs.SuspendLayout();
this.tabRX.SuspendLayout();
this.tabTX.SuspendLayout();
this.tableLayoutPanel1.SuspendLayout();
this.tabInfo.SuspendLayout();
this.tabPage1.SuspendLayout();
this.grpAGVStatus.SuspendLayout();
this.groupBox1.SuspendLayout();
this.SuspendLayout();
//
// grpConnection
@@ -199,7 +215,7 @@ namespace Test_ACS
//
// grpCommands
//
this.grpCommands.Controls.Add(this.grpLift);
this.grpCommands.Controls.Add(this.groupBox1);
this.grpCommands.Controls.Add(this.grpManual);
this.grpCommands.Controls.Add(this.chkMarkStop);
this.grpCommands.Controls.Add(this.btnMarkStop);
@@ -224,18 +240,18 @@ namespace Test_ACS
this.grpLift.Controls.Add(this.btnLiftStop);
this.grpLift.Controls.Add(this.btnLiftDown);
this.grpLift.Controls.Add(this.btnLiftUp);
this.grpLift.Location = new System.Drawing.Point(240, 202);
this.grpLift.Location = new System.Drawing.Point(298, 456);
this.grpLift.Name = "grpLift";
this.grpLift.Size = new System.Drawing.Size(210, 100);
this.grpLift.Size = new System.Drawing.Size(180, 120);
this.grpLift.TabIndex = 9;
this.grpLift.TabStop = false;
this.grpLift.Text = "리프트 제어";
//
// btnLiftStop
//
this.btnLiftStop.Location = new System.Drawing.Point(135, 20);
this.btnLiftStop.Location = new System.Drawing.Point(121, 20);
this.btnLiftStop.Name = "btnLiftStop";
this.btnLiftStop.Size = new System.Drawing.Size(60, 70);
this.btnLiftStop.Size = new System.Drawing.Size(48, 90);
this.btnLiftStop.TabIndex = 2;
this.btnLiftStop.Text = "정지";
this.btnLiftStop.UseVisualStyleBackColor = true;
@@ -243,9 +259,9 @@ namespace Test_ACS
//
// btnLiftDown
//
this.btnLiftDown.Location = new System.Drawing.Point(70, 20);
this.btnLiftDown.Location = new System.Drawing.Point(65, 20);
this.btnLiftDown.Name = "btnLiftDown";
this.btnLiftDown.Size = new System.Drawing.Size(60, 70);
this.btnLiftDown.Size = new System.Drawing.Size(48, 90);
this.btnLiftDown.TabIndex = 1;
this.btnLiftDown.Text = "하강";
this.btnLiftDown.UseVisualStyleBackColor = true;
@@ -253,9 +269,9 @@ namespace Test_ACS
//
// btnLiftUp
//
this.btnLiftUp.Location = new System.Drawing.Point(5, 20);
this.btnLiftUp.Location = new System.Drawing.Point(9, 20);
this.btnLiftUp.Name = "btnLiftUp";
this.btnLiftUp.Size = new System.Drawing.Size(60, 70);
this.btnLiftUp.Size = new System.Drawing.Size(48, 90);
this.btnLiftUp.TabIndex = 0;
this.btnLiftUp.Text = "상승";
this.btnLiftUp.UseVisualStyleBackColor = true;
@@ -263,7 +279,7 @@ namespace Test_ACS
//
// grpManual
//
this.grpManual.Controls.Add(this.btnManual);
this.grpManual.Controls.Add(this.btMMove);
this.grpManual.Controls.Add(this.numRuntime);
this.grpManual.Controls.Add(this.lblRuntime);
this.grpManual.Controls.Add(this.cmbSpeed);
@@ -274,17 +290,17 @@ namespace Test_ACS
this.grpManual.Size = new System.Drawing.Size(215, 100);
this.grpManual.TabIndex = 8;
this.grpManual.TabStop = false;
this.grpManual.Text = "수동 제어";
this.grpManual.Text = "수동 이동";
//
// btnManual
// btMMove
//
this.btnManual.Location = new System.Drawing.Point(136, 16);
this.btnManual.Name = "btnManual";
this.btnManual.Size = new System.Drawing.Size(73, 74);
this.btnManual.TabIndex = 6;
this.btnManual.Text = "수동\r\n이동\r\n실행";
this.btnManual.UseVisualStyleBackColor = true;
this.btnManual.Click += new System.EventHandler(this.btnManual_Click);
this.btMMove.Location = new System.Drawing.Point(136, 16);
this.btMMove.Name = "btMMove";
this.btMMove.Size = new System.Drawing.Size(73, 74);
this.btMMove.TabIndex = 6;
this.btMMove.Text = "실행";
this.btMMove.UseVisualStyleBackColor = true;
this.btMMove.Click += new System.EventHandler(this.btnManual_Click);
//
// numRuntime
//
@@ -297,6 +313,7 @@ namespace Test_ACS
this.numRuntime.Name = "numRuntime";
this.numRuntime.Size = new System.Drawing.Size(70, 21);
this.numRuntime.TabIndex = 5;
this.numRuntime.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
this.numRuntime.Value = new decimal(new int[] {
5,
0,
@@ -348,15 +365,6 @@ namespace Test_ACS
this.cmbDirection.Size = new System.Drawing.Size(70, 20);
this.cmbDirection.TabIndex = 1;
//
// lblDirection
//
this.lblDirection.AutoSize = true;
this.lblDirection.Location = new System.Drawing.Point(10, 48);
this.lblDirection.Name = "lblDirection";
this.lblDirection.Size = new System.Drawing.Size(33, 12);
this.lblDirection.TabIndex = 4;
this.lblDirection.Text = "방향:";
//
// chkMarkStop
//
this.chkMarkStop.AutoSize = true;
@@ -451,11 +459,20 @@ namespace Test_ACS
//
this.txtRFID.Font = new System.Drawing.Font("Consolas", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.txtRFID.Location = new System.Drawing.Point(85, 25);
this.txtRFID.Maximum = new decimal(new int[] {
999999,
0,
0,
0});
this.txtRFID.Name = "txtRFID";
this.txtRFID.Size = new System.Drawing.Size(195, 26);
this.txtRFID.TabIndex = 1;
this.txtRFID.Text = "0001";
this.txtRFID.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
this.txtRFID.Value = new decimal(new int[] {
1,
0,
0,
0});
this.txtRFID.TextChanged += new System.EventHandler(this.txtRFID_TextChanged);
//
// lblRFID
@@ -467,6 +484,15 @@ namespace Test_ACS
this.lblRFID.TabIndex = 0;
this.lblRFID.Text = "RFID 번호:";
//
// lblDirection
//
this.lblDirection.AutoSize = true;
this.lblDirection.Location = new System.Drawing.Point(10, 48);
this.lblDirection.Name = "lblDirection";
this.lblDirection.Size = new System.Drawing.Size(33, 12);
this.lblDirection.TabIndex = 4;
this.lblDirection.Text = "방향:";
//
// grpLogs
//
this.grpLogs.Controls.Add(this.tabLogs);
@@ -480,8 +506,8 @@ namespace Test_ACS
// tabLogs
//
this.tabLogs.Controls.Add(this.tabRX);
this.tabLogs.Controls.Add(this.tabTX);
this.tabLogs.Controls.Add(this.tabInfo);
this.tabLogs.Controls.Add(this.tabPage1);
this.tabLogs.Dock = System.Windows.Forms.DockStyle.Fill;
this.tabLogs.Location = new System.Drawing.Point(3, 17);
this.tabLogs.Name = "tabLogs";
@@ -491,56 +517,85 @@ namespace Test_ACS
//
// tabRX
//
this.tabRX.Controls.Add(this.txtRxLog);
this.tabRX.Controls.Add(this.tableLayoutPanel1);
this.tabRX.Location = new System.Drawing.Point(4, 22);
this.tabRX.Name = "tabRX";
this.tabRX.Padding = new System.Windows.Forms.Padding(3);
this.tabRX.Size = new System.Drawing.Size(506, 518);
this.tabRX.TabIndex = 1;
this.tabRX.Text = "수신 (RX)";
this.tabRX.Text = "패킷";
this.tabRX.UseVisualStyleBackColor = true;
//
// tableLayoutPanel1
//
this.tableLayoutPanel1.ColumnCount = 1;
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLayoutPanel1.Controls.Add(this.txtRxLog, 0, 3);
this.tableLayoutPanel1.Controls.Add(this.txtTxLog, 0, 1);
this.tableLayoutPanel1.Controls.Add(this.label1, 0, 0);
this.tableLayoutPanel1.Controls.Add(this.label2, 0, 2);
this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.tableLayoutPanel1.Location = new System.Drawing.Point(3, 3);
this.tableLayoutPanel1.Name = "tableLayoutPanel1";
this.tableLayoutPanel1.RowCount = 4;
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F));
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F));
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
this.tableLayoutPanel1.Size = new System.Drawing.Size(500, 512);
this.tableLayoutPanel1.TabIndex = 1;
//
// txtRxLog
//
this.txtRxLog.Dock = System.Windows.Forms.DockStyle.Fill;
this.txtRxLog.Font = new System.Drawing.Font("Consolas", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.txtRxLog.Location = new System.Drawing.Point(3, 3);
this.txtRxLog.Location = new System.Drawing.Point(3, 279);
this.txtRxLog.Multiline = true;
this.txtRxLog.Name = "txtRxLog";
this.txtRxLog.ReadOnly = true;
this.txtRxLog.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
this.txtRxLog.Size = new System.Drawing.Size(500, 512);
this.txtRxLog.Size = new System.Drawing.Size(494, 230);
this.txtRxLog.TabIndex = 0;
//
// tabTX
//
this.tabTX.Controls.Add(this.txtTxLog);
this.tabTX.Location = new System.Drawing.Point(4, 22);
this.tabTX.Name = "tabTX";
this.tabTX.Padding = new System.Windows.Forms.Padding(3);
this.tabTX.Size = new System.Drawing.Size(506, 469);
this.tabTX.TabIndex = 0;
this.tabTX.Text = "송신 (TX)";
this.tabTX.UseVisualStyleBackColor = true;
this.txtRxLog.Text = "1";
//
// txtTxLog
//
this.txtTxLog.Dock = System.Windows.Forms.DockStyle.Fill;
this.txtTxLog.Font = new System.Drawing.Font("Consolas", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.txtTxLog.Location = new System.Drawing.Point(3, 3);
this.txtTxLog.Location = new System.Drawing.Point(3, 23);
this.txtTxLog.Multiline = true;
this.txtTxLog.Name = "txtTxLog";
this.txtTxLog.ReadOnly = true;
this.txtTxLog.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
this.txtTxLog.Size = new System.Drawing.Size(500, 463);
this.txtTxLog.Size = new System.Drawing.Size(494, 230);
this.txtTxLog.TabIndex = 0;
//
// label1
//
this.label1.Dock = System.Windows.Forms.DockStyle.Fill;
this.label1.Location = new System.Drawing.Point(3, 0);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(494, 20);
this.label1.TabIndex = 1;
this.label1.Text = "Tx";
this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// label2
//
this.label2.Dock = System.Windows.Forms.DockStyle.Fill;
this.label2.Location = new System.Drawing.Point(3, 256);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(494, 20);
this.label2.TabIndex = 1;
this.label2.Text = "Rx";
this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// tabInfo
//
this.tabInfo.Controls.Add(this.txtInfoLog);
this.tabInfo.Location = new System.Drawing.Point(4, 22);
this.tabInfo.Name = "tabInfo";
this.tabInfo.Size = new System.Drawing.Size(506, 469);
this.tabInfo.Size = new System.Drawing.Size(506, 518);
this.tabInfo.TabIndex = 2;
this.tabInfo.Text = "정보";
this.tabInfo.UseVisualStyleBackColor = true;
@@ -554,9 +609,31 @@ namespace Test_ACS
this.txtInfoLog.Name = "txtInfoLog";
this.txtInfoLog.ReadOnly = true;
this.txtInfoLog.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
this.txtInfoLog.Size = new System.Drawing.Size(506, 469);
this.txtInfoLog.Size = new System.Drawing.Size(506, 518);
this.txtInfoLog.TabIndex = 0;
//
// tabPage1
//
this.tabPage1.Controls.Add(this.richTextBox1);
this.tabPage1.Location = new System.Drawing.Point(4, 22);
this.tabPage1.Name = "tabPage1";
this.tabPage1.Size = new System.Drawing.Size(506, 518);
this.tabPage1.TabIndex = 3;
this.tabPage1.Text = "프레임구조";
this.tabPage1.UseVisualStyleBackColor = true;
//
// richTextBox1
//
this.richTextBox1.BackColor = System.Drawing.Color.WhiteSmoke;
this.richTextBox1.BorderStyle = System.Windows.Forms.BorderStyle.None;
this.richTextBox1.Dock = System.Windows.Forms.DockStyle.Fill;
this.richTextBox1.Location = new System.Drawing.Point(0, 0);
this.richTextBox1.Margin = new System.Windows.Forms.Padding(10);
this.richTextBox1.Name = "richTextBox1";
this.richTextBox1.Size = new System.Drawing.Size(506, 518);
this.richTextBox1.TabIndex = 0;
this.richTextBox1.Text = resources.GetString("richTextBox1.Text");
//
// grpAGVStatus
//
this.grpAGVStatus.Controls.Add(this.lblLastTagValue);
@@ -577,7 +654,7 @@ namespace Test_ACS
this.grpAGVStatus.Controls.Add(this.lblMode);
this.grpAGVStatus.Location = new System.Drawing.Point(12, 456);
this.grpAGVStatus.Name = "grpAGVStatus";
this.grpAGVStatus.Size = new System.Drawing.Size(466, 120);
this.grpAGVStatus.Size = new System.Drawing.Size(280, 120);
this.grpAGVStatus.TabIndex = 4;
this.grpAGVStatus.TabStop = false;
this.grpAGVStatus.Text = "AGV 상태";
@@ -586,7 +663,7 @@ namespace Test_ACS
//
this.lblLastTagValue.AutoSize = true;
this.lblLastTagValue.Font = new System.Drawing.Font("Consolas", 9F, System.Drawing.FontStyle.Bold);
this.lblLastTagValue.Location = new System.Drawing.Point(310, 98);
this.lblLastTagValue.Location = new System.Drawing.Point(221, 98);
this.lblLastTagValue.Name = "lblLastTagValue";
this.lblLastTagValue.Size = new System.Drawing.Size(14, 14);
this.lblLastTagValue.TabIndex = 15;
@@ -595,7 +672,7 @@ namespace Test_ACS
// lblLastTag
//
this.lblLastTag.AutoSize = true;
this.lblLastTag.Location = new System.Drawing.Point(240, 98);
this.lblLastTag.Location = new System.Drawing.Point(151, 98);
this.lblLastTag.Name = "lblLastTag";
this.lblLastTag.Size = new System.Drawing.Size(57, 12);
this.lblLastTag.TabIndex = 14;
@@ -624,7 +701,7 @@ namespace Test_ACS
//
this.lblCartStValue.AutoSize = true;
this.lblCartStValue.Font = new System.Drawing.Font("굴림", 9F, System.Drawing.FontStyle.Bold);
this.lblCartStValue.Location = new System.Drawing.Point(310, 73);
this.lblCartStValue.Location = new System.Drawing.Point(221, 73);
this.lblCartStValue.Name = "lblCartStValue";
this.lblCartStValue.Size = new System.Drawing.Size(12, 12);
this.lblCartStValue.TabIndex = 11;
@@ -633,7 +710,7 @@ namespace Test_ACS
// lblCartSt
//
this.lblCartSt.AutoSize = true;
this.lblCartSt.Location = new System.Drawing.Point(240, 73);
this.lblCartSt.Location = new System.Drawing.Point(151, 73);
this.lblCartSt.Name = "lblCartSt";
this.lblCartSt.Size = new System.Drawing.Size(33, 12);
this.lblCartSt.TabIndex = 10;
@@ -662,7 +739,7 @@ namespace Test_ACS
//
this.lblInpositionValue.AutoSize = true;
this.lblInpositionValue.Font = new System.Drawing.Font("굴림", 9F, System.Drawing.FontStyle.Bold);
this.lblInpositionValue.Location = new System.Drawing.Point(310, 48);
this.lblInpositionValue.Location = new System.Drawing.Point(221, 48);
this.lblInpositionValue.Name = "lblInpositionValue";
this.lblInpositionValue.Size = new System.Drawing.Size(12, 12);
this.lblInpositionValue.TabIndex = 7;
@@ -671,7 +748,7 @@ namespace Test_ACS
// lblInposition
//
this.lblInposition.AutoSize = true;
this.lblInposition.Location = new System.Drawing.Point(240, 48);
this.lblInposition.Location = new System.Drawing.Point(151, 48);
this.lblInposition.Name = "lblInposition";
this.lblInposition.Size = new System.Drawing.Size(57, 12);
this.lblInposition.TabIndex = 6;
@@ -691,7 +768,7 @@ namespace Test_ACS
//
this.lblRunStValue.AutoSize = true;
this.lblRunStValue.Font = new System.Drawing.Font("굴림", 9F, System.Drawing.FontStyle.Bold);
this.lblRunStValue.Location = new System.Drawing.Point(310, 23);
this.lblRunStValue.Location = new System.Drawing.Point(221, 23);
this.lblRunStValue.Name = "lblRunStValue";
this.lblRunStValue.Size = new System.Drawing.Size(12, 12);
this.lblRunStValue.TabIndex = 3;
@@ -700,7 +777,7 @@ namespace Test_ACS
// lblRunSt
//
this.lblRunSt.AutoSize = true;
this.lblRunSt.Location = new System.Drawing.Point(240, 23);
this.lblRunSt.Location = new System.Drawing.Point(151, 23);
this.lblRunSt.Name = "lblRunSt";
this.lblRunSt.Size = new System.Drawing.Size(57, 12);
this.lblRunSt.TabIndex = 2;
@@ -725,11 +802,103 @@ namespace Test_ACS
this.lblMode.TabIndex = 0;
this.lblMode.Text = "모드:";
//
// groupBox1
//
this.groupBox1.Controls.Add(this.label3);
this.groupBox1.Controls.Add(this.cmbMagDirection);
this.groupBox1.Controls.Add(this.label5);
this.groupBox1.Controls.Add(this.btAMove);
this.groupBox1.Controls.Add(this.cmbAutoSpeed);
this.groupBox1.Controls.Add(this.label4);
this.groupBox1.Controls.Add(this.cmbMotDirection);
this.groupBox1.Location = new System.Drawing.Point(240, 202);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(215, 100);
this.groupBox1.TabIndex = 8;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "자동 이동";
//
// btAMove
//
this.btAMove.Location = new System.Drawing.Point(128, 16);
this.btAMove.Name = "btAMove";
this.btAMove.Size = new System.Drawing.Size(81, 74);
this.btAMove.TabIndex = 6;
this.btAMove.Text = "이동";
this.btAMove.UseVisualStyleBackColor = true;
this.btAMove.Click += new System.EventHandler(this.btAMove_Click);
//
// cmbAutoSpeed
//
this.cmbAutoSpeed.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cmbAutoSpeed.FormattingEnabled = true;
this.cmbAutoSpeed.Items.AddRange(new object[] {
"느림",
"보통",
"빠름"});
this.cmbAutoSpeed.Location = new System.Drawing.Point(52, 69);
this.cmbAutoSpeed.Name = "cmbAutoSpeed";
this.cmbAutoSpeed.Size = new System.Drawing.Size(70, 20);
this.cmbAutoSpeed.TabIndex = 3;
//
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(14, 73);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(29, 12);
this.label4.TabIndex = 2;
this.label4.Text = "속도";
//
// cmbMotDirection
//
this.cmbMotDirection.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cmbMotDirection.FormattingEnabled = true;
this.cmbMotDirection.Items.AddRange(new object[] {
"후진",
"전진"});
this.cmbMotDirection.Location = new System.Drawing.Point(52, 16);
this.cmbMotDirection.Name = "cmbMotDirection";
this.cmbMotDirection.Size = new System.Drawing.Size(70, 20);
this.cmbMotDirection.TabIndex = 1;
//
// label5
//
this.label5.AutoSize = true;
this.label5.Location = new System.Drawing.Point(13, 21);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(29, 12);
this.label5.TabIndex = 7;
this.label5.Text = "모터";
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(13, 47);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(29, 12);
this.label3.TabIndex = 9;
this.label3.Text = "방향";
//
// cmbMagDirection
//
this.cmbMagDirection.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cmbMagDirection.FormattingEnabled = true;
this.cmbMagDirection.Items.AddRange(new object[] {
"직진",
"좌",
"우"});
this.cmbMagDirection.Location = new System.Drawing.Point(52, 42);
this.cmbMagDirection.Name = "cmbMagDirection";
this.cmbMagDirection.Size = new System.Drawing.Size(70, 20);
this.cmbMagDirection.TabIndex = 8;
//
// MainForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(1016, 588);
this.Controls.Add(this.grpLift);
this.Controls.Add(this.grpAGVStatus);
this.Controls.Add(this.grpLogs);
this.Controls.Add(this.grpCommands);
@@ -750,16 +919,19 @@ namespace Test_ACS
this.grpManual.ResumeLayout(false);
this.grpManual.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.numRuntime)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.txtRFID)).EndInit();
this.grpLogs.ResumeLayout(false);
this.tabLogs.ResumeLayout(false);
this.tabRX.ResumeLayout(false);
this.tabRX.PerformLayout();
this.tabTX.ResumeLayout(false);
this.tabTX.PerformLayout();
this.tableLayoutPanel1.ResumeLayout(false);
this.tableLayoutPanel1.PerformLayout();
this.tabInfo.ResumeLayout(false);
this.tabInfo.PerformLayout();
this.tabPage1.ResumeLayout(false);
this.grpAGVStatus.ResumeLayout(false);
this.grpAGVStatus.PerformLayout();
this.groupBox1.ResumeLayout(false);
this.groupBox1.PerformLayout();
this.ResumeLayout(false);
}
@@ -777,7 +949,7 @@ namespace Test_ACS
private System.Windows.Forms.RadioButton rbAGV1;
private System.Windows.Forms.GroupBox grpCommands;
private System.Windows.Forms.Button btnSetCurrent;
private System.Windows.Forms.TextBox txtRFID;
private System.Windows.Forms.NumericUpDown txtRFID;
private System.Windows.Forms.Label lblRFID;
private System.Windows.Forms.Button btnGoto;
private System.Windows.Forms.Button btnStop;
@@ -785,7 +957,7 @@ namespace Test_ACS
private System.Windows.Forms.Button btnMarkStop;
private System.Windows.Forms.CheckBox chkMarkStop;
private System.Windows.Forms.GroupBox grpManual;
private System.Windows.Forms.Button btnManual;
private System.Windows.Forms.Button btMMove;
private System.Windows.Forms.NumericUpDown numRuntime;
private System.Windows.Forms.Label lblRuntime;
private System.Windows.Forms.ComboBox cmbSpeed;
@@ -797,7 +969,6 @@ namespace Test_ACS
private System.Windows.Forms.Button btnLiftUp;
private System.Windows.Forms.GroupBox grpLogs;
private System.Windows.Forms.TabControl tabLogs;
private System.Windows.Forms.TabPage tabTX;
private System.Windows.Forms.TextBox txtTxLog;
private System.Windows.Forms.TabPage tabRX;
private System.Windows.Forms.TextBox txtRxLog;
@@ -824,5 +995,18 @@ namespace Test_ACS
private System.Windows.Forms.Label lblRunSt;
private System.Windows.Forms.Label lblModeValue;
private System.Windows.Forms.Label lblMode;
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.TabPage tabPage1;
private System.Windows.Forms.RichTextBox richTextBox1;
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.Button btAMove;
private System.Windows.Forms.ComboBox cmbAutoSpeed;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.ComboBox cmbMotDirection;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.ComboBox cmbMagDirection;
}
}

View File

@@ -31,6 +31,11 @@ namespace Test_ACS
// Speed combobox default
if (cmbSpeed.Items.Count > 0) cmbSpeed.SelectedIndex = 1; // 보통
cmbMotDirection.SelectedIndex = 0;
cmbMagDirection.SelectedIndex = 0;
cmbAutoSpeed.SelectedIndex = 0;
}
private void InitializeProtocol()
@@ -61,9 +66,14 @@ namespace Test_ACS
AddLog($"RX: {hexstrRaw}\nID:{id}, CMD:{cmd}, DATA:{hexstr}", LogType.RX);
// AGV 상태 수신 처리 (cmd = 3)
if (e.ReceivedPacket.Command == (byte)ENIGProtocol.AGVCommandEH.Status)
var device = e.ReceivedPacket.ID;
var command = (ENIGProtocol.AGVCommandEH)e.ReceivedPacket.Command;
switch (command)
{
UpdateAGVStatus(e.ReceivedPacket.Data);
case AGVCommandEH.Status:
UpdateAGVStatus(e.ReceivedPacket.Data);
break;
}
}
@@ -220,18 +230,21 @@ namespace Test_ACS
private void btnSetCurrent_Click(object sender, EventArgs e)
{
// SetCurrent: data = TargetID(2 hex) + RFID(4 hex)
var rfid = txtRFID.Text.PadLeft(4, '0');
var targetID = selectedAGV.ToString("X2");
var dataStr = targetID + rfid;
var rfidBytes = Encoding.ASCII.GetBytes(txtRFID.Text.PadLeft(4, '0'));
var rfidHex = string.Join("", rfidBytes.Select(b => b.ToString("X2")));
var dataStr = targetID + rfidHex;
SendCommand(AGVCommandHE.SetCurrent, dataStr);
}
private void btnGoto_Click(object sender, EventArgs e)
{
// Goto: data = TargetID(2 hex) + RFID(4 hex)
var rfid = txtRFID.Text.PadLeft(4, '0');
var targetID = selectedAGV.ToString("X2");
var dataStr = targetID + rfid;
var rfidBytes = Encoding.ASCII.GetBytes(txtRFID.Text.PadLeft(4, '0'));
var rfidHex = string.Join("", rfidBytes.Select(b => b.ToString("X2")));
var dataStr = targetID + rfidHex;
SendCommand(AGVCommandHE.Goto, dataStr);
}
@@ -334,7 +347,22 @@ namespace Test_ACS
serialPort.Write(packet, 0, packet.Length);
var hexString = string.Join(" ", packet.Select(b => b.ToString("X2")));
AddLog($"TX: {hexString}\nCMD: {command} ({(byte)command:X2}), DATA: {dataHexString}", LogType.TX);
//정보를 조금더 추출한다.
var Sender = packet[2];
if (Sender == 0x00)
{
var Receiver = packet[4];
var strdata = System.Text.Encoding.Default.GetString(dataBytes, 1, dataBytes.Length - 1);// (dataHexString.Substring(2), 16);
AddLog($"{hexString}|{command}({(byte)command:X2}) From:{Sender} To:{Receiver} => {dataHexString} STR:{strdata}", LogType.TX);
}
else
{
AddLog($"{hexString}|{command}({(byte)command:X2}) From:{Sender} => {dataHexString}", LogType.TX);
}
}
catch (Exception ex)
{
@@ -344,7 +372,7 @@ namespace Test_ACS
private void UpdateAGVStatus(byte[] data)
{
if (data.Length < 13)
if (data.Length < 12)
{
AddLog($"AGV 상태 데이터 길이 오류: {data.Length} bytes", LogType.Error);
return;
@@ -383,36 +411,47 @@ namespace Test_ACS
break;
}
// Direction[1]: 0=straight, 1=left, 2=right, 3=markstop
// Mot Direction[1]: 0=forward, 1:backward
switch (data[2])
{
case 0:
lblDirectionValue.Text = "진";
lblDirectionValue.Text = "진";
break;
case 1:
lblDirectionValue.Text = "좌회전";
break;
case 2:
lblDirectionValue.Text = "우회전";
break;
case 3:
lblDirectionValue.Text = "마크정지";
lblDirectionValue.Text = "후진";
break;
default:
lblDirectionValue.Text = "알 수 없음";
lblDirectionValue.Text = "??";
break;
}
// Direction[1]: 0=straight, 1=left, 2=right, 3=markstop
switch (data[3])
{
case 0:
lblDirectionValue.Text += "/직진";
break;
case 1:
lblDirectionValue.Text += "/좌회전";
break;
case 2:
lblDirectionValue.Text += "/우회전";
break;
default:
lblDirectionValue.Text += "/??";
break;
}
// Inposition[1]: 0=off, 1=on
lblInpositionValue.Text = data[3] == 0 ? "OFF" : "ON";
lblInpositionValue.ForeColor = data[3] == 0 ? Color.Gray : Color.Green;
lblInpositionValue.Text = data[4] == 0 ? "OFF" : "ON";
lblInpositionValue.ForeColor = data[4] == 0 ? Color.Gray : Color.Green;
// ChargeSt[1]: 0=off, 1=on
lblChargeStValue.Text = data[4] == 0 ? "OFF" : "ON";
lblChargeStValue.ForeColor = data[4] == 0 ? Color.Gray : Color.Orange;
lblChargeStValue.Text = data[5] == 0 ? "OFF" : "ON";
lblChargeStValue.ForeColor = data[5] == 0 ? Color.Gray : Color.Orange;
// CartSt[1]: 0=off, 1=on, 2=unknown
switch (data[5])
switch (data[6])
{
case 0:
lblCartStValue.Text = "없음";
@@ -422,18 +461,14 @@ namespace Test_ACS
lblCartStValue.Text = "있음";
lblCartStValue.ForeColor = Color.Green;
break;
case 2:
lblCartStValue.Text = "알 수 없음";
lblCartStValue.ForeColor = Color.Orange;
break;
default:
lblCartStValue.Text = "오류";
lblCartStValue.Text = "??";
lblCartStValue.ForeColor = Color.Red;
break;
}
// LiftSt[1]: 0=down, 1=up, 2=unknown
switch (data[6])
switch (data[7])
{
case 0:
lblLiftStValue.Text = "하강";
@@ -443,18 +478,13 @@ namespace Test_ACS
lblLiftStValue.Text = "상승";
lblLiftStValue.ForeColor = Color.Green;
break;
case 2:
lblLiftStValue.Text = "알 수 없음";
lblLiftStValue.ForeColor = Color.Orange;
break;
default:
lblLiftStValue.Text = "오류";
lblLiftStValue.Text = "??";
lblLiftStValue.ForeColor = Color.Red;
break;
}
// LastTag[6]: "000000"
string lastTag = Encoding.ASCII.GetString(data, 7, 6);
string lastTag = Encoding.ASCII.GetString(data, 8, 4);
lblLastTagValue.Text = lastTag;
lblLastTagValue.ForeColor = Color.Black;
}
@@ -511,5 +541,18 @@ namespace Test_ACS
}
base.OnFormClosing(e);
}
private void btAMove_Click(object sender, EventArgs e)
{
// Manual: data = TargetID(2 hex) + Direction(1 byte) + Speed(1 byte) + Runtime(1 byte)
var targetID = selectedAGV.ToString("X2");
var Motdirection = (byte)cmbMotDirection.SelectedIndex;
var Magdirection = (byte)cmbMagDirection.SelectedIndex;
var speed = (byte)cmbAutoSpeed.SelectedIndex;
var dataBytes = new byte[] { Motdirection, Magdirection, speed };
var dataStr = targetID + string.Join("", dataBytes.Select(b => b.ToString("X2")));
SendCommand(AGVCommandHE.AutoMove, dataStr);
}
}
}

View File

@@ -117,4 +117,17 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="richTextBox1.Text" xml:space="preserve">
<value>### 기본 패킷 구조
```
[STX][LEN][ID][CMD][DATA][CRC16][ETX]
```
- **STX (Start of Text)**: 0x02
- **LEN (Length)**: 데이터 길이 (1바이트) = {ID+CMD+DATA}
- **ID (Client ID)**: 데이터 길이 (1바이트) : 디바이스식별코드(=DeviceType)
- **CMD (Command)**: 명령어 코드 (1바이트)
- **DATA**: 명령어에 따른 데이터 (가변 길이)
- **CRC16**: 데이터 무결성 검사 (2바이트)
- **ETX (End of Text)**: 0x03</value>
</data>
</root>

View File

@@ -18,7 +18,7 @@
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\..\..\..\..\..\Amkor\AGV4\</OutputPath>
<OutputPath>..\..\..\..\..\..\Amkor\AGV4\Test\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
@@ -36,7 +36,7 @@
</PropertyGroup>
<ItemGroup>
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\..\SubProject\packages\Newtonsoft.Json.13.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
<HintPath>..\..\packages\Newtonsoft.Json.13.0.4\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
@@ -77,6 +77,7 @@
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
<None Include="app.config" />
<None Include="packages.config" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>

View File

@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Newtonsoft.Json" version="13.0.3" targetFramework="net48" />
</packages>
<package id="Newtonsoft.Json" version="13.0.4" targetFramework="net48" />
</packages>

View File

@@ -18,7 +18,7 @@
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\..\..\..\..\..\Amkor\AGV4\</OutputPath>
<OutputPath>..\..\..\..\..\..\Amkor\AGV4\Test\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>

View File

@@ -18,7 +18,7 @@
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\..\..\..\..\..\Amkor\AGV4\</OutputPath>
<OutputPath>..\..\..\..\..\..\Amkor\AGV4\Test\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>

View File

@@ -18,7 +18,7 @@
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\..\..\..\..\..\Amkor\AGV4\</OutputPath>
<OutputPath>..\..\..\..\..\..\Amkor\AGV4\Test\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>