namespace AGVNavigationCore.Models
{
///
/// AGV 마그넷 센서 방향 제어
///
public enum MagnetDirection
{
///
/// 직진 - 기본 마그넷 라인 추종
///
Straight = 0,
///
/// 좌측 - 마그넷 센서 가중치를 좌측으로 조정
///
Left = 1,
///
/// 우측 - 마그넷 센서 가중치를 우측으로 조정
///
Right = 2
}
///
/// 노드별 모터방향 정보 (방향 전환 지원 포함)
///
public class NodeMotorInfo
{
///
/// 일련번호
///
public int seq { get; set; }
///
/// 노드 ID
///
public string NodeId { get; set; }
///
/// RFID Value
///
public ushort RfidId { get; set; }
///
/// 해당 노드에서의 모터방향
///
public AgvDirection MotorDirection { get; set; }
///
/// 해당 노드에서의 제한 속도
///
public SpeedLevel Speed { get; set; } = SpeedLevel.M;
///
/// 마그넷 센서 방향 제어 (갈림길 처리용)
///
public MagnetDirection MagnetDirection { get; set; }
///
/// 다음 노드 ID (경로예측용)
///
public MapNode NextNode { get; set; }
///
/// 회전 가능 노드 여부
///
public bool CanRotate { get; set; }
///
/// 방향 전환이 발생하는 노드 여부
///
public bool IsDirectionChangePoint { get; set; }
///
/// 특수 동작이 필요한 노드 여부 (갈림길 전진/후진 반복)
///
public bool RequiresSpecialAction { get; set; }
///
/// 해당노드가 인식되면 이 값이 셋팅됩니다.
///
public bool IsPass { get; set; }
public bool IsTurn { get; set; }
///
/// 특수 동작 설명
///
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;
}
///
/// 디버깅용 문자열 표현
///
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;
}
}
}