..
This commit is contained in:
@@ -7,8 +7,26 @@ namespace arDev
|
||||
|
||||
public class AgvData
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// S: Straight
|
||||
/// L: Left
|
||||
/// R: Right
|
||||
/// </summary>
|
||||
public char Sts { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// H : High
|
||||
/// M : Middle
|
||||
/// L : Low
|
||||
/// S : Mark Stop
|
||||
/// </summary>
|
||||
public char Speed { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// F : Front
|
||||
/// B : Back
|
||||
/// </summary>
|
||||
public char Direction { get; set; }
|
||||
|
||||
public int guidesensor { get; set; }
|
||||
|
||||
@@ -712,13 +712,13 @@ namespace AGVControl
|
||||
/// </summary>
|
||||
/// <param name="rfidTagNo">RFID TagNo</param>
|
||||
/// <returns></returns>
|
||||
public bool SetCurrentPosition(UInt16 rfidTagNo)
|
||||
public bool SetCurrentPosition(ushort rfidTagNo)
|
||||
{
|
||||
var rfidPoint = Manager.FindRFIDPoint(rfidTagNo);
|
||||
if (rfidPoint != null)
|
||||
{
|
||||
// 이동 경로에 추가 (위치 업데이트보다 먼저)
|
||||
Manager.agv.AddToMovementHistory(rfidTagNo, rfidPoint.Location, Manager.agv.CurrentMOTDirection);
|
||||
Manager.agv.AddToMovementHistory(rfidTagNo, rfidPoint.Location, Manager.agv.Current_Motor_Direction);
|
||||
|
||||
// AGV 위치 업데이트
|
||||
Manager.agv.CurrentRFID = rfidPoint;
|
||||
@@ -1053,7 +1053,7 @@ namespace AGVControl
|
||||
// 고정방향이 있으면 테두리 색상 표시
|
||||
if (rfid.FixedDirection.HasValue)
|
||||
{
|
||||
Color borderColor = rfid.FixedDirection.Value == Direction.Forward ? Color.DeepSkyBlue : Color.Gold;
|
||||
Color borderColor = rfid.FixedDirection.Value == AgvDir.Forward ? Color.DeepSkyBlue : Color.Gold;
|
||||
using (var pen = new Pen(borderColor, 2))
|
||||
{
|
||||
g.DrawEllipse(pen, rfid.Bounds.Expand(5, 5));
|
||||
@@ -1098,7 +1098,7 @@ namespace AGVControl
|
||||
RFIDPoint TargetPT = null;
|
||||
|
||||
//뒤로이동하는경우라면 이전위치에 리프트가 있다.
|
||||
if (lstpt.Direction == Direction.Backward)
|
||||
if (lstpt.Direction == AgvDir.Backward)
|
||||
{
|
||||
TargetPT = prept;
|
||||
}
|
||||
@@ -1134,7 +1134,7 @@ namespace AGVControl
|
||||
g.DrawEllipse(circlePen, circleRect);
|
||||
|
||||
//motor direction
|
||||
var str = Manager.agv.CurrentMOTDirection.ToString().Substring(0, 1);
|
||||
var str = Manager.agv.Current_Motor_Direction.ToString().Substring(0, 1);
|
||||
var strsize = g.MeasureString(str, this.Font);
|
||||
g.DrawString(str, this.Font, Brushes.White, circleRect, new StringFormat
|
||||
{
|
||||
@@ -1430,7 +1430,7 @@ namespace AGVControl
|
||||
if (connection.MoveDirectionP != null)
|
||||
{
|
||||
// if (DriveMethod.isEmpty() == false) DriveMethod += "|";
|
||||
DriveMethod += ((AgvRunDirection)connection.MoveDirectionP).ToString()[0];
|
||||
DriveMethod += ((AgvSts)connection.MoveDirectionP).ToString()[0];
|
||||
}
|
||||
else DriveMethod += nulChar;
|
||||
if (connection.MoveSpeedP != null)
|
||||
@@ -1442,7 +1442,7 @@ namespace AGVControl
|
||||
if (connection.LiftDirectionP != null)
|
||||
{
|
||||
//if (DriveMethod.isEmpty() == false) DriveMethod += "|";
|
||||
DriveMethod += ((AgvRunDirection)connection.LiftDirectionP).ToString()[0];
|
||||
DriveMethod += ((AgvSts)connection.LiftDirectionP).ToString()[0];
|
||||
}
|
||||
else DriveMethod += nulChar;
|
||||
|
||||
@@ -1482,7 +1482,7 @@ namespace AGVControl
|
||||
if (connection.MoveDirectionN != null)
|
||||
{
|
||||
//if (DriveMethod.isEmpty() == false) DriveMethod += "|";
|
||||
DriveMethod += ((AgvRunDirection)connection.MoveDirectionN).ToString()[0];
|
||||
DriveMethod += ((AgvSts)connection.MoveDirectionN).ToString()[0];
|
||||
}
|
||||
else DriveMethod += nulChar;
|
||||
if (connection.MoveSpeedN != null)
|
||||
@@ -1494,7 +1494,7 @@ namespace AGVControl
|
||||
if (connection.LiftDirectionN != null)
|
||||
{
|
||||
//if (DriveMethod.isEmpty() == false) DriveMethod += "|";
|
||||
DriveMethod += ((AgvRunDirection)connection.LiftDirectionN).ToString()[0];
|
||||
DriveMethod += ((AgvSts)connection.LiftDirectionN).ToString()[0];
|
||||
}
|
||||
else DriveMethod += nulChar;
|
||||
|
||||
@@ -1779,7 +1779,7 @@ namespace AGVControl
|
||||
rfidPoint.IsRotatable = isRotatable;
|
||||
}
|
||||
if (rfidParts.Length >= 5 && !string.IsNullOrEmpty(rfidParts[4]))
|
||||
rfidPoint.FixedDirection = (Direction)Enum.Parse(typeof(Direction), rfidParts[4]);
|
||||
rfidPoint.FixedDirection = (AgvDir)Enum.Parse(typeof(AgvDir), rfidParts[4]);
|
||||
if (rfidParts.Length >= 6)
|
||||
{
|
||||
bool isTerminal;
|
||||
|
||||
@@ -64,7 +64,7 @@ namespace AGVControl
|
||||
PredictResult = CreatePrediction("이전 작업이 완료되지 않았습니다",
|
||||
AGVActionReasonCode.busy,
|
||||
AGVMoveState.Stop,
|
||||
agv.CurrentMOTDirection, false);
|
||||
agv.Current_Motor_Direction, false);
|
||||
return PredictResult;
|
||||
}
|
||||
|
||||
@@ -80,9 +80,9 @@ namespace AGVControl
|
||||
PredictResult = CreatePrediction("AGV 위치 미확정(처음 기동)",
|
||||
AGVActionReasonCode.NoPosition,
|
||||
AGVMoveState.Run,
|
||||
Direction.Backward, true,
|
||||
AgvDir.Backward, true,
|
||||
moveSpeed: AgvSpeed.Low,
|
||||
moveDiv: AgvRunDirection.Straight);
|
||||
moveDiv: AgvSts.Straight);
|
||||
return PredictResult;
|
||||
}
|
||||
|
||||
@@ -92,9 +92,9 @@ namespace AGVControl
|
||||
PredictResult = CreatePrediction("AGV이동방향 알수없음",
|
||||
AGVActionReasonCode.NoDirection,
|
||||
AGVMoveState.Run,
|
||||
Direction.Backward, true,
|
||||
AgvDir.Backward, true,
|
||||
moveSpeed: AgvSpeed.Low,
|
||||
moveDiv: AgvRunDirection.Straight);
|
||||
moveDiv: AgvSts.Straight);
|
||||
return PredictResult;
|
||||
}
|
||||
|
||||
@@ -107,7 +107,7 @@ namespace AGVControl
|
||||
PredictResult = CreatePrediction("경로 없음 또는 현재 위치 미확정",
|
||||
AGVActionReasonCode.NoPath,
|
||||
AGVMoveState.Stop,
|
||||
agv.CurrentMOTDirection, true);
|
||||
agv.Current_Motor_Direction, true);
|
||||
return PredictResult;
|
||||
}
|
||||
else
|
||||
@@ -117,10 +117,10 @@ namespace AGVControl
|
||||
var prlt = CalculatePath(CurPt, agv.TargetRFID);
|
||||
if (prlt.Success == false)
|
||||
{
|
||||
PredictResult = CreatePrediction("목적지 경로 예측 실패",
|
||||
PredictResult = CreatePrediction("목적지 경로 예측 실패",
|
||||
AGVActionReasonCode.Unknown,
|
||||
AGVMoveState.Stop,
|
||||
agv.CurrentMOTDirection, true,
|
||||
agv.Current_Motor_Direction, true,
|
||||
nextRFID: agv.TargetRFID);
|
||||
return PredictResult;
|
||||
}
|
||||
@@ -140,12 +140,10 @@ namespace AGVControl
|
||||
PredictResult = CreatePrediction("현재 위치가 경로에 없음",
|
||||
AGVActionReasonCode.NotOnPath,
|
||||
AGVMoveState.Stop,
|
||||
agv.CurrentMOTDirection, true);
|
||||
agv.Current_Motor_Direction, true);
|
||||
return PredictResult;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// 4. 목적지 도달 전, 회전이 필요한경우인가?
|
||||
// 목적지 RFID 정보
|
||||
var destRFID = agv.MainPath.Last();
|
||||
@@ -163,7 +161,7 @@ namespace AGVControl
|
||||
if (IsLiftDir == false)
|
||||
{
|
||||
AgvSpeed? agv_spd = null;
|
||||
AgvRunDirection? agv_dir = null;
|
||||
AgvSts? agv_dir = null;
|
||||
|
||||
//회전가능한 위치로 이동을 해야한다
|
||||
|
||||
@@ -174,7 +172,7 @@ namespace AGVControl
|
||||
PredictResult = CreatePrediction("회전 가능한 위치가 없습니다",
|
||||
AGVActionReasonCode.NoTurnPoint,
|
||||
AGVMoveState.Stop,
|
||||
agv.CurrentMOTDirection, true);
|
||||
agv.Current_Motor_Direction, true);
|
||||
return PredictResult;
|
||||
}
|
||||
|
||||
@@ -195,7 +193,7 @@ namespace AGVControl
|
||||
PredictResult = CreatePrediction("회전 위치까지의 경로를 계산할 수 없습니다",
|
||||
AGVActionReasonCode.PathCalcError,
|
||||
AGVMoveState.Stop,
|
||||
agv.CurrentMOTDirection, true,
|
||||
agv.Current_Motor_Direction, true,
|
||||
nextRFID: nearTurnPoint);
|
||||
return PredictResult;
|
||||
}
|
||||
@@ -205,7 +203,7 @@ namespace AGVControl
|
||||
//현재 모터방향을 확인하여 대상까지 이동하도록 해야한다
|
||||
var curidx = agv.SubPath.FindIndex(t => t.Value == curPT.Value);
|
||||
var preidx = agv.SubPath.FindIndex(t => t.Value == PrePT.Value);
|
||||
Direction newdirection = agv.CurrentMOTDirection;
|
||||
AgvDir newdirection = agv.Current_Motor_Direction;
|
||||
string message = "턴위치로 이동중";
|
||||
|
||||
|
||||
@@ -213,13 +211,11 @@ namespace AGVControl
|
||||
if (preidx > curidx)
|
||||
{
|
||||
//지정경로를 거꾸로 이동하고 있다
|
||||
if (agv.CurrentMOTDirection == Direction.Forward)
|
||||
newdirection = Direction.Backward;
|
||||
if (agv.Current_Motor_Direction == AgvDir.Forward)
|
||||
newdirection = AgvDir.Backward;
|
||||
else
|
||||
newdirection = Direction.Forward;
|
||||
newdirection = AgvDir.Forward;
|
||||
message += "(방향전환)";
|
||||
|
||||
|
||||
}
|
||||
|
||||
//도로정보를 확인하여 속도와 분기명령을 실행한다
|
||||
@@ -232,7 +228,7 @@ namespace AGVControl
|
||||
AGVMoveState.Run,
|
||||
newdirection, true,
|
||||
moveSpeed: agv_spd,
|
||||
moveDiv: agv_dir,
|
||||
moveDiv: agv_dir,
|
||||
nextRFID: nearTurnPoint);
|
||||
return PredictResult;
|
||||
}
|
||||
@@ -242,10 +238,10 @@ namespace AGVControl
|
||||
agv_dir = roadinfo2.dir;
|
||||
|
||||
|
||||
PredictResult = CreatePrediction("턴 완료 대기",
|
||||
AGVActionReasonCode.NeedTurn,
|
||||
PredictResult = CreatePrediction("턴(이동) 완료 대기",
|
||||
AGVActionReasonCode.NeedTurnMove,
|
||||
AGVMoveState.Stop,
|
||||
agv.CurrentMOTDirection, true,
|
||||
agv.Current_Motor_Direction, true,
|
||||
moveSpeed: agv_spd,
|
||||
moveDiv: agv_dir,
|
||||
nextRFID: nearTurnPoint);
|
||||
@@ -256,21 +252,53 @@ namespace AGVControl
|
||||
if (agv.SubPath != null && agv.SubPath.Any())
|
||||
agv.SubPath.Clear();
|
||||
|
||||
//현재위치의 RFID에서 턴이 필요한경우
|
||||
if (agv.CurrentRFID.NeedTurn)
|
||||
{
|
||||
//Turn이 완료되지 않았다면 턴 완료를 대기한다.
|
||||
if (agv.CurrentRFID.TurnOK == false)
|
||||
{
|
||||
//아직 턴위치에 멈추지 않았다
|
||||
if (agv.CurrentRFID.TurnStop == false)
|
||||
{
|
||||
//현재위치로 마크스탑이동을 하게한다
|
||||
PredictResult = CreatePrediction("Wait for Turn(P)-Mark Stop",
|
||||
AGVActionReasonCode.WaitForMarkStop,
|
||||
AGVMoveState.Run,
|
||||
agv.Current_Motor_Direction, true,
|
||||
moveSpeed: agv.CurrentSpeed,
|
||||
moveDiv: agv.CurrentSTS);
|
||||
}
|
||||
else
|
||||
{
|
||||
//턴위치에 정지했으니. 턴완료를 기다려야 한다
|
||||
PredictResult = CreatePrediction("Wait for Turn(P)",
|
||||
AGVActionReasonCode.NeedTurnPoint,
|
||||
AGVMoveState.Run,
|
||||
agv.Current_Motor_Direction, true,
|
||||
moveSpeed: agv.CurrentSpeed,
|
||||
moveDiv: agv.CurrentSTS);
|
||||
}
|
||||
return PredictResult;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//3. 목적지위치까지 이동이 완료되지 않았다면 계속 이동을 하게한다
|
||||
if (agv.CurrentRFID.Value != destRFID.Value)
|
||||
{
|
||||
//현재 모터방향을 확인하여 대상까지 이동하도록 해야한다
|
||||
var curidx = agv.MainPath.FindIndex(t => t.Value == curPT.Value);
|
||||
var preidx = agv.MainPath.FindIndex(t => t.Value == PrePT.Value);
|
||||
Direction newdirection = agv.CurrentMOTDirection;
|
||||
AgvDir newdirection = agv.Current_Motor_Direction;
|
||||
string message = "목적지 이동중";
|
||||
if (preidx > curidx)
|
||||
{
|
||||
//지정경로를 거꾸로 이동하고 있다
|
||||
if (agv.CurrentMOTDirection == Direction.Forward)
|
||||
newdirection = Direction.Backward;
|
||||
if (agv.Current_Motor_Direction == AgvDir.Forward)
|
||||
newdirection = AgvDir.Backward;
|
||||
else
|
||||
newdirection = Direction.Forward;
|
||||
newdirection = AgvDir.Forward;
|
||||
message += "(방향전환)";
|
||||
}
|
||||
|
||||
@@ -294,7 +322,7 @@ namespace AGVControl
|
||||
PredictResult = CreatePrediction("경로의 마지막 지점(목적지 도달)",
|
||||
AGVActionReasonCode.Arrived,
|
||||
AGVMoveState.Stop,
|
||||
agv.CurrentMOTDirection, true,
|
||||
agv.Current_Motor_Direction, true,
|
||||
nextRFID: destRFID);
|
||||
return PredictResult;
|
||||
}
|
||||
@@ -304,7 +332,7 @@ namespace AGVControl
|
||||
PredictResult = CreatePrediction($"ERR:{ex.Message}",
|
||||
AGVActionReasonCode.Unknown,
|
||||
AGVMoveState.Stop,
|
||||
agv.CurrentMOTDirection, true);
|
||||
agv.Current_Motor_Direction, true);
|
||||
return PredictResult;
|
||||
}
|
||||
finally
|
||||
@@ -314,11 +342,11 @@ namespace AGVControl
|
||||
|
||||
}
|
||||
|
||||
(AgvSpeed? spd, AgvRunDirection? dir, RFIDConnection info) GetRoadInfo(List<RFIDPoint> paths, RFIDPoint curPT)
|
||||
(AgvSpeed? spd, AgvSts? dir, RFIDConnection info) GetRoadInfo(List<RFIDPoint> paths, RFIDPoint curPT)
|
||||
{
|
||||
//도로정보를 확인하여 속도와 분기명령을 실행한다
|
||||
AgvSpeed? agv_spd = null;
|
||||
AgvRunDirection? agv_div = null;
|
||||
AgvSts? agv_div = null;
|
||||
RFIDConnection info = null;
|
||||
|
||||
var nextpt = paths.Skip(paths.FindIndex(t => t.Value == curPT.Value) + 1).FirstOrDefault();
|
||||
@@ -504,7 +532,7 @@ namespace AGVControl
|
||||
var lstpt = agv.MovementHistory.Last();
|
||||
|
||||
//뒤로이동하는경우라면 이전위치에 리프트가 있다.
|
||||
if (lstpt.Direction == Direction.Backward)
|
||||
if (lstpt.Direction == AgvDir.Backward)
|
||||
{
|
||||
TargetPT = prept;
|
||||
}
|
||||
@@ -566,9 +594,9 @@ namespace AGVControl
|
||||
string reason,
|
||||
AGVActionReasonCode reasonCode,
|
||||
AGVMoveState moveState,
|
||||
Direction direction, bool IDXUpdate = true,
|
||||
AgvDir direction, bool IDXUpdate = true,
|
||||
AgvSpeed? moveSpeed = null,
|
||||
AgvRunDirection? moveDiv = null,
|
||||
AgvSts? moveDiv = null,
|
||||
RFIDPoint nextRFID = null
|
||||
)
|
||||
{
|
||||
@@ -581,7 +609,8 @@ namespace AGVControl
|
||||
Direction = direction,
|
||||
MoveSpeed = moveSpeed,
|
||||
MoveDiv = moveDiv,
|
||||
Idx = IDXUpdate ? (PredictResult?.Idx + 1 ?? 1) : (PredictResult?.Idx ?? 0)
|
||||
Idx = IDXUpdate ? (PredictResult?.Idx + 1 ?? 1) : (PredictResult?.Idx ?? 0),
|
||||
CreateTime = DateTime.Now,
|
||||
};
|
||||
|
||||
newPrediction.Changed = IsPredictionChanged(newPrediction);
|
||||
|
||||
@@ -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,
|
||||
}
|
||||
}
|
||||
@@ -191,6 +191,9 @@ namespace COMM
|
||||
BatWarnTime,
|
||||
IdleStopTime,
|
||||
StatusReporttime,
|
||||
|
||||
CheckGotoTargetSet,
|
||||
SendGotoCommand,
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user