From ddf0b1907de85b5d50cf7121ca88d7122038483a Mon Sep 17 00:00:00 2001 From: chi Date: Tue, 27 May 2025 16:32:53 +0900 Subject: [PATCH] ... --- Cs_HMI/Project/StateMachine/_Xbee.cs | 31 +- Cs_HMI/Project/ViewForm/fAuto.cs | 4 +- Cs_HMI/SubProject/AGVControl/MapControl.cs | 256 ++++++------ .../SubProject/AGVControl/Models/MapText.cs | 57 ++- .../SubProject/AGVControl/Models/RFIDLine.cs | 26 +- .../SubProject/AGVControl/Models/RFIDPoint.cs | 1 + Emulator/AGVEmulator/DevXBE.cs | 14 +- Emulator/AGVEmulator/Form1.Designer.cs | 373 ++++++++++-------- Emulator/AGVEmulator/Form1.cs | 6 +- 9 files changed, 453 insertions(+), 315 deletions(-) diff --git a/Cs_HMI/Project/StateMachine/_Xbee.cs b/Cs_HMI/Project/StateMachine/_Xbee.cs index 36e9974..56d0570 100644 --- a/Cs_HMI/Project/StateMachine/_Xbee.cs +++ b/Cs_HMI/Project/StateMachine/_Xbee.cs @@ -11,7 +11,7 @@ namespace Project { public partial class fMain { - + private void XBE_ProtocReceived(object sender, ENIG.EEProtocol.DataEventArgs e) { //TODO : 기능 처리필요 (XBee 메세지 데이터처리) @@ -29,23 +29,40 @@ namespace Project { case ENIGProtocol.AGVCommands.SetCurrent: //Set Current Position - - if (uint.TryParse(dataStr, out uint tagno)) + + if (dataStr.Length == 6) { - if (PUB.mapctl.SetCurrentPosition(tagno) == true) + var targID = dataStr.Substring(0, 2); + var targstr = dataStr.Substring(2); + + if(byte.TryParse(targID,out byte tID)) { - PUB.log.AddI($"Set Position:{tagno}"); + if (PUB.setting.XBE_ID == tID) + { + if (uint.TryParse(targstr, out uint 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}"); } - else PUB.log.AddE($"Position Error:{tagno}"); + else PUB.log.AddE($"Position Param(targetid) Error:{dataStr}"); + } else PUB.log.AddE($"Position Param Error:{dataStr}"); + break; case ENIGProtocol.AGVCommands.Goto: //move to tag if (uint.TryParse(dataStr, out uint tagno2)) { var currPos = PUB.mapctl.agv.CurrentRFID;///.AGVMoveToRFID(; if (currPos == 0) currPos = 10; - var pathRlt = PUB.mapctl.CalculatePath(currPos,tagno2); + var pathRlt = PUB.mapctl.CalculatePath(currPos, tagno2); if (pathRlt.Success == true) { PUB.log.AddI($"New Target:{tagno2}"); diff --git a/Cs_HMI/Project/ViewForm/fAuto.cs b/Cs_HMI/Project/ViewForm/fAuto.cs index 73a325b..167310f 100644 --- a/Cs_HMI/Project/ViewForm/fAuto.cs +++ b/Cs_HMI/Project/ViewForm/fAuto.cs @@ -63,8 +63,8 @@ namespace Project.ViewForm if (fi.Exists) { PUB.log.Add($"autoload : {fi.FullName}"); - var errmsg = PUB.mapctl.LoadFromFile(fi.FullName); - if (errmsg.isEmpty() == false) AR.UTIL.MsgE(errmsg); + var rlt = PUB.mapctl.LoadFromFile(fi.FullName,out string errmsg); + if (rlt == false) AR.UTIL.MsgE(errmsg); } } } diff --git a/Cs_HMI/SubProject/AGVControl/MapControl.cs b/Cs_HMI/SubProject/AGVControl/MapControl.cs index 94370b9..0e1f9f8 100644 --- a/Cs_HMI/SubProject/AGVControl/MapControl.cs +++ b/Cs_HMI/SubProject/AGVControl/MapControl.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.ComponentModel.Design; using System.Drawing; using System.Drawing.Design; using System.Drawing.Drawing2D; @@ -11,6 +12,8 @@ using System.Security.Permissions; using System.Text.RegularExpressions; using System.Windows.Forms; using AGVControl.Models; +using AR; +using static System.Net.Mime.MediaTypeNames; namespace AGVControl { @@ -27,7 +30,7 @@ namespace AGVControl if (obj is RFIDConnection other) { return (StartRFID == other.StartRFID && EndRFID == other.EndRFID) || - (IsBidirectional && other.IsBidirectional && + (IsBidirectional && other.IsBidirectional && StartRFID == other.EndRFID && EndRFID == other.StartRFID); } return false; @@ -108,18 +111,11 @@ namespace AGVControl // 툴바 버튼 영역 초기화 UpdateToolbarRects(); - // 마우스 이벤트 핸들러 추가 - this.MouseWheel += MapControl_MouseWheel; - this.MouseDown += MapControl_MouseDown; - this.MouseMove += MapControl_MouseMove; - this.MouseUp += MapControl_MouseUp; - this.MouseClick += MapControl_MouseClick; - this.MouseDoubleClick += MapControl_MouseDoubleClick; - this.Resize += MapControl_Resize; } - private void MapControl_Resize(object sender, EventArgs e) + protected override void OnResize(EventArgs e) { + base.OnResize(e); UpdateToolbarRects(); this.Invalidate(); } @@ -229,8 +225,10 @@ namespace AGVControl } return false; } - private void MapControl_MouseWheel(object sender, MouseEventArgs e) + + protected override void OnMouseWheel(MouseEventArgs e) { + base.OnMouseWheel(e); if (e.Delta > 0) { zoom *= 1.1f; @@ -244,8 +242,10 @@ namespace AGVControl this.Invalidate(); } - private void MapControl_MouseDown(object sender, MouseEventArgs e) + + protected override void OnMouseDown(MouseEventArgs e) { + base.OnMouseDown(e); lastMousePosition = e.Location; var mapPoint = ScreenToMap(e.Location); @@ -323,8 +323,11 @@ namespace AGVControl Point? lineStartPoint = null; Point? branchPoint = null; - private void MapControl_MouseMove(object sender, MouseEventArgs e) + + + protected override void OnMouseMove(MouseEventArgs e) { + base.OnMouseMove(e); currentMousePosition = e.Location; var mapPoint = ScreenToMap(e.Location); @@ -416,12 +419,10 @@ namespace AGVControl if (line.StartPoint == draggingPoint.Value) { line.StartPoint = selectedRFID.Location; - line.Distance = GetDistance(line.StartPoint, line.EndPoint); } if (line.EndPoint == draggingPoint.Value) { line.EndPoint = selectedRFID.Location; - line.Distance = GetDistance(line.StartPoint, line.EndPoint); } } } @@ -495,8 +496,9 @@ namespace AGVControl } - private void MapControl_MouseUp(object sender, MouseEventArgs e) + protected override void OnMouseUp(MouseEventArgs e) { + base.OnMouseUp(e); if (e.Button == MouseButtons.Middle) { isDragging = false; @@ -515,7 +517,7 @@ namespace AGVControl var rfidLines = GetRFIDLines(); var directConnection = rfidLines.FirstOrDefault(line => (line.StartPoint == a && line.EndPoint == b) || - (line.IsBidirectional && line.StartPoint == b && line.EndPoint == a)); + (line.StartPoint == b && line.EndPoint == a)); if (directConnection != null) { @@ -541,10 +543,7 @@ namespace AGVControl else if (line.EndPoint == point) { // 양방향 연결인 경우에만 시작점을 이웃으로 추가 - if (line.IsBidirectional) - { - neighbors.Add(line.StartPoint); - } + neighbors.Add(line.StartPoint); } } @@ -631,8 +630,9 @@ namespace AGVControl return retval; } - private void MapControl_MouseClick(object sender, MouseEventArgs e) + protected override void OnMouseClick(MouseEventArgs e) { + base.OnMouseClick(e); var mapPoint = ScreenToMap(e.Location); if (e.Button == MouseButtons.Right) { @@ -700,8 +700,12 @@ namespace AGVControl od.Filter = "path data|*.route"; od.FilterIndex = 0; od.RestoreDirectory = true; - od.FileName = System.IO.Path.GetFileName(this.filename); - od.InitialDirectory = System.IO.Path.GetDirectoryName(this.filename); + if(filename.isEmpty()==false) + { + od.FileName = System.IO.Path.GetFileName(filename); + od.InitialDirectory = System.IO.Path.GetDirectoryName(filename); + } + if (od.ShowDialog() == DialogResult.OK) { filename = od.FileName; @@ -730,8 +734,9 @@ namespace AGVControl if (od.ShowDialog() == DialogResult.OK) { - filename = od.FileName; - this.LoadFromFile(filename); + + this.LoadFromFile(filename, out string errmsg); + if (errmsg.isEmpty() == false) UTIL.MsgE(errmsg); this.Invalidate(); } } @@ -825,9 +830,6 @@ namespace AGVControl { StartPoint = previewStartPoint.Value, EndPoint = clickedRFID.Location, - StartRFID = startRFID.RFIDValue, - EndRFID = clickedRFID.RFIDValue, - Distance = GetDistance(previewStartPoint.Value, clickedRFID.Location) }; rfidLines.Add(line); selectedRFIDLine = line; @@ -872,7 +874,7 @@ namespace AGVControl nearbyPoints.Sort((a, b) => a.ProjectionRatio.CompareTo(b.ProjectionRatio)); // 이전 RFID 값과 위치를 저장 - uint prevRFID = line.StartRFID; + //uint prevRFID = line.StartRFID; Point prevPoint = line.StartPoint; // 정렬된 포인트들을 순차적으로 연결 @@ -882,15 +884,12 @@ namespace AGVControl { StartPoint = prevPoint, EndPoint = item.Point.Location, - StartRFID = prevRFID, - EndRFID = item.Point.RFIDValue, - Distance = GetDistance(prevPoint, item.Point.Location) + }; rfidLines.Add(rfidLine); // 현재 포인트를 다음 선분의 시작점으로 설정 prevPoint = item.Point.Location; - prevRFID = item.Point.RFIDValue; } // 마지막 포인트와 원래 선의 끝점을 연결 @@ -898,9 +897,6 @@ namespace AGVControl { StartPoint = prevPoint, EndPoint = line.EndPoint, - StartRFID = prevRFID, - EndRFID = line.EndRFID, - Distance = GetDistance(prevPoint, line.EndPoint) }; rfidLines.Add(finalLine); @@ -933,38 +929,45 @@ namespace AGVControl return GetDistance(point, new Point((int)projectionX, (int)projectionY)); } - private void MapControl_MouseDoubleClick(object sender, MouseEventArgs e) + protected override void OnMouseDoubleClick(MouseEventArgs e) { + base.OnMouseDoubleClick(e); + if (e.Button == MouseButtons.Left) { // 화면 좌표를 맵 좌표로 변환 var mapPoint = ScreenToMap(e.Location); - // 텍스트 객체 찾기 - foreach (var text in mapTexts) + //RFID 포인트 찾기 + var selected_rfid = rfidPoints.Where(t => t.Bounds.Expand(SELECTION_DISTANCE, SELECTION_DISTANCE).Contains(mapPoint)).FirstOrDefault(); + if (selected_rfid != null) { - var textSize = CreateGraphics().MeasureString(text.Text, text.Font); - var rect = new RectangleF( - text.Location.X - SELECTION_DISTANCE, - text.Location.Y - SELECTION_DISTANCE, - textSize.Width + SELECTION_DISTANCE * 2, - textSize.Height + SELECTION_DISTANCE * 2 - ); - - if (rect.Contains(mapPoint)) + var rlt = AR.UTIL.InputBox("rfid value", selected_rfid.RFIDValue.ToString()); + if (rlt.Item1 == true) { - var rlt = AR.UTIL.InputBox("input", text.Text); - if (rlt.Item1 == true) - { - text.Text = rlt.Item2;// dialog.InputText; - this.Invalidate(); - } - break; + selected_rfid.RFIDValue = uint.Parse(rlt.Item2);// dialog.InputText; + ProcessRFIDConnections(); + this.Invalidate(); } + return; + } + + // 텍스트 객체 찾기 + var selected_txt = mapTexts.Where(t => t.Bounds.Expand(SELECTION_DISTANCE, SELECTION_DISTANCE).Contains(mapPoint)).FirstOrDefault(); + if (selected_txt != null) + { + var rlt = AR.UTIL.InputBox("input", selected_txt.Text); + if (rlt.Item1 == true) + { + selected_txt.Text = rlt.Item2;// dialog.InputText; + this.Invalidate(); + } + return; } } } + public event EventHandler OnRightClick; public void SetRFIDPoints(List points) @@ -1121,7 +1124,7 @@ namespace AGVControl e.Graphics.ScaleTransform(zoom, zoom); DrawRFIDLines(e.Graphics); - DrawMap(e.Graphics); + DrawRFIDPoints(e.Graphics); //DrawCustomLines(e.Graphics); DrawMapTexts(e.Graphics); @@ -1169,13 +1172,15 @@ namespace AGVControl } - private void DrawMap(Graphics g) + private void DrawRFIDPoints(Graphics g) { // RFID 포인트 그리기 foreach (var rfid in rfidPoints) { var MarkerSize = 5; - g.FillEllipse(Brushes.Green, rfid.Location.X - (MarkerSize / 2f), rfid.Location.Y - (MarkerSize / 2f), MarkerSize, MarkerSize); + var half = MarkerSize / 2f; + rfid.Bounds = new RectangleF(rfid.Location.X - half, rfid.Location.Y - half, MarkerSize, MarkerSize); + g.FillEllipse(Brushes.Green, rfid.Bounds); //g.DrawString(rfid.RFIDValue, Font, Brushes.WhiteSmoke, rfid.Location.X + 5, rfid.Location.Y - 5); } @@ -1185,9 +1190,16 @@ namespace AGVControl //g.FillEllipse(Brushes.Green, rfid.Location.X - 3, rfid.Location.Y - 3, 6, 6); var tagstr = $"{rfid.RFIDValue}"; var fsize = g.MeasureString(tagstr, Font); - g.DrawString(tagstr, Font, Brushes.WhiteSmoke, - (rfid.Location.X - fsize.Width / 2f), - (rfid.Location.Y + 2)); + var rect = new RectangleF(rfid.Bounds.X - (fsize.Width / 2f) + 3, + rfid.Bounds.Y + 6, + fsize.Width, + fsize.Height); + //g.DrawRectangle(Pens.Red, rect); + g.DrawString(tagstr, Font, Brushes.WhiteSmoke, rect, new StringFormat + { + Alignment = StringAlignment.Center, + LineAlignment = StringAlignment.Center, + }); } } @@ -1233,18 +1245,22 @@ namespace AGVControl foreach (var text in mapTexts) { var textSize = g.MeasureString(text.Text, text.Font); - var rect = new RectangleF( - text.Location.X, - text.Location.Y, - textSize.Width, - textSize.Height - ); + if (text.Dirty) + { + text.Bounds = new RectangleF( + text.Location.X, + text.Location.Y, + textSize.Width, + textSize.Height + ); + text.Dirty = false; + } if (text.BackgroundColor != Color.Transparent) { using (var brush = new SolidBrush(text.BackgroundColor)) { - g.FillRectangle(brush, rect); + g.FillRectangle(brush, text.Bounds); } } @@ -1258,7 +1274,7 @@ namespace AGVControl using (Pen pen = new Pen(Color.Blue, 1)) { pen.DashStyle = System.Drawing.Drawing2D.DashStyle.Dash; - g.DrawRectangle(pen, rect.X, rect.Y, rect.Width, rect.Height); + g.DrawRectangle(pen, text.Bounds.X, text.Bounds.Y, text.Bounds.Width, text.Bounds.Height); } } } @@ -1266,6 +1282,29 @@ namespace AGVControl private void DrawRFIDLines(Graphics g) { + var idx = 0; + using (Font f = new Font("arial", 4)) + { + foreach (var item in rfidLines) + { + var sp = item.StartPoint; + var ep = item.EndPoint; + using (var p = new Pen(Color.FromArgb(50, Color.White), 10)) + { + g.DrawLine(p, sp, ep); + var x = sp.X; + var y = sp.Y; + g.DrawString($"{idx}", f, Brushes.Gold, x, y); + + x = ep.X; + y = ep.Y; + g.DrawString($"{idx}", f, Brushes.Pink, x, y); + idx++; + } + } + } + + foreach (var connection in rfidConnections) { var startPoint = rfidPoints.First(p => p.RFIDValue == connection.StartRFID).Location; @@ -1351,7 +1390,7 @@ namespace AGVControl this.Invalidate(); } - public void AddRFIDLine(Point startPoint, Point endPoint, uint startRFID, uint endRFID, bool isBidirectional = false) + public void AddRFIDLine(Point startPoint, Point endPoint) { // 시작점과 끝점 사이의 모든 RFID 포인트 찾기 var allPoints = new List<(RFIDPoint Point, float Distance)>(); @@ -1387,47 +1426,14 @@ namespace AGVControl { StartPoint = startPoint, EndPoint = endPoint, - StartRFID = startRFID, - EndRFID = endRFID, - IsBidirectional = isBidirectional, - Distance = GetDistance(startPoint, endPoint) }; - // 연결된 RFID 목록 생성 - line.ConnectedRFIDs.Add(startRFID); - foreach (var point in allPoints) - { - line.ConnectedRFIDs.Add(point.Point.RFIDValue); - } - line.ConnectedRFIDs.Add(endRFID); - - // 다음/이전 RFID 정보 설정 - for (int i = 0; i < line.ConnectedRFIDs.Count - 1; i++) - { - var current = line.ConnectedRFIDs[i]; - var next = line.ConnectedRFIDs[i + 1]; - line.NextRFID[current] = next; - line.PrevRFID[next] = current; - - if (isBidirectional) - { - line.NextRFID[next] = current; - line.PrevRFID[current] = next; - } - } rfidLines.Add(line); this.Invalidate(); } - public void LoadMapData(MapData mapData) - { - rfidPoints = mapData.RFIDPoints ?? new List(); - mapTexts = mapData.MapTexts ?? new List(); - customLines = mapData.CustomLines ?? new List(); - rfidLines = mapData.RFIDLines ?? new List(); - this.Invalidate(); - } + public void ClearMap() { @@ -1499,10 +1505,13 @@ namespace AGVControl } File.WriteAllLines(filename, lines); + this.filename = filename; } - public string LoadFromFile(string filename) + public bool LoadFromFile(string filename, out string message) { + this.filename = filename; + message = string.Empty; ClearMap(); var lines = File.ReadAllLines(filename); @@ -1528,9 +1537,19 @@ namespace AGVControl var validY = int.TryParse(rfidParts[1], out int valY); var validN = uint.TryParse(rfidParts[2], out uint valRfid); + if (validX && validY && validN) { + + + if (rfidPoints.Where(t => t.RFIDValue == valRfid).Any()) + { + //이미존재한다 + var newvalue = + sb.AppendLine($"rfid중복{valRfid}"); + } AddRFIDPoint(new Point(valX, valY), valRfid); + } else sb.AppendLine($"[{section}] {line}"); } @@ -1542,10 +1561,7 @@ namespace AGVControl { AddRFIDLine( new Point(int.Parse(rfidLineParts[0]), int.Parse(rfidLineParts[1])), - new Point(int.Parse(rfidLineParts[2]), int.Parse(rfidLineParts[3])), - uint.Parse(rfidLineParts[4]), - uint.Parse(rfidLineParts[5]), - (rfidLineParts[6].ToLower() == "true") + new Point(int.Parse(rfidLineParts[2]), int.Parse(rfidLineParts[3])) ); } break; @@ -1588,7 +1604,8 @@ namespace AGVControl this.Invalidate(); - return sb.ToString(); + message = sb.ToString(); + return true; } private void ProcessRFIDConnections() @@ -1603,7 +1620,7 @@ namespace AGVControl // 1. 선 위의 모든 RFID 포인트(시작, 끝 포함)를 projectionRatio로 정렬 var pointsOnThisLine = rfidPoints - .Where(p => IsPointOnLine(p.Location, start, end, 15f)) // 오차 허용치 넉넉히 + .Where(p => IsPointOnLine(p.Location, start, end, 10f)) // 오차 허용치 넉넉히 .Select(p => new { RFID = p.RFIDValue, @@ -1611,11 +1628,11 @@ namespace AGVControl }) .ToList(); - // 2. 시작/끝 RFID가 목록에 없으면 강제로 추가 - if (!pointsOnThisLine.Any(p => p.RFID == line.StartRFID)) - pointsOnThisLine.Add(new { RFID = line.StartRFID, Ratio = 0f }); - if (!pointsOnThisLine.Any(p => p.RFID == line.EndRFID)) - pointsOnThisLine.Add(new { RFID = line.EndRFID, Ratio = 1f }); + //// 2. 시작/끝 RFID가 목록에 없으면 강제로 추가 + //if (!pointsOnThisLine.Any(p => p.RFID == line.StartRFID)) + // pointsOnThisLine.Add(new { RFID = line.StartRFID, Ratio = 0f }); + //if (!pointsOnThisLine.Any(p => p.RFID == line.EndRFID)) + // pointsOnThisLine.Add(new { RFID = line.EndRFID, Ratio = 1f }); // 3. 정렬 pointsOnThisLine = pointsOnThisLine.OrderBy(p => p.Ratio).ToList(); @@ -1635,7 +1652,6 @@ namespace AGVControl { StartRFID = from, EndRFID = to, - IsBidirectional = line.IsBidirectional, Distance = GetDistance(fromPt, toPt) }); connectionSet.Add(key); @@ -1649,8 +1665,8 @@ namespace AGVControl var distance = GetDistanceToLine(point, lineStart, lineEnd); if (distance > tolerance) return false; - var projectionRatio = GetProjectionRatio(point, lineStart, lineEnd); - return projectionRatio >= 0 && projectionRatio <= 1; + var projectionRatio = Math.Round(GetProjectionRatio(point, lineStart, lineEnd), 2); + return projectionRatio >= 0 && projectionRatio <= 1.0; } private void DeleteNearbyRFIDLine(Point clickPoint) diff --git a/Cs_HMI/SubProject/AGVControl/Models/MapText.cs b/Cs_HMI/SubProject/AGVControl/Models/MapText.cs index 33be61c..753685a 100644 --- a/Cs_HMI/SubProject/AGVControl/Models/MapText.cs +++ b/Cs_HMI/SubProject/AGVControl/Models/MapText.cs @@ -1,14 +1,63 @@ using System.Drawing; using System; -using System.Collections.Generic; +using System.Collections.Generic; namespace AGVControl.Models { public class MapText { - public Point Location { get; set; } - public string Text { get; set; } + private bool _dirty = true; + private Point _location; + private string _text; + private Font _font; + + public bool Dirty + { + get => _dirty; + set => _dirty = value; + } + + public Point Location + { + get => _location; + set + { + if (_location != value) + { + _location = value; + _dirty = true; + } + } + } + + public string Text + { + get => _text; + set + { + if (_text != value) + { + _text = value; + _dirty = true; + } + } + } + public Color TextColor { get; set; } public Color BackgroundColor { get; set; } - public Font Font { get; set; } + + public Font Font + { + get => _font; + set + { + if (_font != value) + { + _font = value; + _dirty = true; + } + } + } + + public RectangleF Bounds { get; set; } } } \ No newline at end of file diff --git a/Cs_HMI/SubProject/AGVControl/Models/RFIDLine.cs b/Cs_HMI/SubProject/AGVControl/Models/RFIDLine.cs index 91bc5ed..36df3b8 100644 --- a/Cs_HMI/SubProject/AGVControl/Models/RFIDLine.cs +++ b/Cs_HMI/SubProject/AGVControl/Models/RFIDLine.cs @@ -7,14 +7,24 @@ namespace AGVControl.Models public class RFIDLine { public Point StartPoint { get; set; } - public Point EndPoint { get; set; } - public uint StartRFID { get; set; } - public uint EndRFID { get; set; } - public bool IsBidirectional { get; set; } = true; // 양방향 이동 가능 여부 - public float Distance { get; set; } // 두 RFID 포인트 사이의 거리 + public Point EndPoint { get; set; } + + public float Distance + { + get { + float dx = StartPoint.X - EndPoint.X; + float dy = StartPoint.Y - EndPoint.Y; + return (float)Math.Sqrt(dx * dx + dy * dy); // double을 float로 명시적 캐스팅 + } + } - public List ConnectedRFIDs { get; set; } = new List(); // 연결된 모든 RFID 값들 - public Dictionary NextRFID { get; set; } = new Dictionary(); // 각 RFID의 다음 RFID - public Dictionary PrevRFID { get; set; } = new Dictionary(); // 각 RFID의 이전 RFID + //public uint StartRFID { get; set; } + //public uint EndRFID { get; set; } + //public bool IsBidirectional { get; set; } = true; // 양방향 이동 가능 여부 + //public float Distance { get; set; } // 두 RFID 포인트 사이의 거리 + + //public List ConnectedRFIDs { get; set; } = new List(); // 연결된 모든 RFID 값들 + //public Dictionary NextRFID { get; set; } = new Dictionary(); // 각 RFID의 다음 RFID + //public Dictionary PrevRFID { get; set; } = new Dictionary(); // 각 RFID의 이전 RFID } } \ No newline at end of file diff --git a/Cs_HMI/SubProject/AGVControl/Models/RFIDPoint.cs b/Cs_HMI/SubProject/AGVControl/Models/RFIDPoint.cs index b8855f6..a9361cd 100644 --- a/Cs_HMI/SubProject/AGVControl/Models/RFIDPoint.cs +++ b/Cs_HMI/SubProject/AGVControl/Models/RFIDPoint.cs @@ -9,5 +9,6 @@ namespace AGVControl.Models public uint RFIDValue { get; set; } public string NextRFID { get; set; } // 다음 RFID 포인트의 값 public bool IsBidirectional { get; set; } // 양방향 연결 여부 + public RectangleF Bounds { get; set; } } } \ No newline at end of file diff --git a/Emulator/AGVEmulator/DevXBE.cs b/Emulator/AGVEmulator/DevXBE.cs index 4564afa..22aa9ca 100644 --- a/Emulator/AGVEmulator/DevXBE.cs +++ b/Emulator/AGVEmulator/DevXBE.cs @@ -59,13 +59,19 @@ namespace AGVEmulator /// /// 목적지 태그번호 전송 /// - public void SendGotoTag(uint tag) + public void SendGotoTag(byte id, uint tag) { - Send(ENIGProtocol.AGVCommands.Goto, tag.ToString("0000")); + var idSTR = id.ToString("X2"); + var tagSTR = tag.ToString("0000"); + var dataStr = $"{idSTR}{tagSTR}"; + Send(ENIGProtocol.AGVCommands.Goto, dataStr); } - public void SendCurrentPos(uint tag) + public void SendCurrentPos(byte id, uint tag) { - Send(ENIGProtocol.AGVCommands.SetCurrent, tag.ToString("0000")); + var idSTR = id.ToString("X2"); + var tagSTR = tag.ToString("0000"); + var dataStr = $"{idSTR}{tagSTR}"; + Send(ENIGProtocol.AGVCommands.SetCurrent, dataStr); } private void Send(ENIGProtocol.AGVCommands Command, string datastr) { diff --git a/Emulator/AGVEmulator/Form1.Designer.cs b/Emulator/AGVEmulator/Form1.Designer.cs index de44c3e..61e522c 100644 --- a/Emulator/AGVEmulator/Form1.Designer.cs +++ b/Emulator/AGVEmulator/Form1.Designer.cs @@ -30,34 +30,34 @@ namespace AGVEmulator private void InitializeComponent() { this.components = new System.ComponentModel.Container(); - AGVEmulator.UC.AgvViewer.ptdata ptdata29 = new AGVEmulator.UC.AgvViewer.ptdata(); - AGVEmulator.UC.AgvViewer.ptdata ptdata30 = new AGVEmulator.UC.AgvViewer.ptdata(); - AGVEmulator.UC.AgvViewer.ptdata ptdata31 = new AGVEmulator.UC.AgvViewer.ptdata(); - AGVEmulator.UC.AgvViewer.ptdata ptdata32 = new AGVEmulator.UC.AgvViewer.ptdata(); - AGVEmulator.UC.AgvViewer.ptdata ptdata33 = new AGVEmulator.UC.AgvViewer.ptdata(); - AGVEmulator.UC.AgvViewer.ptdata ptdata34 = new AGVEmulator.UC.AgvViewer.ptdata(); - AGVEmulator.UC.AgvViewer.ptdata ptdata35 = new AGVEmulator.UC.AgvViewer.ptdata(); - AGVEmulator.UC.AgvViewer.ptdata ptdata36 = new AGVEmulator.UC.AgvViewer.ptdata(); - AGVEmulator.UC.AgvViewer.ptdata ptdata37 = new AGVEmulator.UC.AgvViewer.ptdata(); - AGVEmulator.UC.AgvViewer.ptdata ptdata38 = new AGVEmulator.UC.AgvViewer.ptdata(); - AGVEmulator.UC.AgvViewer.ptdata ptdata39 = new AGVEmulator.UC.AgvViewer.ptdata(); - AGVEmulator.UC.AgvViewer.ptdata ptdata40 = new AGVEmulator.UC.AgvViewer.ptdata(); - AGVEmulator.UC.AgvViewer.ptdata ptdata41 = new AGVEmulator.UC.AgvViewer.ptdata(); - AGVEmulator.UC.AgvViewer.ptdata ptdata42 = new AGVEmulator.UC.AgvViewer.ptdata(); - AGVEmulator.UC.AgvViewer.ptdata ptdata43 = new AGVEmulator.UC.AgvViewer.ptdata(); - AGVEmulator.UC.AgvViewer.ptdata ptdata44 = new AGVEmulator.UC.AgvViewer.ptdata(); - AGVEmulator.UC.AgvViewer.ptdata ptdata45 = new AGVEmulator.UC.AgvViewer.ptdata(); - AGVEmulator.UC.AgvViewer.ptdata ptdata46 = new AGVEmulator.UC.AgvViewer.ptdata(); - AGVEmulator.UC.AgvViewer.ptdata ptdata47 = new AGVEmulator.UC.AgvViewer.ptdata(); - AGVEmulator.UC.AgvViewer.ptdata ptdata48 = new AGVEmulator.UC.AgvViewer.ptdata(); - AGVEmulator.UC.AgvViewer.ptdata ptdata49 = new AGVEmulator.UC.AgvViewer.ptdata(); - AGVEmulator.UC.AgvViewer.ptdata ptdata50 = new AGVEmulator.UC.AgvViewer.ptdata(); - AGVEmulator.UC.AgvViewer.ptdata ptdata51 = new AGVEmulator.UC.AgvViewer.ptdata(); - AGVEmulator.UC.AgvViewer.ptdata ptdata52 = new AGVEmulator.UC.AgvViewer.ptdata(); - AGVEmulator.UC.AgvViewer.ptdata ptdata53 = new AGVEmulator.UC.AgvViewer.ptdata(); - AGVEmulator.UC.AgvViewer.ptdata ptdata54 = new AGVEmulator.UC.AgvViewer.ptdata(); - AGVEmulator.UC.AgvViewer.ptdata ptdata55 = new AGVEmulator.UC.AgvViewer.ptdata(); - AGVEmulator.UC.AgvViewer.ptdata ptdata56 = new AGVEmulator.UC.AgvViewer.ptdata(); + AGVEmulator.UC.AgvViewer.ptdata ptdata1 = new AGVEmulator.UC.AgvViewer.ptdata(); + AGVEmulator.UC.AgvViewer.ptdata ptdata2 = new AGVEmulator.UC.AgvViewer.ptdata(); + AGVEmulator.UC.AgvViewer.ptdata ptdata3 = new AGVEmulator.UC.AgvViewer.ptdata(); + AGVEmulator.UC.AgvViewer.ptdata ptdata4 = new AGVEmulator.UC.AgvViewer.ptdata(); + AGVEmulator.UC.AgvViewer.ptdata ptdata5 = new AGVEmulator.UC.AgvViewer.ptdata(); + AGVEmulator.UC.AgvViewer.ptdata ptdata6 = new AGVEmulator.UC.AgvViewer.ptdata(); + AGVEmulator.UC.AgvViewer.ptdata ptdata7 = new AGVEmulator.UC.AgvViewer.ptdata(); + AGVEmulator.UC.AgvViewer.ptdata ptdata8 = new AGVEmulator.UC.AgvViewer.ptdata(); + AGVEmulator.UC.AgvViewer.ptdata ptdata9 = new AGVEmulator.UC.AgvViewer.ptdata(); + AGVEmulator.UC.AgvViewer.ptdata ptdata10 = new AGVEmulator.UC.AgvViewer.ptdata(); + AGVEmulator.UC.AgvViewer.ptdata ptdata11 = new AGVEmulator.UC.AgvViewer.ptdata(); + AGVEmulator.UC.AgvViewer.ptdata ptdata12 = new AGVEmulator.UC.AgvViewer.ptdata(); + AGVEmulator.UC.AgvViewer.ptdata ptdata13 = new AGVEmulator.UC.AgvViewer.ptdata(); + AGVEmulator.UC.AgvViewer.ptdata ptdata14 = new AGVEmulator.UC.AgvViewer.ptdata(); + AGVEmulator.UC.AgvViewer.ptdata ptdata15 = new AGVEmulator.UC.AgvViewer.ptdata(); + AGVEmulator.UC.AgvViewer.ptdata ptdata16 = new AGVEmulator.UC.AgvViewer.ptdata(); + AGVEmulator.UC.AgvViewer.ptdata ptdata17 = new AGVEmulator.UC.AgvViewer.ptdata(); + AGVEmulator.UC.AgvViewer.ptdata ptdata18 = new AGVEmulator.UC.AgvViewer.ptdata(); + AGVEmulator.UC.AgvViewer.ptdata ptdata19 = new AGVEmulator.UC.AgvViewer.ptdata(); + AGVEmulator.UC.AgvViewer.ptdata ptdata20 = new AGVEmulator.UC.AgvViewer.ptdata(); + AGVEmulator.UC.AgvViewer.ptdata ptdata21 = new AGVEmulator.UC.AgvViewer.ptdata(); + AGVEmulator.UC.AgvViewer.ptdata ptdata22 = new AGVEmulator.UC.AgvViewer.ptdata(); + AGVEmulator.UC.AgvViewer.ptdata ptdata23 = new AGVEmulator.UC.AgvViewer.ptdata(); + AGVEmulator.UC.AgvViewer.ptdata ptdata24 = new AGVEmulator.UC.AgvViewer.ptdata(); + AGVEmulator.UC.AgvViewer.ptdata ptdata25 = new AGVEmulator.UC.AgvViewer.ptdata(); + AGVEmulator.UC.AgvViewer.ptdata ptdata26 = new AGVEmulator.UC.AgvViewer.ptdata(); + AGVEmulator.UC.AgvViewer.ptdata ptdata27 = new AGVEmulator.UC.AgvViewer.ptdata(); + AGVEmulator.UC.AgvViewer.ptdata ptdata28 = new AGVEmulator.UC.AgvViewer.ptdata(); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1)); this.groupBox1 = new System.Windows.Forms.GroupBox(); this.rtBMS = new arCtl.LogTextBox(); @@ -132,6 +132,8 @@ namespace AGVEmulator this.tabPage2 = new System.Windows.Forms.TabPage(); this.tabPage3 = new System.Windows.Forms.TabPage(); this.panel3 = new System.Windows.Forms.Panel(); + this.numericUpDown2 = new System.Windows.Forms.NumericUpDown(); + this.button1 = new System.Windows.Forms.Button(); this.nudTagNo = new System.Windows.Forms.NumericUpDown(); this.btacsgoto = new System.Windows.Forms.Button(); this.button7 = new System.Windows.Forms.Button(); @@ -150,8 +152,8 @@ namespace AGVEmulator this.sbBMS = new System.Windows.Forms.ToolStripStatusLabel(); this.toolStripStatusLabel2 = new System.Windows.Forms.ToolStripStatusLabel(); this.sbCAL = new System.Windows.Forms.ToolStripStatusLabel(); - this.numericUpDown2 = new System.Windows.Forms.NumericUpDown(); - this.button1 = new System.Windows.Forms.Button(); + this.label7 = new System.Windows.Forms.Label(); + this.nudIDAgv = new System.Windows.Forms.NumericUpDown(); this.groupBox1.SuspendLayout(); this.panel1.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.trackBar1)).BeginInit(); @@ -177,10 +179,11 @@ namespace AGVEmulator this.tabPage2.SuspendLayout(); this.tabPage3.SuspendLayout(); this.panel3.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.numericUpDown2)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.nudTagNo)).BeginInit(); this.toolStrip1.SuspendLayout(); this.statusStrip1.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.numericUpDown2)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.nudIDAgv)).BeginInit(); this.SuspendLayout(); // // groupBox1 @@ -1013,120 +1016,120 @@ namespace AGVEmulator this.agvViewer1.lastmarkdir = ""; this.agvViewer1.lasttag = ""; this.agvViewer1.lasttagdir = ""; - ptdata29.active = false; - ptdata29.data = "NOT"; - ptdata29.pos = 30F; - ptdata30.active = false; - ptdata30.data = "QA"; - ptdata30.pos = 200F; - ptdata31.active = false; - ptdata31.data = "CHG"; - ptdata31.pos = 300F; - ptdata32.active = false; - ptdata32.data = "QC"; - ptdata32.pos = 400F; - ptdata33.active = false; - ptdata33.data = "#FVI-1"; - ptdata33.pos = 500F; - ptdata34.active = false; - ptdata34.data = "#FVI-2"; - ptdata34.pos = 600F; - ptdata35.active = false; - ptdata35.data = "#FVI-3"; - ptdata35.pos = 700F; - ptdata36.active = false; - ptdata36.data = "#FVI-4"; - ptdata36.pos = 800F; - ptdata37.active = false; - ptdata37.data = "#FVI-5"; - ptdata37.pos = 900F; - ptdata38.active = false; - ptdata38.data = "POT"; - ptdata38.pos = 970F; + ptdata1.active = false; + ptdata1.data = "NOT"; + ptdata1.pos = 30F; + ptdata2.active = false; + ptdata2.data = "QA"; + ptdata2.pos = 200F; + ptdata3.active = false; + ptdata3.data = "CHG"; + ptdata3.pos = 300F; + ptdata4.active = false; + ptdata4.data = "QC"; + ptdata4.pos = 400F; + ptdata5.active = false; + ptdata5.data = "#FVI-1"; + ptdata5.pos = 500F; + ptdata6.active = false; + ptdata6.data = "#FVI-2"; + ptdata6.pos = 600F; + ptdata7.active = false; + ptdata7.data = "#FVI-3"; + ptdata7.pos = 700F; + ptdata8.active = false; + ptdata8.data = "#FVI-4"; + ptdata8.pos = 800F; + ptdata9.active = false; + ptdata9.data = "#FVI-5"; + ptdata9.pos = 900F; + ptdata10.active = false; + ptdata10.data = "POT"; + ptdata10.pos = 970F; this.agvViewer1.listMRK = new AGVEmulator.UC.AgvViewer.ptdata[] { - ptdata29, - ptdata30, - ptdata31, - ptdata32, - ptdata33, - ptdata34, - ptdata35, - ptdata36, - ptdata37, - ptdata38}; - ptdata39.active = false; - ptdata39.data = "9000"; - ptdata39.pos = 80F; - ptdata40.active = false; - ptdata40.data = "9001"; - ptdata40.pos = 120F; - ptdata41.active = false; - ptdata41.data = "9010"; - ptdata41.pos = 180F; - ptdata42.active = false; - ptdata42.data = "9011"; - ptdata42.pos = 220F; - ptdata43.active = false; - ptdata43.data = "9020"; - ptdata43.pos = 280F; - ptdata44.active = false; - ptdata44.data = "9021"; - ptdata44.pos = 320F; - ptdata45.active = false; - ptdata45.data = "9030"; - ptdata45.pos = 380F; - ptdata46.active = false; - ptdata46.data = "9031"; - ptdata46.pos = 420F; - ptdata47.active = false; - ptdata47.data = "9040"; - ptdata47.pos = 480F; - ptdata48.active = false; - ptdata48.data = "9041"; - ptdata48.pos = 520F; - ptdata49.active = false; - ptdata49.data = "9050"; - ptdata49.pos = 580F; - ptdata50.active = false; - ptdata50.data = "9051"; - ptdata50.pos = 620F; - ptdata51.active = false; - ptdata51.data = "9060"; - ptdata51.pos = 680F; - ptdata52.active = false; - ptdata52.data = "9061"; - ptdata52.pos = 720F; - ptdata53.active = false; - ptdata53.data = "9070"; - ptdata53.pos = 780F; - ptdata54.active = false; - ptdata54.data = "9071"; - ptdata54.pos = 820F; - ptdata55.active = false; - ptdata55.data = "9000"; - ptdata55.pos = 10F; - ptdata56.active = false; - ptdata56.data = "9001"; - ptdata56.pos = 50F; + ptdata1, + ptdata2, + ptdata3, + ptdata4, + ptdata5, + ptdata6, + ptdata7, + ptdata8, + ptdata9, + ptdata10}; + ptdata11.active = false; + ptdata11.data = "9000"; + ptdata11.pos = 80F; + ptdata12.active = false; + ptdata12.data = "9001"; + ptdata12.pos = 120F; + ptdata13.active = false; + ptdata13.data = "9010"; + ptdata13.pos = 180F; + ptdata14.active = false; + ptdata14.data = "9011"; + ptdata14.pos = 220F; + ptdata15.active = false; + ptdata15.data = "9020"; + ptdata15.pos = 280F; + ptdata16.active = false; + ptdata16.data = "9021"; + ptdata16.pos = 320F; + ptdata17.active = false; + ptdata17.data = "9030"; + ptdata17.pos = 380F; + ptdata18.active = false; + ptdata18.data = "9031"; + ptdata18.pos = 420F; + ptdata19.active = false; + ptdata19.data = "9040"; + ptdata19.pos = 480F; + ptdata20.active = false; + ptdata20.data = "9041"; + ptdata20.pos = 520F; + ptdata21.active = false; + ptdata21.data = "9050"; + ptdata21.pos = 580F; + ptdata22.active = false; + ptdata22.data = "9051"; + ptdata22.pos = 620F; + ptdata23.active = false; + ptdata23.data = "9060"; + ptdata23.pos = 680F; + ptdata24.active = false; + ptdata24.data = "9061"; + ptdata24.pos = 720F; + ptdata25.active = false; + ptdata25.data = "9070"; + ptdata25.pos = 780F; + ptdata26.active = false; + ptdata26.data = "9071"; + ptdata26.pos = 820F; + ptdata27.active = false; + ptdata27.data = "9000"; + ptdata27.pos = 10F; + ptdata28.active = false; + ptdata28.data = "9001"; + ptdata28.pos = 50F; this.agvViewer1.listTAG = new AGVEmulator.UC.AgvViewer.ptdata[] { - ptdata39, - ptdata40, - ptdata41, - ptdata42, - ptdata43, - ptdata44, - ptdata45, - ptdata46, - ptdata47, - ptdata48, - ptdata49, - ptdata50, - ptdata51, - ptdata52, - ptdata53, - ptdata54, - ptdata55, - ptdata56}; + ptdata11, + ptdata12, + ptdata13, + ptdata14, + ptdata15, + ptdata16, + ptdata17, + ptdata18, + ptdata19, + ptdata20, + ptdata21, + ptdata22, + ptdata23, + ptdata24, + ptdata25, + ptdata26, + ptdata27, + ptdata28}; this.agvViewer1.Location = new System.Drawing.Point(241, 0); this.agvViewer1.Name = "agvViewer1"; this.agvViewer1.Size = new System.Drawing.Size(899, 120); @@ -1171,6 +1174,8 @@ namespace AGVEmulator // // panel3 // + this.panel3.Controls.Add(this.nudIDAgv); + this.panel3.Controls.Add(this.label7); this.panel3.Controls.Add(this.numericUpDown2); this.panel3.Controls.Add(this.button1); this.panel3.Controls.Add(this.nudTagNo); @@ -1187,10 +1192,40 @@ namespace AGVEmulator this.panel3.Size = new System.Drawing.Size(364, 622); this.panel3.TabIndex = 15; // + // numericUpDown2 + // + this.numericUpDown2.Font = new System.Drawing.Font("굴림", 20F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(129))); + this.numericUpDown2.Location = new System.Drawing.Point(110, 207); + this.numericUpDown2.Maximum = new decimal(new int[] { + 9999999, + 0, + 0, + 0}); + this.numericUpDown2.Name = "numericUpDown2"; + this.numericUpDown2.Size = new System.Drawing.Size(130, 38); + this.numericUpDown2.TabIndex = 11; + this.numericUpDown2.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; + this.numericUpDown2.Value = new decimal(new int[] { + 100, + 0, + 0, + 0}); + // + // button1 + // + this.button1.Location = new System.Drawing.Point(246, 207); + this.button1.Name = "button1"; + this.button1.Size = new System.Drawing.Size(86, 38); + this.button1.TabIndex = 10; + this.button1.Tag = "--"; + this.button1.Text = "Set"; + this.button1.UseVisualStyleBackColor = true; + this.button1.Click += new System.EventHandler(this.button1_Click); + // // nudTagNo // this.nudTagNo.Font = new System.Drawing.Font("굴림", 20F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(129))); - this.nudTagNo.Location = new System.Drawing.Point(15, 250); + this.nudTagNo.Location = new System.Drawing.Point(110, 251); this.nudTagNo.Maximum = new decimal(new int[] { 9999999, 0, @@ -1201,14 +1236,14 @@ namespace AGVEmulator this.nudTagNo.TabIndex = 9; this.nudTagNo.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; this.nudTagNo.Value = new decimal(new int[] { - 9900, + 405, 0, 0, 0}); // // btacsgoto // - this.btacsgoto.Location = new System.Drawing.Point(151, 250); + this.btacsgoto.Location = new System.Drawing.Point(246, 251); this.btacsgoto.Name = "btacsgoto"; this.btacsgoto.Size = new System.Drawing.Size(86, 38); this.btacsgoto.TabIndex = 8; @@ -1353,36 +1388,34 @@ namespace AGVEmulator this.sbCAL.Size = new System.Drawing.Size(19, 17); this.sbCAL.Text = "●"; // - // numericUpDown2 + // label7 // - this.numericUpDown2.Font = new System.Drawing.Font("굴림", 20F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(129))); - this.numericUpDown2.Location = new System.Drawing.Point(15, 206); - this.numericUpDown2.Maximum = new decimal(new int[] { + this.label7.AutoSize = true; + this.label7.Location = new System.Drawing.Point(32, 220); + this.label7.Name = "label7"; + this.label7.Size = new System.Drawing.Size(45, 12); + this.label7.TabIndex = 12; + this.label7.Text = "AGV ID"; + // + // nudIDAgv + // + this.nudIDAgv.Font = new System.Drawing.Font("굴림", 20F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(129))); + this.nudIDAgv.Location = new System.Drawing.Point(6, 249); + this.nudIDAgv.Maximum = new decimal(new int[] { 9999999, 0, 0, 0}); - this.numericUpDown2.Name = "numericUpDown2"; - this.numericUpDown2.Size = new System.Drawing.Size(130, 38); - this.numericUpDown2.TabIndex = 11; - this.numericUpDown2.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; - this.numericUpDown2.Value = new decimal(new int[] { - 9900, + this.nudIDAgv.Name = "nudIDAgv"; + this.nudIDAgv.Size = new System.Drawing.Size(98, 38); + this.nudIDAgv.TabIndex = 13; + this.nudIDAgv.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; + this.nudIDAgv.Value = new decimal(new int[] { + 10, 0, 0, 0}); // - // button1 - // - this.button1.Location = new System.Drawing.Point(151, 206); - this.button1.Name = "button1"; - this.button1.Size = new System.Drawing.Size(86, 38); - this.button1.TabIndex = 10; - this.button1.Tag = "--"; - this.button1.Text = "Set"; - this.button1.UseVisualStyleBackColor = true; - this.button1.Click += new System.EventHandler(this.button1_Click); - // // Form1 // this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F); @@ -1428,12 +1461,14 @@ namespace AGVEmulator this.tabPage2.ResumeLayout(false); this.tabPage3.ResumeLayout(false); this.panel3.ResumeLayout(false); + this.panel3.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.numericUpDown2)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.nudTagNo)).EndInit(); this.toolStrip1.ResumeLayout(false); this.toolStrip1.PerformLayout(); this.statusStrip1.ResumeLayout(false); this.statusStrip1.PerformLayout(); - ((System.ComponentModel.ISupportInitialize)(this.numericUpDown2)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.nudIDAgv)).EndInit(); this.ResumeLayout(false); this.PerformLayout(); @@ -1534,6 +1569,8 @@ namespace AGVEmulator private System.Windows.Forms.Button button12; private System.Windows.Forms.NumericUpDown numericUpDown2; private System.Windows.Forms.Button button1; + private System.Windows.Forms.Label label7; + private System.Windows.Forms.NumericUpDown nudIDAgv; } } diff --git a/Emulator/AGVEmulator/Form1.cs b/Emulator/AGVEmulator/Form1.cs index 999d35c..a11d1a9 100644 --- a/Emulator/AGVEmulator/Form1.cs +++ b/Emulator/AGVEmulator/Form1.cs @@ -567,14 +567,16 @@ namespace AGVEmulator private void button6_Click(object sender, EventArgs e) { + var target = (byte)nudIDAgv.Value; var tagno =(uint) nudTagNo.Value; - this.XBE.SendGotoTag(tagno); + this.XBE.SendGotoTag( target, tagno); } private void button1_Click(object sender, EventArgs e) { + var target = (byte)nudIDAgv.Value; var tagno = (uint)numericUpDown2.Value; - this.XBE.SendCurrentPos(tagno); + this.XBE.SendCurrentPos(target,tagno); } private void toolStripButton1_Click(object sender, EventArgs e)