This commit is contained in:
backuppc
2026-02-10 14:53:54 +09:00
parent c2cc5d67ae
commit 471b8ff9c4
18 changed files with 786 additions and 743 deletions

View File

@@ -16,6 +16,34 @@ namespace Project
public partial class fMain
{
private void AGV_TurnComplete(object sender, arDev.Narumi.TurnEventArgs e)
{
//턴작업이완료되었을때 발생된다.
PUB.log.Add($"AGV Turn Complete:{e.Direction}");
//일반노드에서 턴작업이 진행되었다면, 이전경로와 현재경로의 모터 방향을 바꿔준다(일반노드에서만 사용)
if (PUB._virtualAGV.CurrentNode != null && PUB._virtualAGV.CurrentNode.StationType == StationType.Normal)
{
var prevnodeid = PUB._virtualAGV.PrevNode;//.Id;
var currnodeid = PUB._virtualAGV.CurrentNode;//.Id;
//현재 방향과 반대로 모터방향을 셋팅한다. 기존에 Fwd로 왔다면 BWD로 온것으로 처리
var motdir = PUB._virtualAGV.PrevDirection == AgvDirection.Forward ? AgvDirection.Backward : AgvDirection.Forward;
PUB.log.Add($"일반노드에서 TURN 완료({e.Direction}) 이전노드:{prevnodeid.ID2},현재노드:{currnodeid.ID2},이전방향:{PUB._virtualAGV.PrevDirection},변경방향:{motdir}");
//이전노드이동한것으로처리
PUB._mapCanvas.SetAGVPosition(PUB.setting.MCID, prevnodeid, motdir);
PUB._virtualAGV.SetPosition(prevnodeid, motdir);
//현재노드이동한것으로처리
PUB._mapCanvas.SetAGVPosition(PUB.setting.MCID, currnodeid, motdir);
PUB._virtualAGV.SetPosition(currnodeid, motdir);
}
}
private void AGV_Message(object sender, arDev.Narumi.MessageEventArgs e)
{
if (e.MsgType == arDev.NarumiSerialComm.MessageType.Normal)

View File

@@ -166,6 +166,7 @@ namespace Project
PUB.AGV = new arDev.Narumi();
PUB.AGV.Message += AGV_Message;
PUB.AGV.DataReceive += AGV_DataReceive;
PUB.AGV.TurnComplete += AGV_TurnComplete;
//배터리관리시스템
PUB.BMS = new arDev.BMS();
@@ -261,6 +262,7 @@ namespace Project
PUB.AddEEDB("프로그램 시작");
}
void AutoLoadLastPosition()
{
PUB.log.Add("autoload last position");

View File

@@ -13,6 +13,20 @@ namespace arDev
DataType = type;
}
}
public enum eTurnEvent
{
Left=0,
Right
}
public class TurnEventArgs : EventArgs
{
public eTurnEvent Direction { get; set; }
public TurnEventArgs(eTurnEvent data)
{
this.Direction = data;
}
}
}

View File

@@ -71,7 +71,8 @@ namespace arDev
/// 분석완료된 데이터 이벤트
/// </summary>
public event EventHandler<DataEventArgs> DataReceive;
public event EventHandler<TurnEventArgs> TurnComplete;
#endregion

View File

@@ -29,12 +29,7 @@ namespace Test_ACS
this.rbAGV2 = new System.Windows.Forms.RadioButton();
this.rbAGV1 = new System.Windows.Forms.RadioButton();
this.grpCommands = new System.Windows.Forms.GroupBox();
this.button11 = new System.Windows.Forms.Button();
this.button12 = new System.Windows.Forms.Button();
this.btnLiftStop = new System.Windows.Forms.Button();
this.button8 = new System.Windows.Forms.Button();
this.btnLiftDown = new System.Windows.Forms.Button();
this.btnLiftUp = new System.Windows.Forms.Button();
this.button10 = new System.Windows.Forms.Button();
this.button7 = new System.Windows.Forms.Button();
this.button9 = new System.Windows.Forms.Button();
@@ -71,6 +66,11 @@ namespace Test_ACS
this.lblAlias = new System.Windows.Forms.Label();
this.txtRFID = new System.Windows.Forms.NumericUpDown();
this.lblRFID = new System.Windows.Forms.Label();
this.button11 = new System.Windows.Forms.Button();
this.button12 = new System.Windows.Forms.Button();
this.btnLiftStop = new System.Windows.Forms.Button();
this.btnLiftDown = new System.Windows.Forms.Button();
this.btnLiftUp = new System.Windows.Forms.Button();
this.grpLogs = new System.Windows.Forms.GroupBox();
this.tabLogs = new System.Windows.Forms.TabControl();
this.tabRX = new System.Windows.Forms.TabPage();
@@ -245,36 +245,6 @@ namespace Test_ACS
this.grpCommands.TabStop = false;
this.grpCommands.Text = "ACS 명령";
//
// button11
//
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;
this.button11.Text = "전자석 OFF";
this.button11.UseVisualStyleBackColor = true;
this.button11.Click += new System.EventHandler(this.button11_Click);
//
// button12
//
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;
this.button12.Text = "전자석 ON";
this.button12.UseVisualStyleBackColor = true;
this.button12.Click += new System.EventHandler(this.button12_Click);
//
// btnLiftStop
//
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;
this.btnLiftStop.Text = "리프트 정지";
this.btnLiftStop.UseVisualStyleBackColor = true;
this.btnLiftStop.Click += new System.EventHandler(this.btnLiftStop_Click);
//
// button8
//
this.button8.Location = new System.Drawing.Point(102, 264);
@@ -285,26 +255,6 @@ namespace Test_ACS
this.button8.UseVisualStyleBackColor = true;
this.button8.Click += new System.EventHandler(this.button8_Click);
//
// btnLiftDown
//
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;
this.btnLiftDown.Text = "리프트 DN";
this.btnLiftDown.UseVisualStyleBackColor = true;
this.btnLiftDown.Click += new System.EventHandler(this.btnLiftDown_Click);
//
// btnLiftUp
//
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;
this.btnLiftUp.Text = "리프트 UP";
this.btnLiftUp.UseVisualStyleBackColor = true;
this.btnLiftUp.Click += new System.EventHandler(this.btnLiftUp_Click);
//
// button10
//
this.button10.Location = new System.Drawing.Point(102, 229);
@@ -655,12 +605,6 @@ 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, 27);
@@ -706,6 +650,56 @@ namespace Test_ACS
this.lblRFID.TabIndex = 0;
this.lblRFID.Text = "RFID 번호:";
//
// button11
//
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;
this.button11.Text = "전자석 OFF";
this.button11.UseVisualStyleBackColor = true;
this.button11.Click += new System.EventHandler(this.button11_Click);
//
// button12
//
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;
this.button12.Text = "전자석 ON";
this.button12.UseVisualStyleBackColor = true;
this.button12.Click += new System.EventHandler(this.button12_Click);
//
// btnLiftStop
//
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;
this.btnLiftStop.Text = "리프트 정지";
this.btnLiftStop.UseVisualStyleBackColor = true;
this.btnLiftStop.Click += new System.EventHandler(this.btnLiftStop_Click);
//
// btnLiftDown
//
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;
this.btnLiftDown.Text = "리프트 DN";
this.btnLiftDown.UseVisualStyleBackColor = true;
this.btnLiftDown.Click += new System.EventHandler(this.btnLiftDown_Click);
//
// btnLiftUp
//
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;
this.btnLiftUp.Text = "리프트 UP";
this.btnLiftUp.UseVisualStyleBackColor = true;
this.btnLiftUp.Click += new System.EventHandler(this.btnLiftUp_Click);
//
// grpLogs
//
this.grpLogs.Controls.Add(this.tabLogs);

View File

@@ -21,6 +21,22 @@ namespace Test_ACS
InitializeComponent();
InitializeProtocol();
LoadPortList();
txtAlias.Items.Clear();
this.txtAlias.Items.AddRange(new[] {
"LOADER",
"PLATING",
"CLEANER",
"CHARGER",
"BUFFER1",
"BUFFER2",
"BUFFER3",
"BUFFER4",
"BUFFER5",
"BUFFER6",
});
this.txtAlias.Text = "LOADER";
}
@@ -611,19 +627,7 @@ namespace Test_ACS
private void MainForm_Load(object sender, EventArgs e)
{
this.txtAlias.Items.AddRange(new[] {
"LOADER",
"UNLOADER",
"CLEANNER",
"CHARGER1",
"CHARGER2",
"BUFFER1",
"BUFFER2",
"BUFFER3",
"BUFFER4",
"BUFFER5",
"BUFFER6",
});
}
}
}