70 lines
1.9 KiB
C#
70 lines
1.9 KiB
C#
using System.Drawing;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
|
|
namespace AGVMapControl.Models
|
|
{
|
|
public class AGV
|
|
{
|
|
public Point CurrentPosition { get; set; }
|
|
public string CurrentRFID { get; set; }
|
|
public Direction CurrentDirection { get; set; }
|
|
public bool IsMoving { get; set; }
|
|
public List<Point> CurrentPath { get; set; }
|
|
public List<Point> PlannedPath { get; set; }
|
|
public List<string> PathRFIDs { get; set; }
|
|
|
|
public AGV()
|
|
{
|
|
CurrentPath = new List<Point>();
|
|
PlannedPath = new List<Point>();
|
|
PathRFIDs = new List<string>();
|
|
CurrentDirection = Direction.Forward;
|
|
}
|
|
|
|
public void Move()
|
|
{
|
|
if (CurrentPath.Count > 0)
|
|
{
|
|
CurrentPosition = CurrentPath[0];
|
|
CurrentPath.RemoveAt(0);
|
|
}
|
|
}
|
|
|
|
public void SetNewPath(List<Point> path)
|
|
{
|
|
CurrentPath = new List<Point>(path);
|
|
}
|
|
|
|
public void ClearPlannedPath()
|
|
{
|
|
PlannedPath.Clear();
|
|
PathRFIDs.Clear();
|
|
}
|
|
}
|
|
|
|
public enum Direction
|
|
{
|
|
Forward,
|
|
Backward
|
|
}
|
|
|
|
public class PathNode
|
|
{
|
|
public Point Location { get; set; }
|
|
public string RFID { get; set; }
|
|
public double G { get; set; } // 시작점에서 현재 노드까지의 비용
|
|
public double H { get; set; } // 현재 노드에서 목표점까지의 예상 비용
|
|
public double F => G + H; // 총 비용
|
|
public PathNode Parent { get; set; }
|
|
|
|
public PathNode(Point location, string rfid)
|
|
{
|
|
Location = location;
|
|
RFID = rfid;
|
|
G = 0;
|
|
H = 0;
|
|
Parent = null;
|
|
}
|
|
}
|
|
} |