From ddaab0b5daacaea8ac586f4c7c108a779bbb249f Mon Sep 17 00:00:00 2001 From: ChiKyun Kim Date: Thu, 5 Feb 2026 17:18:01 +0900 Subject: [PATCH] =?UTF-8?q?acs=20test=20=ED=94=84=EB=A1=9C=EA=B7=B8?= =?UTF-8?q?=EB=9E=A8=EC=97=90=20pick=20on=20,off=20=EA=B8=B0=EB=8A=A5=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 1 + AGVEmulator/AGVEmulator.csproj | 8 +- .../StateMachine/Step/_SM_RUN_BUFFER_IN.cs | 17 ++- .../StateMachine/Step/_SM_RUN_BUFFER_OUT.cs | 1 + .../StateMachine/Step/_SM_RUN_ENTER.cs | 1 + HMI/Project/StateMachine/Step/_SM_RUN_EXIT.cs | 1 + .../StateMachine/Step/_SM_RUN_READY.cs | 20 +-- HMI/Project/StateMachine/_Xbee.cs | 2 +- HMI/Project/ViewForm/fAgv.cs | 1 + HMI/Project/ViewForm/fIO.cs | 1 + HMI/Project/ViewForm/fManual.cs | 1 + HMI/TestProject/Test_ACS/MainForm.Designer.cs | 116 +++++++++++++----- HMI/TestProject/Test_ACS/MainForm.cs | 56 ++++++++- 13 files changed, 174 insertions(+), 52 deletions(-) diff --git a/.gitignore b/.gitignore index 13707d7..dcab291 100644 --- a/.gitignore +++ b/.gitignore @@ -15,3 +15,4 @@ packages *.bak /Cs_HMI/Data/*.agvmap /Cs_HMI/AGVLogic/AGVMapEditor/Data/*.agvmap +/Document/~$PICkit 프로그램 다운로드 매뉴얼.pptx diff --git a/AGVEmulator/AGVEmulator.csproj b/AGVEmulator/AGVEmulator.csproj index 9465bf3..b112284 100644 --- a/AGVEmulator/AGVEmulator.csproj +++ b/AGVEmulator/AGVEmulator.csproj @@ -70,15 +70,11 @@ - - Form - + Form - - Form - + UserControl diff --git a/HMI/Project/StateMachine/Step/_SM_RUN_BUFFER_IN.cs b/HMI/Project/StateMachine/Step/_SM_RUN_BUFFER_IN.cs index 60a81d1..0b69f12 100644 --- a/HMI/Project/StateMachine/Step/_SM_RUN_BUFFER_IN.cs +++ b/HMI/Project/StateMachine/Step/_SM_RUN_BUFFER_IN.cs @@ -9,6 +9,7 @@ using AR; using System.Windows.Media.Animation; using System.Net.Security; using AGVNavigationCore.Models; +using static arDev.Narumi; namespace Project { @@ -56,7 +57,21 @@ namespace Project } else if (PUB.sm.RunStepSeq == idx++) { - //모션 전후진 제어 + //라이다끄기 + var ret = PUB.AGV.AGVMoveSet(new arDev.Narumi.BunkiData + { + Bunki = arDev.Narumi.eBunki.Strate, + Direction = arDev.Narumi.eMoveDir.Backward, + PBSSensor = 0, //라이다를끈다 + Speed = arDev.Narumi.eMoveSpd.Low, + }); + PUB.log.AddAT("라이다를 끈다, 재시도 코드 필요함"); + PUB.sm.UpdateRunStepSeq(); + return false; + } + else if (PUB.sm.RunStepSeq == idx++) + { + //턴확인 if (PUB._virtualAGV.Turn != AGVNavigationCore.Models.AGVTurn.L90) { //동작중이면 동작을 멈춘다 diff --git a/HMI/Project/StateMachine/Step/_SM_RUN_BUFFER_OUT.cs b/HMI/Project/StateMachine/Step/_SM_RUN_BUFFER_OUT.cs index f39eb19..117b26e 100644 --- a/HMI/Project/StateMachine/Step/_SM_RUN_BUFFER_OUT.cs +++ b/HMI/Project/StateMachine/Step/_SM_RUN_BUFFER_OUT.cs @@ -7,6 +7,7 @@ using Project.StateMachine; using COMM; using AR; using AGVNavigationCore.Models; +using static arDev.Narumi; namespace Project { diff --git a/HMI/Project/StateMachine/Step/_SM_RUN_ENTER.cs b/HMI/Project/StateMachine/Step/_SM_RUN_ENTER.cs index 58d9d82..ff8aa1e 100644 --- a/HMI/Project/StateMachine/Step/_SM_RUN_ENTER.cs +++ b/HMI/Project/StateMachine/Step/_SM_RUN_ENTER.cs @@ -7,6 +7,7 @@ using Project.StateMachine; using COMM; using AR; using AGVNavigationCore.Models; +using static arDev.Narumi; namespace Project { diff --git a/HMI/Project/StateMachine/Step/_SM_RUN_EXIT.cs b/HMI/Project/StateMachine/Step/_SM_RUN_EXIT.cs index a3ca7b6..0480bbd 100644 --- a/HMI/Project/StateMachine/Step/_SM_RUN_EXIT.cs +++ b/HMI/Project/StateMachine/Step/_SM_RUN_EXIT.cs @@ -7,6 +7,7 @@ using Project.StateMachine; using COMM; using AR; using AGVNavigationCore.Models; +using static arDev.Narumi; namespace Project { diff --git a/HMI/Project/StateMachine/Step/_SM_RUN_READY.cs b/HMI/Project/StateMachine/Step/_SM_RUN_READY.cs index 93e1db7..7d64044 100644 --- a/HMI/Project/StateMachine/Step/_SM_RUN_READY.cs +++ b/HMI/Project/StateMachine/Step/_SM_RUN_READY.cs @@ -59,16 +59,16 @@ namespace Project } //대기모드에서는 움직이지 않게 한다 - if(PUB.AGV.system1.agv_run) - { - var ts = VAR.TIME.RUN(eVarTime.IdleStopTime); - if(ts.TotalSeconds > 1) - { - PUB.log.Add($"대기상태에서는 정차"); - PUB.AGV.AGVMoveStop("대기상태에서는 정차"); - VAR.TIME.Update(eVarTime.IdleStopTime); - } - } + //if(PUB.AGV.system1.agv_run) + //{ + // var ts = VAR.TIME.RUN(eVarTime.IdleStopTime); + // if(ts.TotalSeconds > 1) + // { + // PUB.log.Add($"대기상태에서는 정차"); + // PUB.AGV.AGVMoveStop("대기상태에서는 정차"); + // VAR.TIME.Update(eVarTime.IdleStopTime); + // } + //} return false; diff --git a/HMI/Project/StateMachine/_Xbee.cs b/HMI/Project/StateMachine/_Xbee.cs index 3a55e46..6f8618d 100644 --- a/HMI/Project/StateMachine/_Xbee.cs +++ b/HMI/Project/StateMachine/_Xbee.cs @@ -354,7 +354,7 @@ namespace Project break; case ENIGProtocol.AGVCommandHE.LiftControl: //Lift Control - var LiftCommand = (LiftCommand)data[1]; + var LiftCommand = ( arDev.Narumi.LiftCommand)data[1]; PUB.log.Add($"[{logPrefix}-LiftControl] {LiftCommand}"); PUB.AGV.LiftControl(LiftCommand); //리프트제어 break; diff --git a/HMI/Project/ViewForm/fAgv.cs b/HMI/Project/ViewForm/fAgv.cs index c261231..9215caf 100644 --- a/HMI/Project/ViewForm/fAgv.cs +++ b/HMI/Project/ViewForm/fAgv.cs @@ -9,6 +9,7 @@ using System.Threading.Tasks; using System.Windows.Forms; using AGVNavigationCore.Models; using COMM; +using static arDev.Narumi; namespace Project.ViewForm { diff --git a/HMI/Project/ViewForm/fIO.cs b/HMI/Project/ViewForm/fIO.cs index 109b6c7..0a50bd1 100644 --- a/HMI/Project/ViewForm/fIO.cs +++ b/HMI/Project/ViewForm/fIO.cs @@ -8,6 +8,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; +using static arDev.Narumi; namespace Project.ViewForm { diff --git a/HMI/Project/ViewForm/fManual.cs b/HMI/Project/ViewForm/fManual.cs index 93a9255..2e3eae3 100644 --- a/HMI/Project/ViewForm/fManual.cs +++ b/HMI/Project/ViewForm/fManual.cs @@ -11,6 +11,7 @@ using AGVNavigationCore.Models; using AR; using arDev; using COMM; +using static arDev.Narumi; namespace Project.ViewForm { diff --git a/HMI/TestProject/Test_ACS/MainForm.Designer.cs b/HMI/TestProject/Test_ACS/MainForm.Designer.cs index 9e8b9e9..c573442 100644 --- a/HMI/TestProject/Test_ACS/MainForm.Designer.cs +++ b/HMI/TestProject/Test_ACS/MainForm.Designer.cs @@ -67,7 +67,7 @@ namespace Test_ACS this.btnGotoAlias = new System.Windows.Forms.Button(); this.btnGoto = new System.Windows.Forms.Button(); this.btnSetCurrent = new System.Windows.Forms.Button(); - this.txtAlias = new System.Windows.Forms.TextBox(); + this.txtAlias = new System.Windows.Forms.ComboBox(); this.lblAlias = new System.Windows.Forms.Label(); this.txtRFID = new System.Windows.Forms.NumericUpDown(); this.lblRFID = new System.Windows.Forms.Label(); @@ -84,10 +84,14 @@ namespace Test_ACS this.tabPage1 = new System.Windows.Forms.TabPage(); this.richTextBox1 = new System.Windows.Forms.RichTextBox(); this.grpAGVStatus = new System.Windows.Forms.GroupBox(); - this.groupBox3 = new System.Windows.Forms.GroupBox(); this.rtStatus = new System.Windows.Forms.TextBox(); + this.groupBox3 = new System.Windows.Forms.GroupBox(); this.tbErCode = new System.Windows.Forms.TextBox(); this.tbErmsg = new System.Windows.Forms.TextBox(); + this.button13 = new System.Windows.Forms.Button(); + this.button14 = new System.Windows.Forms.Button(); + this.button15 = new System.Windows.Forms.Button(); + this.button16 = new System.Windows.Forms.Button(); this.grpConnection.SuspendLayout(); this.grpAGV.SuspendLayout(); this.grpCommands.SuspendLayout(); @@ -218,12 +222,7 @@ namespace Test_ACS // // grpCommands // - this.grpCommands.Controls.Add(this.button11); - this.grpCommands.Controls.Add(this.button12); - this.grpCommands.Controls.Add(this.btnLiftStop); this.grpCommands.Controls.Add(this.button8); - this.grpCommands.Controls.Add(this.btnLiftDown); - this.grpCommands.Controls.Add(this.btnLiftUp); this.grpCommands.Controls.Add(this.button10); this.grpCommands.Controls.Add(this.button7); this.grpCommands.Controls.Add(this.button9); @@ -241,14 +240,14 @@ namespace Test_ACS this.grpCommands.Controls.Add(this.lblRFID); this.grpCommands.Location = new System.Drawing.Point(12, 98); this.grpCommands.Name = "grpCommands"; - this.grpCommands.Size = new System.Drawing.Size(535, 307); + this.grpCommands.Size = new System.Drawing.Size(433, 307); this.grpCommands.TabIndex = 2; this.grpCommands.TabStop = false; this.grpCommands.Text = "ACS 명령"; // // button11 // - this.button11.Location = new System.Drawing.Point(431, 198); + this.button11.Location = new System.Drawing.Point(451, 200); this.button11.Name = "button11"; this.button11.Size = new System.Drawing.Size(100, 43); this.button11.TabIndex = 18; @@ -258,7 +257,7 @@ namespace Test_ACS // // button12 // - this.button12.Location = new System.Drawing.Point(431, 153); + this.button12.Location = new System.Drawing.Point(451, 155); this.button12.Name = "button12"; this.button12.Size = new System.Drawing.Size(100, 43); this.button12.TabIndex = 17; @@ -268,7 +267,7 @@ namespace Test_ACS // // btnLiftStop // - this.btnLiftStop.Location = new System.Drawing.Point(431, 108); + this.btnLiftStop.Location = new System.Drawing.Point(451, 110); this.btnLiftStop.Name = "btnLiftStop"; this.btnLiftStop.Size = new System.Drawing.Size(100, 43); this.btnLiftStop.TabIndex = 2; @@ -288,7 +287,7 @@ namespace Test_ACS // // btnLiftDown // - this.btnLiftDown.Location = new System.Drawing.Point(431, 63); + this.btnLiftDown.Location = new System.Drawing.Point(451, 65); this.btnLiftDown.Name = "btnLiftDown"; this.btnLiftDown.Size = new System.Drawing.Size(100, 43); this.btnLiftDown.TabIndex = 1; @@ -298,7 +297,7 @@ namespace Test_ACS // // btnLiftUp // - this.btnLiftUp.Location = new System.Drawing.Point(431, 18); + this.btnLiftUp.Location = new System.Drawing.Point(451, 20); this.btnLiftUp.Name = "btnLiftUp"; this.btnLiftUp.Size = new System.Drawing.Size(100, 43); this.btnLiftUp.TabIndex = 0; @@ -656,12 +655,17 @@ namespace Test_ACS // txtAlias // this.txtAlias.Font = new System.Drawing.Font("Consolas", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.txtAlias.Items.AddRange(new object[] { + "LOADER", + "UNLOADER", + "CLEANNER", + "CHARGER1", + "CHARGER2"}); this.txtAlias.Location = new System.Drawing.Point(86, 49); this.txtAlias.Name = "txtAlias"; - this.txtAlias.Size = new System.Drawing.Size(101, 26); + this.txtAlias.Size = new System.Drawing.Size(101, 27); this.txtAlias.TabIndex = 10; this.txtAlias.Text = "CHARGER1"; - this.txtAlias.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; this.txtAlias.TextChanged += new System.EventHandler(this.txtAlias_TextChanged); // // lblAlias @@ -848,11 +852,23 @@ namespace Test_ACS this.grpAGVStatus.Controls.Add(this.rtStatus); this.grpAGVStatus.Location = new System.Drawing.Point(12, 409); this.grpAGVStatus.Name = "grpAGVStatus"; - this.grpAGVStatus.Size = new System.Drawing.Size(535, 120); + this.grpAGVStatus.Size = new System.Drawing.Size(426, 120); this.grpAGVStatus.TabIndex = 4; this.grpAGVStatus.TabStop = false; this.grpAGVStatus.Text = "AGV 상태"; // + // rtStatus + // + this.rtStatus.Dock = System.Windows.Forms.DockStyle.Fill; + this.rtStatus.Font = new System.Drawing.Font("Consolas", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.rtStatus.Location = new System.Drawing.Point(3, 17); + this.rtStatus.Multiline = true; + this.rtStatus.Name = "rtStatus"; + this.rtStatus.ReadOnly = true; + this.rtStatus.ScrollBars = System.Windows.Forms.ScrollBars.Vertical; + this.rtStatus.Size = new System.Drawing.Size(420, 100); + this.rtStatus.TabIndex = 1; + // // groupBox3 // this.groupBox3.Controls.Add(this.tbErCode); @@ -864,18 +880,6 @@ namespace Test_ACS this.groupBox3.TabStop = false; this.groupBox3.Text = "Error 상태"; // - // rtStatus - // - this.rtStatus.Dock = System.Windows.Forms.DockStyle.Fill; - this.rtStatus.Font = new System.Drawing.Font("Consolas", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.rtStatus.Location = new System.Drawing.Point(3, 17); - this.rtStatus.Multiline = true; - this.rtStatus.Name = "rtStatus"; - this.rtStatus.ReadOnly = true; - this.rtStatus.ScrollBars = System.Windows.Forms.ScrollBars.Vertical; - this.rtStatus.Size = new System.Drawing.Size(529, 100); - this.rtStatus.TabIndex = 1; - // // tbErCode // this.tbErCode.Location = new System.Drawing.Point(6, 20); @@ -890,22 +894,72 @@ namespace Test_ACS this.tbErmsg.Size = new System.Drawing.Size(523, 21); this.tbErmsg.TabIndex = 2; // + // button13 + // + this.button13.Location = new System.Drawing.Point(447, 476); + this.button13.Name = "button13"; + this.button13.Size = new System.Drawing.Size(100, 43); + this.button13.TabIndex = 22; + this.button13.Text = "Exit\r\nPick Off"; + this.button13.UseVisualStyleBackColor = true; + this.button13.Click += new System.EventHandler(this.button13_Click); + // + // button14 + // + this.button14.Location = new System.Drawing.Point(447, 431); + this.button14.Name = "button14"; + this.button14.Size = new System.Drawing.Size(100, 43); + this.button14.TabIndex = 21; + this.button14.Text = "Exit\r\nPick On"; + this.button14.UseVisualStyleBackColor = true; + this.button14.Click += new System.EventHandler(this.button14_Click); + // + // button15 + // + this.button15.Location = new System.Drawing.Point(447, 386); + this.button15.Name = "button15"; + this.button15.Size = new System.Drawing.Size(100, 43); + this.button15.TabIndex = 20; + this.button15.Text = "Enter\r\nPick Off"; + this.button15.UseVisualStyleBackColor = true; + this.button15.Click += new System.EventHandler(this.button15_Click); + // + // button16 + // + this.button16.Location = new System.Drawing.Point(447, 341); + this.button16.Name = "button16"; + this.button16.Size = new System.Drawing.Size(100, 43); + this.button16.TabIndex = 19; + this.button16.Text = "Enter\r\nPick On"; + this.button16.UseVisualStyleBackColor = true; + this.button16.Click += new System.EventHandler(this.button16_Click); + // // MainForm // this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(1083, 621); + this.Controls.Add(this.button13); + this.Controls.Add(this.button14); + this.Controls.Add(this.button15); + this.Controls.Add(this.button16); + this.Controls.Add(this.button11); this.Controls.Add(this.groupBox3); + this.Controls.Add(this.button12); this.Controls.Add(this.grpAGVStatus); + this.Controls.Add(this.btnLiftStop); this.Controls.Add(this.grpLogs); this.Controls.Add(this.grpCommands); + this.Controls.Add(this.btnLiftDown); this.Controls.Add(this.grpAGV); + this.Controls.Add(this.btnLiftUp); this.Controls.Add(this.grpConnection); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; this.MaximizeBox = false; this.Name = "MainForm"; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; this.Text = "ACS 시뮬레이터 - ENIG AGV 테스트"; + this.Load += new System.EventHandler(this.MainForm_Load); this.grpConnection.ResumeLayout(false); this.grpConnection.PerformLayout(); this.grpAGV.ResumeLayout(false); @@ -971,7 +1025,7 @@ namespace Test_ACS private System.Windows.Forms.TextBox txtInfoLog; private System.Windows.Forms.Button btnRefresh; private System.Windows.Forms.Button btnGotoAlias; - private System.Windows.Forms.TextBox txtAlias; + private System.Windows.Forms.ComboBox txtAlias; private System.Windows.Forms.Label lblAlias; private System.Windows.Forms.GroupBox grpAGVStatus; private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1; @@ -1011,5 +1065,9 @@ namespace Test_ACS private System.Windows.Forms.TextBox rtStatus; private System.Windows.Forms.TextBox tbErCode; private System.Windows.Forms.TextBox tbErmsg; + private System.Windows.Forms.Button button13; + private System.Windows.Forms.Button button14; + private System.Windows.Forms.Button button15; + private System.Windows.Forms.Button button16; } } diff --git a/HMI/TestProject/Test_ACS/MainForm.cs b/HMI/TestProject/Test_ACS/MainForm.cs index a458649..bb63671 100644 --- a/HMI/TestProject/Test_ACS/MainForm.cs +++ b/HMI/TestProject/Test_ACS/MainForm.cs @@ -324,20 +324,20 @@ namespace Test_ACS private void btnLiftUp_Click(object sender, EventArgs e) { - SendLiftCommand( arDev.Narumi.LiftCommand.UP); // Up + SendLiftCommand(arDev.Narumi.LiftCommand.UP); // Up } private void btnLiftDown_Click(object sender, EventArgs e) { - SendLiftCommand( arDev.Narumi.LiftCommand.DN); // Down + SendLiftCommand(arDev.Narumi.LiftCommand.DN); // Down } private void btnLiftStop_Click(object sender, EventArgs e) { - SendLiftCommand( arDev.Narumi.LiftCommand.STP); // Stop + SendLiftCommand(arDev.Narumi.LiftCommand.STP); // Stop } - + private void SendLiftCommand(arDev.Narumi.LiftCommand liftCmd) { // LiftControl: data = TargetID(2 hex) + LiftCommand(1 byte) @@ -511,7 +511,7 @@ namespace Test_ACS byte lidar = 2; if (radLidarOff.Checked) lidar = 0; - var dataBytes = new byte[] { Motdirection, Magdirection, speed ,lidar}; + var dataBytes = new byte[] { Motdirection, Magdirection, speed, lidar }; var dataStr = targetID + string.Join("", dataBytes.Select(b => b.ToString("X2"))); SendCommand(AGVCommandHE.AutoMove, dataStr); } @@ -579,5 +579,51 @@ namespace Test_ACS { SendLiftCommand(arDev.Narumi.LiftCommand.OFF); } + + private void button16_Click(object sender, EventArgs e) + { + //enter pickon + var targetID = selectedAGV.ToString("X2"); + var dataStr = targetID;// + liftCmd.ToString("X2"); + SendCommand(AGVCommandHE.PickOnEnter, dataStr); + } + + private void button15_Click(object sender, EventArgs e) + { + //enter pickoff + var targetID = selectedAGV.ToString("X2"); + SendCommand(AGVCommandHE.PickOffEnter, targetID); + } + + private void button14_Click(object sender, EventArgs e) + { + //exit pickon + var targetID = selectedAGV.ToString("X2"); + SendCommand(AGVCommandHE.PickOnExit, targetID); + } + + private void button13_Click(object sender, EventArgs e) + { + //exit pickoff + var targetID = selectedAGV.ToString("X2"); + SendCommand(AGVCommandHE.PickOffExit, targetID); + } + + private void MainForm_Load(object sender, EventArgs e) + { + this.txtAlias.Items.AddRange(new[] { + "LOADER", + "UNLOADER", + "CLEANNER", + "CHARGER1", + "CHARGER2", + "BUFFER1", + "BUFFER2", + "BUFFER3", + "BUFFER4", + "BUFFER5", + "BUFFER6", + }); + } } }