74 lines
2.2 KiB
C#
74 lines
2.2 KiB
C#
using System.Drawing;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
|
|
namespace AGVControl.Models
|
|
{
|
|
public class AGV
|
|
{
|
|
public Point CurrentPosition { get; set; }
|
|
public uint CurrentRFID { get; set; }
|
|
public float BatteryLevel { get; set; } = 0f;
|
|
/// <summary>
|
|
/// AGV에서 방향값이 수산됩니다.
|
|
/// </summary>
|
|
public Direction CurrentDirection { get; set; }
|
|
|
|
/// <summary>
|
|
/// 현재위치가 수산되면 목적지까지의 방향값이 계산됩니다.
|
|
/// </summary>
|
|
public Direction TargetDirection { 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 Point TargetPosition { get; set; }
|
|
public uint TargetRFID { get; set; }
|
|
|
|
public AGV()
|
|
{
|
|
CurrentPath = new List<Point>();
|
|
PlannedPath = new List<Point>();
|
|
PathRFIDs = new List<string>();
|
|
CurrentDirection = Direction.Forward;
|
|
TargetPosition = Point.Empty;
|
|
TargetRFID = 0;
|
|
TargetDirection = Direction.Forward;
|
|
}
|
|
|
|
public void Move()
|
|
{
|
|
if (CurrentPath.Count > 0)
|
|
{
|
|
CurrentPosition = CurrentPath[0];
|
|
CurrentPath.RemoveAt(0);
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
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;
|
|
}
|
|
}
|
|
} |