..
This commit is contained in:
@@ -20,7 +20,7 @@ namespace AGVControl.Models
|
||||
|
||||
public class movehistorydata : RFIDPoint
|
||||
{
|
||||
public Direction Direction { get; set; }
|
||||
public AgvDir Direction { get; set; }
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
@@ -58,22 +58,37 @@ namespace AGVControl.Models
|
||||
public double BatteryTemp2 { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// AGV
|
||||
/// AGV Speed
|
||||
/// </summary>
|
||||
public Direction CurrentAGVDirection { get; set; }
|
||||
public AgvSpeed CurrentSpeed { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// AGV모터 방향
|
||||
/// 외부에서 값이 상시 업데이트 됩니다.
|
||||
/// AGV STS
|
||||
/// </summary>
|
||||
public Direction CurrentMOTDirection { get; set; }
|
||||
public AgvSts CurrentSTS { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// AGV Motor Direction
|
||||
/// </summary>
|
||||
public AgvDir Current_Motor_Direction { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 현재위치가 수산되면 목적지까지의 방향값이 계산됩니다.
|
||||
/// </summary>
|
||||
public Direction TargetDirection { get; set; } = Direction.Stop;
|
||||
public AgvDir? TargetDirection { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// AGV.System1.agv_Run
|
||||
/// </summary>
|
||||
public bool IsMoving { get; set; }
|
||||
/// <summary>
|
||||
/// AGV.System1.Mark1_Check | Mark2_Check
|
||||
/// </summary>
|
||||
public bool IsMarkCheck { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 이동대상과 AGV의 머리방향이 일치하는지?
|
||||
/// </summary>
|
||||
public bool IsTargetDirectionMatch { get; set; }
|
||||
|
||||
/// <summary>
|
||||
@@ -104,13 +119,13 @@ namespace AGVControl.Models
|
||||
CurrentRFID = new RFIDPoint();
|
||||
TargetRFID = new RFIDPoint();
|
||||
|
||||
TargetDirection = Direction.Forward;
|
||||
TargetDirection = AgvDir.Forward;
|
||||
// BodyAngle = null;
|
||||
}
|
||||
|
||||
|
||||
// 이동 경로에 새로운 RFID 추가
|
||||
public void AddToMovementHistory(UInt16 rfidValue, Point position, Direction direction)
|
||||
public void AddToMovementHistory(UInt16 rfidValue, Point position, AgvDir direction)
|
||||
{
|
||||
// 중복 RFID가 연속으로 들어오는 경우 무시
|
||||
if (MovementHistory.Count > 0 && MovementHistory.Last().Value == rfidValue)
|
||||
@@ -134,7 +149,7 @@ namespace AGVControl.Models
|
||||
}
|
||||
|
||||
// 연결 정보 기반 실제 이동 방향 계산
|
||||
public Direction? CalculateActualDirectionByConnection(uint currentRFID, uint previousRFID, List<RFIDConnection> connections)
|
||||
public AgvDir? CalculateActualDirectionByConnection(uint currentRFID, uint previousRFID, List<RFIDConnection> connections)
|
||||
{
|
||||
if (connections == null || connections.Count == 0)
|
||||
return null;
|
||||
@@ -150,16 +165,16 @@ namespace AGVControl.Models
|
||||
// 연결 방향에 따라 실제 이동 방향 결정
|
||||
if (connection.P1.Value == previousRFID && connection.P2.Value == currentRFID)
|
||||
{
|
||||
return Direction.Forward; // Start -> End 방향으로 이동
|
||||
return AgvDir.Forward; // Start -> End 방향으로 이동
|
||||
}
|
||||
else
|
||||
{
|
||||
return Direction.Backward; // End -> Start 방향으로 이동
|
||||
return AgvDir.Backward; // End -> Start 방향으로 이동
|
||||
}
|
||||
}
|
||||
|
||||
// 연결 정보 기반 방향 불일치 검증 및 정정
|
||||
public bool ValidateAndCorrectDirectionByConnection(Direction expectedDirection, List<RFIDConnection> connections)
|
||||
public bool ValidateAndCorrectDirectionByConnection(AgvDir expectedDirection, List<RFIDConnection> connections)
|
||||
{
|
||||
if (MovementHistory.Count < 2 || connections == null)
|
||||
return true; // 검증 불가능한 경우
|
||||
@@ -180,7 +195,7 @@ namespace AGVControl.Models
|
||||
if (actualDirection.Value != expectedDirection)
|
||||
{
|
||||
// AGV 모터 방향을 실제 이동 방향으로 정정
|
||||
CurrentAGVDirection = actualDirection.Value;
|
||||
//CurrentAGVDirection = actualDirection.Value;
|
||||
TargetDirection = actualDirection.Value;
|
||||
|
||||
return false; // 정정됨을 알림
|
||||
@@ -190,7 +205,7 @@ namespace AGVControl.Models
|
||||
}
|
||||
|
||||
// RFID 순서 기반 실제 이동 방향 계산 (기존 메서드 - 호환성 유지)
|
||||
public Direction? CalculateActualDirectionByRFID()
|
||||
public AgvDir? CalculateActualDirectionByRFID()
|
||||
{
|
||||
if (MovementHistory.Count < 2)
|
||||
return null;
|
||||
@@ -206,11 +221,11 @@ namespace AGVControl.Models
|
||||
// RFID 값의 증가/감소로 방향 판단
|
||||
if (currentRFID.Value > prevRFID.Value)
|
||||
{
|
||||
return Direction.Forward; // RFID 값이 증가하면 전진
|
||||
return AgvDir.Forward; // RFID 값이 증가하면 전진
|
||||
}
|
||||
else if (currentRFID.Value < prevRFID.Value)
|
||||
{
|
||||
return Direction.Backward; // RFID 값이 감소하면 후진
|
||||
return AgvDir.Backward; // RFID 값이 감소하면 후진
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -5,15 +5,16 @@ namespace AGVControl
|
||||
{
|
||||
public class AGVActionPrediction
|
||||
{
|
||||
public Direction Direction { get; set; }
|
||||
public AgvDir Direction { get; set; }
|
||||
public RFIDPoint NextRFID { get; set; }
|
||||
public string Reason { get; set; }
|
||||
public AGVActionReasonCode ReasonCode { get; set; }
|
||||
public AGVMoveState MoveState { get; set; } // RUN 또는 STOP
|
||||
public AgvSpeed? MoveSpeed { get; set; }
|
||||
public AgvRunDirection? MoveDiv { get; set; }
|
||||
public AgvSts? MoveDiv { get; set; }
|
||||
public UInt32 Idx { get; set; }
|
||||
public bool Changed { get; set; }
|
||||
public DateTime CreateTime { get; set; }
|
||||
|
||||
// override object.Equals
|
||||
public bool Equals(AGVActionPrediction obj)
|
||||
|
||||
@@ -31,7 +31,7 @@ namespace AGVControl.Models
|
||||
/// AGV<47><56> <20>̵<EFBFBD><CCB5><EFBFBD><EFBFBD><EFBFBD>(<28><><EFBFBD><EFBFBD>Ʈ<EFBFBD><C6AE><EFBFBD><EFBFBD>)
|
||||
/// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><>ġ<EFBFBD><C4A1> <20><><EFBFBD><EFBFBD> <20>ش<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20>ֵ<EFBFBD>
|
||||
/// </summary>
|
||||
public Direction? LiftDirection { get; set; }
|
||||
public AgvDir? LiftDirection { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// AGV<47>̵<EFBFBD><CCB5><EFBFBD> <20>ӵ<EFBFBD> (high, middle, low)
|
||||
@@ -43,7 +43,7 @@ namespace AGVControl.Models
|
||||
/// <summary>
|
||||
/// AGV<47>̵<EFBFBD><CCB5><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>(<28>ºб<C2BA>, <20><><EFBFBD><EFBFBD>, <20><><EFBFBD>б<EFBFBD>)
|
||||
/// </summary>
|
||||
public AgvRunDirection? MoveDirection { get; set; }
|
||||
public AgvSts? MoveDirection { get; set; }
|
||||
|
||||
public RoadInformation()
|
||||
{
|
||||
|
||||
@@ -28,8 +28,8 @@ namespace AGVControl
|
||||
/// AGV의 이동방향(리프트방향)
|
||||
/// 목적지 방향과의 일치를 위해 해당 방향을 설정할 수 있따
|
||||
/// </summary>
|
||||
public Direction? LiftDirectionP { get; set; }
|
||||
public Direction? LiftDirectionN { get; set; }
|
||||
public AgvDir? LiftDirectionP { get; set; }
|
||||
public AgvDir? LiftDirectionN { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// AGV이동시 속도 (high, middle, low)
|
||||
@@ -40,8 +40,8 @@ namespace AGVControl
|
||||
/// <summary>
|
||||
/// AGV이동시 방향모드(좌분기, 전진, 우분기)
|
||||
/// </summary>
|
||||
public AgvRunDirection? MoveDirectionP { get; set; }
|
||||
public AgvRunDirection? MoveDirectionN { get; set; }
|
||||
public AgvSts? MoveDirectionP { get; set; }
|
||||
public AgvSts? MoveDirectionN { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 파일저장 및 불러오기시 사용하는 문자열로 반환
|
||||
@@ -112,38 +112,38 @@ namespace AGVControl
|
||||
this.EnableP = StrP[0] == "1";
|
||||
|
||||
if (StrP[1].isEmpty()) LiftDirectionP = null;
|
||||
else LiftDirectionP = (Direction)int.Parse(StrP[1]);
|
||||
else LiftDirectionP = (AgvDir)int.Parse(StrP[1]);
|
||||
|
||||
if (StrP[2].isEmpty()) MoveSpeedP = null;
|
||||
else MoveSpeedP = (AgvSpeed)int.Parse(StrP[2]);
|
||||
|
||||
if (StrP[3].isEmpty()) MoveDirectionP = null;
|
||||
else MoveDirectionP = (AgvRunDirection)int.Parse(StrP[3]);
|
||||
else MoveDirectionP = (AgvSts)int.Parse(StrP[3]);
|
||||
|
||||
//Negative
|
||||
this.EnableN = StrN[0] == "1";
|
||||
|
||||
if (StrN[1].isEmpty()) LiftDirectionN = null;
|
||||
else LiftDirectionN = (Direction)int.Parse(StrN[1]);
|
||||
else LiftDirectionN = (AgvDir)int.Parse(StrN[1]);
|
||||
|
||||
if (StrN[2].isEmpty()) MoveSpeedN = null;
|
||||
else MoveSpeedN = (AgvSpeed)int.Parse(StrN[2]);
|
||||
|
||||
if (StrN[3].isEmpty()) MoveDirectionN = null;
|
||||
else MoveDirectionN = (AgvRunDirection)int.Parse(StrN[3]);
|
||||
else MoveDirectionN = (AgvSts)int.Parse(StrN[3]);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.EnableP = buf[6] == "1";
|
||||
|
||||
if (buf[7].isEmpty()) LiftDirectionP = null;
|
||||
else LiftDirectionP = (Direction)int.Parse(buf[7]);
|
||||
else LiftDirectionP = (AgvDir)int.Parse(buf[7]);
|
||||
|
||||
if (buf[8].isEmpty()) MoveSpeedP = null;
|
||||
else MoveSpeedP = (AgvSpeed)int.Parse(buf[8]);
|
||||
|
||||
if (buf[9].isEmpty()) MoveDirectionP = null;
|
||||
else MoveDirectionP = (AgvRunDirection)int.Parse(buf[9]);
|
||||
else MoveDirectionP = (AgvSts)int.Parse(buf[9]);
|
||||
|
||||
this.EnableN = this.EnableP;
|
||||
this.LiftDirectionN = this.LiftDirectionP;
|
||||
|
||||
@@ -7,12 +7,18 @@ namespace AGVControl.Models
|
||||
public class RFIDPoint
|
||||
{
|
||||
public Point Location { get; set; }
|
||||
public uint Value { get; set; }
|
||||
public ushort Value { get; set; }
|
||||
public string NextRFID { get; set; } // 다음 RFID 포인트의 값
|
||||
public bool IsBidirectional { get; set; } // 양방향 연결 여부
|
||||
public bool IsRotatable { get; set; } // 회전 가능 여부
|
||||
public Direction? FixedDirection { get; set; } // 고정 방향(없으면 null)
|
||||
public AgvDir? FixedDirection { get; set; } // 고정 방향(없으면 null)
|
||||
public bool IsTerminal { get; set; } // 종단 여부
|
||||
public bool NeedTurn { get; set; }
|
||||
|
||||
public bool TurnStop { get; set; }
|
||||
public bool TurnOK { get; set; }
|
||||
public DateTime TurnStart { get; set; }
|
||||
public DateTime TurnEnd { get; set; }
|
||||
|
||||
[Browsable(false)]
|
||||
public RectangleF Bounds { get; set; }
|
||||
@@ -20,6 +26,10 @@ namespace AGVControl.Models
|
||||
{
|
||||
this.Location = Point.Empty;
|
||||
this.Value = 0;
|
||||
TurnStop = false;
|
||||
TurnOK = false;
|
||||
TurnStart = new DateTime(1982, 11, 23);
|
||||
TurnEnd = new DateTime(1982, 11, 23);
|
||||
}
|
||||
|
||||
public bool IsEmpty
|
||||
|
||||
@@ -6,31 +6,42 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace AGVControl
|
||||
{
|
||||
public enum Direction
|
||||
/// <summary>
|
||||
/// 실제 AGV컨트롤러의 STS값에는 F,B의 값이 들어있고
|
||||
/// 아래 항목은 해당 문자의 ASCII코드값이다 첫자를 byte로 변경하고 변환하면 된다
|
||||
/// </summary>
|
||||
public enum AgvDir : byte
|
||||
{
|
||||
Forward = 0,
|
||||
Backward = 1,
|
||||
Stop = 2
|
||||
Forward = 0x46,
|
||||
Backward = 0x42,
|
||||
}
|
||||
|
||||
|
||||
|
||||
public enum AGVMoveState
|
||||
{
|
||||
Stop = 0,
|
||||
Run
|
||||
}
|
||||
public enum AgvSpeed
|
||||
|
||||
/// <summary>
|
||||
/// 실제 AGV컨트롤러의 STS값에는 H,L,M,S의 값이 들어있고
|
||||
/// 아래 항목은 해당 문자의 ASCII코드값이다 첫자를 byte로 변경하고 변환하면 된다
|
||||
/// </summary>
|
||||
public enum AgvSpeed : byte
|
||||
{
|
||||
High,
|
||||
Middle,
|
||||
Low,
|
||||
High = 0x48,
|
||||
Middle = 0x4D,
|
||||
Low = 0x4C,
|
||||
MarkStop = 0x53,
|
||||
}
|
||||
public enum AgvRunDirection
|
||||
|
||||
/// <summary>
|
||||
/// STS : S,L,R
|
||||
/// </summary>
|
||||
public enum AgvSts : byte
|
||||
{
|
||||
Straight,
|
||||
Left,
|
||||
Right,
|
||||
Straight = 0x53,
|
||||
Left = 0x4c,
|
||||
Right = 0x052,
|
||||
}
|
||||
|
||||
public enum AGVActionReasonCode
|
||||
@@ -41,11 +52,21 @@ namespace AGVControl
|
||||
NotOnPath, // 현재 위치가 경로에 없음
|
||||
Arrived, // 경로의 마지막 지점(목적지 도달)
|
||||
Normal, // 정상(다음 RFID 있음)
|
||||
NeedTurn,
|
||||
|
||||
/// <summary>
|
||||
/// 방향전환을 위한 턴이다
|
||||
/// </summary>
|
||||
NeedTurnMove,
|
||||
|
||||
/// <summary>
|
||||
/// 지정된 RFID위치에서 TURN이 요청되었다
|
||||
/// </summary>
|
||||
NeedTurnPoint,
|
||||
NoTurnPoint,
|
||||
PathCalcError,
|
||||
NoDirection,
|
||||
MoveForTurn,
|
||||
busy,
|
||||
WaitForMarkStop,
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user