132 lines
3.8 KiB
C#
132 lines
3.8 KiB
C#
namespace AGVNavigationCore.Models
|
|
{
|
|
/// <summary>
|
|
/// AGV 마그넷 센서 방향 제어
|
|
/// </summary>
|
|
public enum MagnetDirection
|
|
{
|
|
/// <summary>
|
|
/// 직진 - 기본 마그넷 라인 추종
|
|
/// </summary>
|
|
Straight = 0,
|
|
|
|
/// <summary>
|
|
/// 좌측 - 마그넷 센서 가중치를 좌측으로 조정
|
|
/// </summary>
|
|
Left = 1,
|
|
|
|
/// <summary>
|
|
/// 우측 - 마그넷 센서 가중치를 우측으로 조정
|
|
/// </summary>
|
|
Right = 2
|
|
}
|
|
|
|
/// <summary>
|
|
/// 노드별 모터방향 정보 (방향 전환 지원 포함)
|
|
/// </summary>
|
|
public class NodeMotorInfo
|
|
{
|
|
/// <summary>
|
|
/// 일련번호
|
|
/// </summary>
|
|
public int seq { get; set; }
|
|
/// <summary>
|
|
/// 노드 ID
|
|
/// </summary>
|
|
public string NodeId { get; set; }
|
|
|
|
/// <summary>
|
|
/// RFID Value
|
|
/// </summary>
|
|
public ushort RfidId { get; set; }
|
|
|
|
/// <summary>
|
|
/// 해당 노드에서의 모터방향
|
|
/// </summary>
|
|
public AgvDirection MotorDirection { get; set; }
|
|
|
|
/// <summary>
|
|
/// 해당 노드에서의 제한 속도
|
|
/// </summary>
|
|
public SpeedLevel Speed { get; set; } = SpeedLevel.M;
|
|
|
|
/// <summary>
|
|
/// 마그넷 센서 방향 제어 (갈림길 처리용)
|
|
/// </summary>
|
|
public MagnetDirection MagnetDirection { get; set; }
|
|
|
|
/// <summary>
|
|
/// 다음 노드 ID (경로예측용)
|
|
/// </summary>
|
|
public MapNode NextNode { get; set; }
|
|
|
|
/// <summary>
|
|
/// 회전 가능 노드 여부
|
|
/// </summary>
|
|
public bool CanRotate { get; set; }
|
|
|
|
/// <summary>
|
|
/// 방향 전환이 발생하는 노드 여부
|
|
/// </summary>
|
|
public bool IsDirectionChangePoint { get; set; }
|
|
|
|
/// <summary>
|
|
/// 특수 동작이 필요한 노드 여부 (갈림길 전진/후진 반복)
|
|
/// </summary>
|
|
public bool RequiresSpecialAction { get; set; }
|
|
|
|
/// <summary>
|
|
/// 해당노드가 인식되면 이 값이 셋팅됩니다.
|
|
/// </summary>
|
|
public bool IsPass { get; set; }
|
|
|
|
public bool IsTurn { get; set; }
|
|
/// <summary>
|
|
/// 특수 동작 설명
|
|
/// </summary>
|
|
public string SpecialActionDescription { get; set; }
|
|
|
|
public NodeMotorInfo(int seqno,string nodeId,ushort rfid,
|
|
AgvDirection motorDirection, MapNode nextNodeId = null, MagnetDirection magnetDirection = MagnetDirection.Straight,bool turn=false)
|
|
{
|
|
IsTurn = turn;
|
|
seq = seqno;
|
|
NodeId = nodeId;
|
|
RfidId = rfid;
|
|
MotorDirection = motorDirection;
|
|
MagnetDirection = magnetDirection;
|
|
NextNode = nextNodeId;
|
|
CanRotate = false;
|
|
IsDirectionChangePoint = false;
|
|
RequiresSpecialAction = false;
|
|
SpecialActionDescription = string.Empty;
|
|
IsPass = false;
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// 디버깅용 문자열 표현
|
|
/// </summary>
|
|
public override string ToString()
|
|
{
|
|
var result = $"R{RfidId}[*{NodeId}]:{MotorDirection}";
|
|
|
|
// 마그넷 방향이 직진이 아닌 경우 표시
|
|
if (MagnetDirection != MagnetDirection.Straight)
|
|
result += $"({MagnetDirection})";
|
|
|
|
if (IsDirectionChangePoint)
|
|
result += " [방향전환]";
|
|
|
|
if (CanRotate)
|
|
result += " [회전가능]";
|
|
|
|
if (RequiresSpecialAction)
|
|
result += $" [특수동작:{SpecialActionDescription}]";
|
|
|
|
if (IsPass) result += "(O)";
|
|
|
|
return result;
|
|
}
|
|
}
|
|
} |