This commit is contained in:
chi
2025-06-17 17:34:26 +09:00
parent 4aee057726
commit 461a083a06
15 changed files with 614 additions and 165 deletions

View File

@@ -35,58 +35,58 @@ namespace Project
}
}
ePosition ParsePosition(uint tag, out string dirBW)
{
var tagstr = tag.ToString();
var tagno = tagstr.Substring(0, tagstr.Length - 1);
//ePosition ParsePosition(uint tag, out string dirBW)
//{
// var tagstr = tag.ToString();
// var tagno = tagstr.Substring(0, tagstr.Length - 1);
if (tag == PUB.setting.TAGNOT) { dirBW = "0"; return ePosition.NOT; }
// if (tag == PUB.setting.TAGNOT) { dirBW = "0"; return ePosition.NOT; }
else if (tag == PUB.setting.TAG_QA_QC) { dirBW = "0"; return ePosition.QA_QC; }
else if (tag == PUB.setting.TAG_QC_F1) { dirBW = "0"; return ePosition.QC_F1; }
else if (tag == PUB.setting.TAG_F1_F2) { dirBW = "0"; return ePosition.F1_F2; }
else if (tag == PUB.setting.TAG_F2_F3) { dirBW = "0"; return ePosition.F2_F3; }
else if (tag == PUB.setting.TAG_F3_F4) { dirBW = "0"; return ePosition.F3_F4; }
else if (tag == PUB.setting.TAG_F4_F5) { dirBW = "0"; return ePosition.F4_F5; }
// else if (tag == PUB.setting.TAG_QA_QC) { dirBW = "0"; return ePosition.QA_QC; }
// else if (tag == PUB.setting.TAG_QC_F1) { dirBW = "0"; return ePosition.QC_F1; }
// else if (tag == PUB.setting.TAG_F1_F2) { dirBW = "0"; return ePosition.F1_F2; }
// else if (tag == PUB.setting.TAG_F2_F3) { dirBW = "0"; return ePosition.F2_F3; }
// else if (tag == PUB.setting.TAG_F3_F4) { dirBW = "0"; return ePosition.F3_F4; }
// else if (tag == PUB.setting.TAG_F4_F5) { dirBW = "0"; return ePosition.F4_F5; }
else if (tag == PUB.setting.TAGQAB) { dirBW = "0"; return ePosition.QA; }
else if (tag == PUB.setting.TAGQCB) { dirBW = "0"; return ePosition.QC; }
else if (tag == PUB.setting.TAGF1B) { dirBW = "0"; return ePosition.F1; }
else if (tag == PUB.setting.TAGF2B) { dirBW = "0"; return ePosition.F2; }
else if (tag == PUB.setting.TAGF3B) { dirBW = "0"; return ePosition.F3; }
else if (tag == PUB.setting.TAGF4B) { dirBW = "0"; return ePosition.F4; }
else if (tag == PUB.setting.TAGF5B) { dirBW = "0"; return ePosition.F5; }
//else if (tag == PUB.setting.TAGQAA) { dirBW = "1"; return ePosition.QA; }
//else if (tag == PUB.setting.TAGCHA) { dirBW = "1"; return ePosition.CHARGE; }
else if (tag == PUB.setting.TAGQAA) { dirBW = "1"; return ePosition.QA; }
else if (tag == PUB.setting.TAGQCA) { dirBW = "1"; return ePosition.QC; }
else if (tag == PUB.setting.TAGF1A) { dirBW = "1"; return ePosition.F1; }
else if (tag == PUB.setting.TAGF2A) { dirBW = "1"; return ePosition.F2; }
else if (tag == PUB.setting.TAGF3A) { dirBW = "1"; return ePosition.F3; }
else if (tag == PUB.setting.TAGF4A) { dirBW = "1"; return ePosition.F4; }
else if (tag == PUB.setting.TAGF5A) { dirBW = "1"; return ePosition.F5; }
else if (tag == PUB.setting.TAGPOT) { dirBW = "0"; return ePosition.POT; }
else
{
if (tag > 9350 && tag < 9400)
{
dirBW = "0"; return ePosition.QC_F1;
}
else if (tag > 9250 && tag < 9300)
{
dirBW = "0"; return ePosition.QA_QC;
}
else if (tag > 9000 && tag < 9100)
{
dirBW = "0"; return ePosition.NOT;
}
else
{
dirBW = "0"; return ePosition.NONE;
}
// else if (tag == PUB.setting.TAGQAB) { dirBW = "0"; return ePosition.QA; }
// else if (tag == PUB.setting.TAGQCB) { dirBW = "0"; return ePosition.QC; }
// else if (tag == PUB.setting.TAGF1B) { dirBW = "0"; return ePosition.F1; }
// else if (tag == PUB.setting.TAGF2B) { dirBW = "0"; return ePosition.F2; }
// else if (tag == PUB.setting.TAGF3B) { dirBW = "0"; return ePosition.F3; }
// else if (tag == PUB.setting.TAGF4B) { dirBW = "0"; return ePosition.F4; }
// else if (tag == PUB.setting.TAGF5B) { dirBW = "0"; return ePosition.F5; }
// //else if (tag == PUB.setting.TAGQAA) { dirBW = "1"; return ePosition.QA; }
// //else if (tag == PUB.setting.TAGCHA) { dirBW = "1"; return ePosition.CHARGE; }
// else if (tag == PUB.setting.TAGQAA) { dirBW = "1"; return ePosition.QA; }
// else if (tag == PUB.setting.TAGQCA) { dirBW = "1"; return ePosition.QC; }
// else if (tag == PUB.setting.TAGF1A) { dirBW = "1"; return ePosition.F1; }
// else if (tag == PUB.setting.TAGF2A) { dirBW = "1"; return ePosition.F2; }
// else if (tag == PUB.setting.TAGF3A) { dirBW = "1"; return ePosition.F3; }
// else if (tag == PUB.setting.TAGF4A) { dirBW = "1"; return ePosition.F4; }
// else if (tag == PUB.setting.TAGF5A) { dirBW = "1"; return ePosition.F5; }
// else if (tag == PUB.setting.TAGPOT) { dirBW = "0"; return ePosition.POT; }
// else
// {
// if (tag > 9350 && tag < 9400)
// {
// dirBW = "0"; return ePosition.QC_F1;
// }
// else if (tag > 9250 && tag < 9300)
// {
// dirBW = "0"; return ePosition.QA_QC;
// }
// else if (tag > 9000 && tag < 9100)
// {
// dirBW = "0"; return ePosition.NOT;
// }
// else
// {
// dirBW = "0"; return ePosition.NONE;
// }
}
}
// }
//}
bool _charging = false;
@@ -196,51 +196,53 @@ namespace Project
case arDev.Narumi.DataType.TAG:
{
//자동 실행 중이다.
PUB.log.Add($"RFID값에서 위치정보를 추출할 수 있도록 해야한다");
PUB.log.Add($"AGV 태그수신 : {PUB.AGV.data.TagNo}");
PUB.Result.LastTAG = PUB.AGV.data.TagNo.ToString();
var curpos = ParsePosition(PUB.AGV.data.TagNo, out string dirForward);
if (curpos != PUB.Result.CurrentPos)
{
PUB.log.Add($"현재위치변경 {PUB.Result.CurrentPos} -> {curpos}");
PUB.Result.CurrentPos = curpos;
}
PUB.Result.CurrentPosCW = dirForward;
ctlPos1.SetPositionDeActive();
ctlPos1.SetPosition(PUB.Result.CurrentPos);
ctlPos1.SetDirection(dirForward);
ctlPos1.Invalidate();
//pot not를 보면 일단 바로 멈추게한다
//POT/NOT 보면 일단 바로 멈추게한다
if (PUB.Result.CurrentPos == ePosition.POT || PUB.Result.CurrentPos == ePosition.NOT)
{
PUB.AGV.AGVMoveStop("TAG:pot/not 발견으로 즉시 멈춤");
var logEMsg = $"Stop by [POT/NOT]";
PUB.AGV.AGVMoveStop(logEMsg);
PUB.log.AddE(logEMsg);
}
//자동, 상하차 모드일때 RFID 가 타겟위치에 올때는 - 멈춤을 설정해준
if (VAR.BOOL[eVarBool.FLAG_AUTORUN] == true &&
PUB.Result.CurrentPos == PUB.Result.TargetPos &&
PUB.Result.TargetPos != ePosition.NONE &&
(PUB.sm.RunStep == ERunStep.GODOWN ||
PUB.sm.RunStep == ERunStep.GOUP ||
PUB.sm.RunStep == ERunStep.GOHOME ||
PUB.sm.RunStep == ERunStep.GOCHARGE))
//맵데이터에서 현재 위치를 찾는
if (PUB.mapctl.SetCurrentPosition(PUB.AGV.data.TagNo) == false)
{
if (PUB.AGV.data.Sts == 'F' && dirForward == "0") //아래로 내려오고있음
{
PUB.AGV.AGVMoveStop("AGV_DataReceive", arDev.Narumi.eStopOpt.MarkStop);
PUB.Speak( Lang.);
}
else if (PUB.AGV.data.Sts == 'B' && dirForward == "1")
{
//VAR.BOOL[eVarBool.FLAG_NEXTSTOP_MARK] = true;
PUB.AGV.AGVMoveStop("AGV_DataReceive", arDev.Narumi.eStopOpt.MarkStop);
PUB.Speak(Lang.);
}
if (VAR.BOOL[eVarBool.FLAG_AUTORUN] && PUB.AGV.system1.agv_run)
PUB.AGV.AGVMoveStop("unknown tag no");
//존재하지 않는 태그가 읽히면 관련 오류를 표시한다.
}
else
{
//위치는 찾았다 해당 위치가 내 목적지라면 mark stop기능으로 전환한다
}
////자동, 상하차 모드일때 RFID 가 타겟위치에 올때는 - 멈춤을 설정해준다
//if (VAR.BOOL[eVarBool.FLAG_AUTORUN] == true &&
// PUB.Result.CurrentPos == PUB.Result.TargetPos &&
// PUB.Result.TargetPos != ePosition.NONE &&
// (PUB.sm.RunStep == ERunStep.GODOWN ||
// PUB.sm.RunStep == ERunStep.GOUP ||
// PUB.sm.RunStep == ERunStep.GOHOME ||
// PUB.sm.RunStep == ERunStep.GOCHARGE))
//{
// if (PUB.AGV.data.Sts == 'F' && dirForward == "0") //아래로 내려오고있음
// {
// PUB.AGV.AGVMoveStop("AGV_DataReceive", arDev.Narumi.eStopOpt.MarkStop);
// PUB.Speak( Lang.다음마크위치에서정지합니다);
// }
// else if (PUB.AGV.data.Sts == 'B' && dirForward == "1")
// {
// //VAR.BOOL[eVarBool.FLAG_NEXTSTOP_MARK] = true;
// PUB.AGV.AGVMoveStop("AGV_DataReceive", arDev.Narumi.eStopOpt.MarkStop);
// PUB.Speak(Lang.다음마크위치에서정지합니다);
// }
//}
}
break;

View File

@@ -158,7 +158,7 @@ namespace Project
private void Bms_BMSDataReceive(object sender, EventArgs e)
{
PUB.mapctl.agv.BatteryLevel = PUB.BMS.Current_Level;
if (PUB.BMS.Current_Level <= PUB.setting.ChargeStartLevel)
{
//배터리 레벨이 기준보다 낮다면 경고를 활성화 한다

View File

@@ -34,8 +34,10 @@
this.richTextBox2 = new System.Windows.Forms.RichTextBox();
this.richTextBox3 = new System.Windows.Forms.RichTextBox();
this.richTextBox4 = new System.Windows.Forms.RichTextBox();
this.label1 = new System.Windows.Forms.Label();
this.timer1 = new System.Windows.Forms.Timer(this.components);
this.panel1 = new System.Windows.Forms.Panel();
this.lbIP = new System.Windows.Forms.Label();
this.button7 = new System.Windows.Forms.Button();
this.button6 = new System.Windows.Forms.Button();
this.button5 = new System.Windows.Forms.Button();
@@ -44,7 +46,6 @@
this.button1 = new System.Windows.Forms.Button();
this.button8 = new System.Windows.Forms.Button();
this.button4 = new System.Windows.Forms.Button();
this.label1 = new System.Windows.Forms.Label();
this.tableLayoutPanel1.SuspendLayout();
this.panel1.SuspendLayout();
this.SuspendLayout();
@@ -111,6 +112,18 @@
this.richTextBox4.TabIndex = 1;
this.richTextBox4.Text = "";
//
// label1
//
this.tableLayoutPanel1.SetColumnSpan(this.label1, 2);
this.label1.Dock = System.Windows.Forms.DockStyle.Fill;
this.label1.ForeColor = System.Drawing.Color.White;
this.label1.Location = new System.Drawing.Point(3, 460);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(518, 50);
this.label1.TabIndex = 2;
this.label1.Text = "label1";
this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// timer1
//
this.timer1.Interval = 200;
@@ -118,6 +131,7 @@
//
// panel1
//
this.panel1.Controls.Add(this.lbIP);
this.panel1.Controls.Add(this.button7);
this.panel1.Controls.Add(this.button6);
this.panel1.Controls.Add(this.button5);
@@ -132,6 +146,18 @@
this.panel1.Size = new System.Drawing.Size(1050, 67);
this.panel1.TabIndex = 7;
//
// lbIP
//
this.lbIP.Dock = System.Windows.Forms.DockStyle.Fill;
this.lbIP.Font = new System.Drawing.Font("Tahoma", 20F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(129)));
this.lbIP.ForeColor = System.Drawing.Color.White;
this.lbIP.Location = new System.Drawing.Point(300, 0);
this.lbIP.Name = "lbIP";
this.lbIP.Size = new System.Drawing.Size(250, 67);
this.lbIP.TabIndex = 8;
this.lbIP.Text = "000.000.000.000";
this.lbIP.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// button7
//
this.button7.Dock = System.Windows.Forms.DockStyle.Right;
@@ -220,18 +246,6 @@
this.button4.UseVisualStyleBackColor = true;
this.button4.Click += new System.EventHandler(this.button4_Click);
//
// label1
//
this.tableLayoutPanel1.SetColumnSpan(this.label1, 2);
this.label1.Dock = System.Windows.Forms.DockStyle.Fill;
this.label1.ForeColor = System.Drawing.Color.White;
this.label1.Location = new System.Drawing.Point(3, 460);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(518, 50);
this.label1.TabIndex = 2;
this.label1.Text = "label1";
this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// fAgv
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
@@ -269,5 +283,6 @@
private System.Windows.Forms.Button button7;
private System.Windows.Forms.Button button8;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label lbIP;
}
}

View File

@@ -35,6 +35,7 @@ namespace Project.ViewForm
private void timer1_Tick(object sender, EventArgs e)
{
timer1.Stop();
lbIP.Text = PUB.IP;
label1.Text = PUB.AGV.LastSTS;
richTextBox1.Text = PUB.AGV.system0.ToString();
richTextBox2.Text = PUB.AGV.system1.ToString();

View File

@@ -70,13 +70,12 @@ namespace Project.ViewForm
}
private void AGV_DataReceive(object sender, arDev.Narumi.DataEventArgs e)
{
switch (e.DataType)
{
case arDev.Narumi.DataType.TAG:
var tagno = PUB.AGV.data.TagNo;
PUB.log.Add($"[auto] recv tag : {tagno}");
PUB.mapctl.SetCurrentPosition(tagno);
//_AGV 파일에서 위치조정을 함
//var tagno = PUB.AGV.data.TagNo;
//PUB.mapctl.SetCurrentPosition(tagno);
break;
}
}

View File

@@ -484,6 +484,7 @@
this.tbagvchannel.Name = "tbagvchannel";
this.tbagvchannel.Size = new System.Drawing.Size(164, 54);
this.tbagvchannel.TabIndex = 77;
this.tbagvchannel.Click += new System.EventHandler(this.tbagvaddr_Click);
//
// tbagvpanid
//
@@ -492,6 +493,7 @@
this.tbagvpanid.Name = "tbagvpanid";
this.tbagvpanid.Size = new System.Drawing.Size(164, 54);
this.tbagvpanid.TabIndex = 76;
this.tbagvpanid.Click += new System.EventHandler(this.tbagvaddr_Click);
//
// tbagvaddr
//
@@ -500,6 +502,7 @@
this.tbagvaddr.Name = "tbagvaddr";
this.tbagvaddr.Size = new System.Drawing.Size(164, 54);
this.tbagvaddr.TabIndex = 75;
this.tbagvaddr.Click += new System.EventHandler(this.tbagvaddr_Click);
//
// button7
//

View File

@@ -662,5 +662,14 @@ namespace Project
}
private void tbagvaddr_Click(object sender, EventArgs e)
{
var tb = sender as TextBox;
var rlt = UTIL.InputBox("input vlaue", tb.Text);
if (rlt.Item1 == false) return;
if (rlt.Item2.isEmpty()) return;
tb.Text = rlt.Item2;
}
}
}