..
This commit is contained in:
0
.tgitconfig
Normal file
0
.tgitconfig
Normal file
@@ -279,6 +279,9 @@
|
|||||||
<Compile Include="StateMachine\Step\_SM_RUN_CHGOFF.cs">
|
<Compile Include="StateMachine\Step\_SM_RUN_CHGOFF.cs">
|
||||||
<SubType>Form</SubType>
|
<SubType>Form</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Include="StateMachine\Step\_SM_RUN_GOTO.cs">
|
||||||
|
<SubType>Form</SubType>
|
||||||
|
</Compile>
|
||||||
<Compile Include="StateMachine\Step\_SM_RUN_GOCHARGECHECK.cs">
|
<Compile Include="StateMachine\Step\_SM_RUN_GOCHARGECHECK.cs">
|
||||||
<SubType>Form</SubType>
|
<SubType>Form</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
|||||||
@@ -9,21 +9,21 @@ namespace Project
|
|||||||
{
|
{
|
||||||
public static class Lang
|
public static class Lang
|
||||||
{
|
{
|
||||||
public static string 상차 = "상차";
|
|
||||||
public static string 하차 = "하차";
|
public static string 목적지가없어대기상태로전환합니다 = "목적지가 설정되지 않아 대기상태로 전환 합니다";
|
||||||
public static string 연결실패 = "연결 실패";
|
public static string 위치로이동합니다 = "위치로 이동 합니다";
|
||||||
|
public static string 전방에물체가감지되었습니다 = "전방에 물체가 감지 되었습니다";
|
||||||
|
public static string 비상정지신호가감지되었습니다 = "비상정지 신호가 감지 되었습니다";
|
||||||
|
public static string 비상정지로인해작업을중단합니다 = "비상정지로 인해 작업을 중단 합니다";
|
||||||
|
public static string 선로를이탈했습니다 = "선로를 이탈 했습니다";
|
||||||
|
public static string 충전이필요합니다자동모드로전환하세요 = "충전이 필요 합니다. 자동모드로 전환 하세요";
|
||||||
|
public static string 충전이필요합니다 = "충전이 필요 합니다";
|
||||||
|
public static string 배터리통신에문제가있습니다 = "배터리 통신에 문제가 있습니다";
|
||||||
|
public static string 자동운전상태가아닙니다 = "자동운전 상태가 아닙니다";
|
||||||
public static string 비상정지 = "비상 정지";
|
public static string 비상정지 = "비상 정지";
|
||||||
public static string 홈검색완료 = "홈 검색 완료";
|
public static string 연결실패 = "연결 실패";
|
||||||
public static string 현재위치를검색합니다 = "현재 위치를 검색 합니다";
|
public static string 현재위치를검색합니다 = "현재 위치를 검색 합니다";
|
||||||
public static string 충전완료로해제합니다 = "충전 완료로 해제 합니다";
|
public static string 충전완료로해제합니다 = "충전 완료로 해제 합니다";
|
||||||
public static string 오버로드감지 = "오버로드 감지";
|
|
||||||
public static string 상차작업을시작합니다 { get { return string.Format("{0} 작업을 시작 합니다",상차); } }
|
|
||||||
public static string 하차작업을시작합니다 { get { return string.Format("{0} 작업을 시작 합니다", 하차); } }
|
|
||||||
public static string 안전커버를내려주세요 = "안전 커버를 내려 주세요";
|
|
||||||
public static string 안전커버를올려주세요 = "안전 커버를 올려 주세요";
|
|
||||||
public static string 안전커버를올리면하차가완료됩니다 = "안전 커버를 올리면 하차가 완료 됩니다";
|
|
||||||
public static string 안전커버를올리면상차가완료됩니다 = "안전 커버를 올리면 상차가 완료 됩니다";
|
|
||||||
public static string 안전커버를내립니다 = "안전 커버를 내립니다";
|
|
||||||
public static string 장비상태초기화 = "장비 상태 초기화";
|
public static string 장비상태초기화 = "장비 상태 초기화";
|
||||||
public static string 충전을시작합니다 = "충전을 시작 합니다";
|
public static string 충전을시작합니다 = "충전을 시작 합니다";
|
||||||
public static string 충전을해제합니다 = "충전을 해제 합니다";
|
public static string 충전을해제합니다 = "충전을 해제 합니다";
|
||||||
@@ -40,36 +40,42 @@ namespace Project
|
|||||||
public static string 충전시작명령을전송합니다 = "충전 시작명령을 전송 합니다";
|
public static string 충전시작명령을전송합니다 = "충전 시작명령을 전송 합니다";
|
||||||
public static string 충전기위치오류로작업을취소합니다 = "충전기 위치 오류로 인해 작업을 취소 합니다";
|
public static string 충전기위치오류로작업을취소합니다 = "충전기 위치 오류로 인해 작업을 취소 합니다";
|
||||||
public static string 프로그램이초기화되었습니다 = "프로그램이 초기화 되었습니다";
|
public static string 프로그램이초기화되었습니다 = "프로그램이 초기화 되었습니다";
|
||||||
public static string 홈으로이동합니다 = "홈 으로 이동 합니다";
|
|
||||||
public static string 전방에물체가감지되었습니다 = "전방에 물체가 감지 되었습니다";
|
|
||||||
public static string 비상정지신호가감지되었습니다 = "비상정지 신호가 감지 되었습니다";
|
|
||||||
public static string 비상정지로인해작업을중단합니다 = "비상정지로 인해 작업을 중단 합니다";
|
|
||||||
public static string 선로를이탈했습니다 = "선로를 이탈 했습니다";
|
|
||||||
public static string 충전이필요합니다자동모드로전환하세요 = "충전이 필요 합니다. 자동모드로 전환 하세요";
|
|
||||||
public static string 충전이필요합니다 = "충전이 필요 합니다";
|
|
||||||
public static string 배터리통신에문제가있습니다 = "배터리 통신에 문제가 있습니다";
|
|
||||||
public static string 자동운전상태가아닙니다 = "자동운전 상태가 아닙니다";
|
|
||||||
public static string 위치로이동합니다 = "위치로 이동 합니다";
|
|
||||||
public static string 대기상태로전환합니다 = "대기 상태로 전환 합니다";
|
public static string 대기상태로전환합니다 = "대기 상태로 전환 합니다";
|
||||||
public static string 홈이동완료대기상태로전환합니다 = "홈 이동이 완료 되었습니다. 대기 상태로 전환 합니다";
|
|
||||||
public static string 커버를내립니다 = "커버를 내립니다";
|
|
||||||
public static string 커버를올립니다 = "커버를 올립니다";
|
|
||||||
public static string 홈검색을시작합니다 = "홈 검색을 시작 합니다";
|
|
||||||
public static string 홈위치로이동합니다 = "홈 위치로 이동 합니다";
|
|
||||||
public static string 하차작업이완료되었습니다 = "하차 작업이 완료 되었습니다";
|
|
||||||
public static string 상차작업이완료되었습니다 = "상차 작업이 완료 되었습니다";
|
|
||||||
public static string 작업종료 = "작업 종료";
|
public static string 작업종료 = "작업 종료";
|
||||||
public static string 자동전환 = "자동 전환";
|
public static string 자동전환 = "자동 전환";
|
||||||
public static string 충전기위치오류 = "충전기 위치 오류";
|
public static string 충전기위치오류 = "충전기 위치 오류";
|
||||||
public static string 다음마크위치에서정지합니다 = "다음 마크위치에서 정지 합니다";
|
public static string 다음마크위치에서정지합니다 = "다음 마크위치에서 정지 합니다";
|
||||||
public static string 충전이감지되어수동충전으로전환합니다 = "충전이 감지되어 수동충전으로 전환 합니다";
|
public static string 충전이감지되어수동충전으로전환합니다 = "충전이 감지되어 수동충전으로 전환 합니다";
|
||||||
|
public static string PLC연결실패 { get { return string.Format("PLC {0}", 연결실패); } }
|
||||||
|
public static string PLC통신실패 = "PLC 통신실패";
|
||||||
|
public static string AGV연결실패 { get { return string.Format("AGV {0}", 연결실패); } }
|
||||||
|
public static string 예측값이계산되지않아이동을중단합니다 = "이동 예측이 동작하지 않습니다. 개발부서에 문의 하세요";
|
||||||
|
public static string 목적지이동이완료되었습니다 = "목적지 이동 이 완료 되었습니다";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public static string 상차 = "상차";
|
||||||
|
public static string 하차 = "하차";
|
||||||
|
public static string 홈검색완료 = "홈 검색 완료";
|
||||||
|
public static string 오버로드감지 = "오버로드 감지";
|
||||||
|
public static string 상차작업을시작합니다 { get { return string.Format("{0} 작업을 시작 합니다",상차); } }
|
||||||
|
public static string 하차작업을시작합니다 { get { return string.Format("{0} 작업을 시작 합니다", 하차); } }
|
||||||
|
public static string 안전커버를내려주세요 = "안전 커버를 내려 주세요";
|
||||||
|
public static string 안전커버를올려주세요 = "안전 커버를 올려 주세요";
|
||||||
|
public static string 안전커버를올리면상차가완료됩니다 = "안전 커버를 올리면 상차가 완료 됩니다";
|
||||||
|
public static string 안전커버를내립니다 = "안전 커버를 내립니다";
|
||||||
|
public static string 홈으로이동합니다 = "홈 으로 이동 합니다";
|
||||||
|
public static string 홈이동완료대기상태로전환합니다 = "홈 이동이 완료 되었습니다. 대기 상태로 전환 합니다";
|
||||||
|
public static string 커버를내립니다 = "커버를 내립니다";
|
||||||
|
public static string 커버를올립니다 = "커버를 올립니다";
|
||||||
|
|
||||||
|
public static string 홈위치로이동합니다 = "홈 위치로 이동 합니다";
|
||||||
|
public static string 하차작업이완료되었습니다 = "하차 작업이 완료 되었습니다";
|
||||||
|
public static string 상차작업이완료되었습니다 = "상차 작업이 완료 되었습니다";
|
||||||
public static string 커버업대기상태가아닙니다 = "커버 업 대기 상태가 아닙니다";
|
public static string 커버업대기상태가아닙니다 = "커버 업 대기 상태가 아닙니다";
|
||||||
public static string QC이동버튼은상하차에서만사용가능합니다 = "QC이동 버튼은 상,하차 에서만 사용 가능합니다";
|
public static string QC이동버튼은상하차에서만사용가능합니다 = "QC이동 버튼은 상,하차 에서만 사용 가능합니다";
|
||||||
public static string QA이동버튼은상하차에서만사용가능합니다 = "QA이동 버튼은 상,하차 에서만 사용 가능합니다";
|
public static string QA이동버튼은상하차에서만사용가능합니다 = "QA이동 버튼은 상,하차 에서만 사용 가능합니다";
|
||||||
public static string 하차상태에서만사용가능합니다 = "하차 상태에서만 사용가능 합니다";
|
public static string 하차상태에서만사용가능합니다 = "하차 상태에서만 사용가능 합니다";
|
||||||
|
|
||||||
public static string PLC연결실패 { get { return string.Format("PLC {0}", 연결실패); } }
|
|
||||||
public static string PLC통신실패 = "PLC 통신실패";
|
|
||||||
public static string AGV연결실패 { get { return string.Format("AGV {0}",연결실패); } }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -26,7 +26,7 @@ namespace Project.Device
|
|||||||
{
|
{
|
||||||
public bool IsError { get; set; }
|
public bool IsError { get; set; }
|
||||||
public string Message { get; set; }
|
public string Message { get; set; }
|
||||||
public MessageArgs(bool iserr,string m)
|
public MessageArgs(bool iserr, string m)
|
||||||
{
|
{
|
||||||
this.IsError = iserr;
|
this.IsError = iserr;
|
||||||
this.Message = m;
|
this.Message = m;
|
||||||
@@ -119,7 +119,7 @@ namespace Project.Device
|
|||||||
public void SendMoveComplete(string tag)
|
public void SendMoveComplete(string tag)
|
||||||
{
|
{
|
||||||
var id = PUB.setting.XBE_ID;
|
var id = PUB.setting.XBE_ID;
|
||||||
byte cmd = 2;
|
byte cmd = (byte)ENIGProtocol.AGVCommandEH.Arrived;
|
||||||
var data = System.Text.Encoding.Default.GetBytes(tag);
|
var data = System.Text.Encoding.Default.GetBytes(tag);
|
||||||
var packet = proto.CreatePacket(id, cmd, data);
|
var packet = proto.CreatePacket(id, cmd, data);
|
||||||
Send(packet);
|
Send(packet);
|
||||||
@@ -131,12 +131,28 @@ namespace Project.Device
|
|||||||
public void SendRFIDTag(string tag)
|
public void SendRFIDTag(string tag)
|
||||||
{
|
{
|
||||||
var id = PUB.setting.XBE_ID;
|
var id = PUB.setting.XBE_ID;
|
||||||
byte cmd = 3;
|
byte cmd = (byte)ENIGProtocol.AGVCommandEH.ReadRFID;
|
||||||
var data = System.Text.Encoding.Default.GetBytes(tag);
|
var data = System.Text.Encoding.Default.GetBytes(tag);
|
||||||
var packet = proto.CreatePacket(id, cmd, data);
|
var packet = proto.CreatePacket(id, cmd, data);
|
||||||
Send(packet);
|
Send(packet);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 오류코드를 호스트에 전송합니다
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="errcode"></param>
|
||||||
|
public void SendError(ENIGProtocol.AGVErrorCode errcode, string errormessage)
|
||||||
|
{
|
||||||
|
var id = PUB.setting.XBE_ID;
|
||||||
|
byte cmd = (byte)ENIGProtocol.AGVCommandEH.Error;
|
||||||
|
if (errormessage.Length > 30) errormessage = errormessage.Substring(0, 29);
|
||||||
|
|
||||||
|
var data = new byte[] { (byte)errcode };
|
||||||
|
var datamsg = System.Text.Encoding.Default.GetBytes(errormessage);
|
||||||
|
|
||||||
|
var packet = proto.CreatePacket(id, cmd, data);
|
||||||
|
Send(packet);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -208,7 +224,8 @@ namespace Project.Device
|
|||||||
Array.Copy(tagBytes, 0, data, 7, 6);
|
Array.Copy(tagBytes, 0, data, 7, 6);
|
||||||
|
|
||||||
// 데이터 전송
|
// 데이터 전송
|
||||||
var packet = proto.CreatePacket(PUB.setting.XBE_ID, 9, data);
|
var cmd = (byte)ENIGProtocol.AGVCommandEH.Status;
|
||||||
|
var packet = proto.CreatePacket(PUB.setting.XBE_ID, cmd, data);
|
||||||
Send(packet);
|
Send(packet);
|
||||||
LastStatusSendTime = DateTime.Now;
|
LastStatusSendTime = DateTime.Now;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,18 +29,29 @@ namespace Project
|
|||||||
//가동불가 조건 확인
|
//가동불가 조건 확인
|
||||||
if (CheckStopCondition() == false)
|
if (CheckStopCondition() == false)
|
||||||
{
|
{
|
||||||
PUB.sm.SetNewStep(eSMStep.PAUSE);
|
PUB.sm.SetNewStep(eSMStep.IDLE);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
//HW 연결오류
|
||||||
|
if (PUB.AGV.IsOpen == false)
|
||||||
|
{
|
||||||
|
PUB.Result.SetResultMessage(eResult.Hardware, eECode.AGVCONN, eNextStep.ERROR);
|
||||||
|
PUB.sm.SetNewStep(eSMStep.IDLE);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
//이머전시상태라면 stop 처리한다.
|
//이머전시상태라면 stop 처리한다.
|
||||||
if (PUB.AGV.error.Emergency && PUB.AGV.system1.agv_stop == true &&
|
if (PUB.AGV.error.Emergency &&
|
||||||
|
PUB.AGV.system1.agv_stop == true &&
|
||||||
PUB.AGV.system1.stop_by_front_detect == false)
|
PUB.AGV.system1.stop_by_front_detect == false)
|
||||||
{
|
{
|
||||||
PUB.Speak(Lang.비상정지로인해작업을중단합니다);
|
PUB.Speak(Lang.비상정지로인해작업을중단합니다);
|
||||||
PUB.sm.SetNewStep(eSMStep.IDLE);
|
PUB.sm.SetNewStep(eSMStep.IDLE);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//스텝이 변경되었다면?
|
//스텝이 변경되었다면?
|
||||||
if (PUB.sm.RunStep != PUB.sm.RunStepNew)
|
if (PUB.sm.RunStep != PUB.sm.RunStepNew)
|
||||||
{
|
{
|
||||||
@@ -49,6 +60,7 @@ namespace Project
|
|||||||
}
|
}
|
||||||
else runStepisFirst = false;
|
else runStepisFirst = false;
|
||||||
|
|
||||||
|
//처음시작이라면 시작시간을 설정한다
|
||||||
if (isFirst)
|
if (isFirst)
|
||||||
{
|
{
|
||||||
if (PUB.sm.RunStep == ERunStep.READY)
|
if (PUB.sm.RunStep == ERunStep.READY)
|
||||||
@@ -57,12 +69,52 @@ namespace Project
|
|||||||
VAR.TIME.Update(eVarTime.RunStart);
|
VAR.TIME.Update(eVarTime.RunStart);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//자동모드에서 대기상태 (추가동작없음)
|
||||||
|
if (PUB.sm.RunStep == ERunStep.READY)
|
||||||
|
{
|
||||||
|
_SM_RUN_READY(runStepisFirst, PUB.sm.GetRunSteptime);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
//#############################################
|
||||||
|
//## 이 후에는 모든 동작루틴이 온다
|
||||||
|
//#############################################
|
||||||
|
|
||||||
|
//라이더 센서에서 멈춘경우 처리
|
||||||
|
if (PUB.AGV.system1.stop_by_front_detect == true)
|
||||||
|
{
|
||||||
|
var tsSpeak = DateTime.Now - LastSpeakTime;
|
||||||
|
if (tsSpeak.TotalSeconds >= PUB.setting.doorSoundTerm)
|
||||||
|
{
|
||||||
|
PUB.Speak(Lang.전방에물체가감지되었습니다);
|
||||||
|
LastSpeakTime = DateTime.Now;
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
//나머지 상황체크
|
||||||
switch (PUB.sm.RunStep)
|
switch (PUB.sm.RunStep)
|
||||||
{
|
{
|
||||||
case ERunStep.READY:
|
case ERunStep.GOTO: //목적지까지 이동하는 경우
|
||||||
_SM_RUN_READY(runStepisFirst, PUB.sm.GetRunSteptime);
|
_SM_RUN_GOTO(runStepisFirst, PUB.sm.GetRunSteptime);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case ERunStep.MARKSTROPB: //후진방향으로 마크스탑
|
||||||
|
case ERunStep.MARKSTOPF: //전진방향으로 마크스탑
|
||||||
|
|
||||||
|
//이동중이지 않다면 먼저 이동을 진행한다
|
||||||
|
var agvDir = PUB.sm.RunStep == ERunStep.MARKSTOPF ? arDev.Narumi.eRunOpt.Forward : arDev.Narumi.eRunOpt.Backward;
|
||||||
|
PUB.AGV.AGVMoveRun(agvDir);
|
||||||
|
|
||||||
|
//이동중이라면 마크스탑을 입력한다
|
||||||
|
PUB.AGV.AGVMoveStop("run-markstropb", arDev.Narumi.eStopOpt.MarkStop);
|
||||||
|
|
||||||
|
//마크스탑신호를 확인한다.(최대 5초)
|
||||||
|
|
||||||
|
//신호가 확인되지 않으면 오류로 정지한다
|
||||||
|
break;
|
||||||
|
|
||||||
|
|
||||||
case ERunStep.GOCHARGE: //충전위치로 이동
|
case ERunStep.GOCHARGE: //충전위치로 이동
|
||||||
if (runStepisFirst)
|
if (runStepisFirst)
|
||||||
{
|
{
|
||||||
@@ -196,6 +248,9 @@ namespace Project
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CheckStopCondition()
|
bool CheckStopCondition()
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ namespace Project
|
|||||||
|
|
||||||
public Boolean _SM_RUN_CHGOFF(bool isFirst, TimeSpan stepTime)
|
public Boolean _SM_RUN_CHGOFF(bool isFirst, TimeSpan stepTime)
|
||||||
{
|
{
|
||||||
//
|
//충전중인지 확인한다.
|
||||||
if (VAR.BOOL[eVarBool.FLAG_CHARGEONA] == true || PUB.AGV.system1.Battery_charging == true)
|
if (VAR.BOOL[eVarBool.FLAG_CHARGEONA] == true || PUB.AGV.system1.Battery_charging == true)
|
||||||
{
|
{
|
||||||
if (isFirst)
|
if (isFirst)
|
||||||
@@ -36,7 +36,7 @@ namespace Project
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//OFF전송이 처음이라면 시간 섲렁
|
//OFF전송이 처음이라면 시간 설정
|
||||||
if (VAR.TIME.IsSet(eVarTime.SendChargeOff)==false)
|
if (VAR.TIME.IsSet(eVarTime.SendChargeOff)==false)
|
||||||
VAR.TIME[eVarTime.SendChargeOff] = DateTime.Now.AddSeconds(-10);
|
VAR.TIME[eVarTime.SendChargeOff] = DateTime.Now.AddSeconds(-10);
|
||||||
|
|
||||||
@@ -47,13 +47,12 @@ namespace Project
|
|||||||
PUB.AGV.AGVCharge(PUB.setting.ChargerID, false);
|
PUB.AGV.AGVCharge(PUB.setting.ChargerID, false);
|
||||||
VAR.TIME.Update(eVarTime.SendChargeOff);
|
VAR.TIME.Update(eVarTime.SendChargeOff);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//PUB.logsys.Add($"충전OFF확인완료");
|
//중전이 해제된 상태이다
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
297
Cs_HMI/Project/StateMachine/Step/_SM_RUN_GOTO.cs
Normal file
297
Cs_HMI/Project/StateMachine/Step/_SM_RUN_GOTO.cs
Normal file
@@ -0,0 +1,297 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Drawing;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using Project.StateMachine;
|
||||||
|
using COMM;
|
||||||
|
using AR;
|
||||||
|
|
||||||
|
namespace Project
|
||||||
|
{
|
||||||
|
public partial class fMain
|
||||||
|
{
|
||||||
|
byte GotoTurnStep = 0;
|
||||||
|
DateTime GotoTurnSetTime = DateTime.Now;
|
||||||
|
public Boolean _SM_RUN_GOTO(bool isFirst, TimeSpan stepTime)
|
||||||
|
{
|
||||||
|
///명령어 재전송 간격(기본 2초)
|
||||||
|
var CommandInterval = 2;
|
||||||
|
|
||||||
|
//충전 상태가 OFF되어야 동작하게한다
|
||||||
|
if (_SM_RUN_CHGOFF(isFirst, stepTime) == false)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
//최초시작이라면 시간변수 초기화
|
||||||
|
if (isFirst)
|
||||||
|
{
|
||||||
|
PUB.log.Add($"[>>] _SM_RUN_GOTO");
|
||||||
|
VAR.TIME.Update(eVarTime.CheckGotoTargetSet);
|
||||||
|
}
|
||||||
|
|
||||||
|
//목적지가 설정되었는지 체크한다.
|
||||||
|
if (PUB.mapctl.Manager.agv.TargetRFID.IsEmpty)
|
||||||
|
{
|
||||||
|
//최대 5초간 설정여부를 확인하고
|
||||||
|
if (VAR.TIME.RUN(eVarTime.CheckGotoTargetSet).TotalSeconds > 5)
|
||||||
|
{
|
||||||
|
//실패시에는 READY로 전환한다.
|
||||||
|
PUB.sm.SetNewRunStep(ERunStep.READY);
|
||||||
|
PUB.Speak(Lang.목적지가없어대기상태로전환합니다);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
var idx = 1;
|
||||||
|
var BeforePredictIdx = -1;
|
||||||
|
var predict = PUB.mapctl.Manager.PredictResult;
|
||||||
|
if (PUB.sm.RunStepSeq == idx++)
|
||||||
|
{
|
||||||
|
PUB.Speak(Lang.위치로이동합니다);
|
||||||
|
PUB.log.Add($"목적지 위치 이동시작({PUB.mapctl.Manager.agv.TargetRFID.Value})");
|
||||||
|
VAR.TIME.Update(eVarTime.CheckGotoTargetSet);
|
||||||
|
VAR.TIME.Set(eVarTime.SendGotoCommand, DateTime.Now.AddDays(-1));
|
||||||
|
PUB.sm.UpdateRunStepSeq();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
else if (PUB.sm.RunStepSeq == idx++)
|
||||||
|
{
|
||||||
|
//멈춰야하는경우
|
||||||
|
if (predict.MoveState == AGVControl.AGVMoveState.Stop)
|
||||||
|
{
|
||||||
|
if (PUB.AGV.system1.agv_run)
|
||||||
|
{
|
||||||
|
if (VAR.TIME.RUN(eVarTime.SendGotoCommand).TotalSeconds > 2)
|
||||||
|
{
|
||||||
|
PUB.Speak("AGV Stop");
|
||||||
|
PUB.AGV.AGVMoveStop("Predict", arDev.Narumi.eStopOpt.Stop);
|
||||||
|
VAR.TIME.Update(eVarTime.SendGotoCommand);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//완료되었거나 턴을진행해야한다
|
||||||
|
if (predict.ReasonCode == AGVControl.AGVActionReasonCode.Arrived ||
|
||||||
|
predict.ReasonCode == AGVControl.AGVActionReasonCode.NeedTurnMove ||
|
||||||
|
predict.ReasonCode == AGVControl.AGVActionReasonCode.NeedTurnPoint)
|
||||||
|
{
|
||||||
|
GotoTurnStep = 0;
|
||||||
|
GotoTurnSetTime = DateTime.Now.AddDays(-1);
|
||||||
|
PUB.sm.UpdateRunStepSeq();
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else //이동해야하는 경우
|
||||||
|
{
|
||||||
|
//속도와 방향이 불일치하는 경우 다시 설정한다 (속도: H,L,M,[S]
|
||||||
|
AGVControl.AgvDir AGV_Direction = (AGVControl.AgvDir)PUB.AGV.data.Direction;
|
||||||
|
AGVControl.AgvSpeed AGV_Speed = (AGVControl.AgvSpeed)PUB.AGV.data.Speed;
|
||||||
|
AGVControl.AgvSts AGV_Sts = (AGVControl.AgvSts)PUB.AGV.data.Sts;
|
||||||
|
|
||||||
|
//상태값이 바뀌었다면 전송을 해야한다
|
||||||
|
if (predict.Direction != AGV_Direction || predict.MoveSpeed != AGV_Speed || predict.MoveDiv != AGV_Sts)
|
||||||
|
{
|
||||||
|
if (VAR.TIME.RUN(eVarTime.SendGotoCommand).TotalSeconds > CommandInterval)
|
||||||
|
{
|
||||||
|
arDev.Narumi.eBunki v_bunki = arDev.Narumi.eBunki.Strate;
|
||||||
|
if (predict.MoveDiv == AGVControl.AgvSts.Straight) v_bunki = arDev.Narumi.eBunki.Strate;
|
||||||
|
else if (predict.MoveDiv == AGVControl.AgvSts.Left) v_bunki = arDev.Narumi.eBunki.Left;
|
||||||
|
else if (predict.MoveDiv == AGVControl.AgvSts.Right) v_bunki = arDev.Narumi.eBunki.Right;
|
||||||
|
|
||||||
|
arDev.Narumi.eMoveDir v_dir = arDev.Narumi.eMoveDir.Backward;
|
||||||
|
if (predict.Direction == AGVControl.AgvDir.Forward) v_dir = arDev.Narumi.eMoveDir.Forward;
|
||||||
|
else if (predict.Direction == AGVControl.AgvDir.Backward) v_dir = arDev.Narumi.eMoveDir.Backward;
|
||||||
|
|
||||||
|
arDev.Narumi.eMoveSpd v_spd = arDev.Narumi.eMoveSpd.Low;
|
||||||
|
if (predict.MoveSpeed == AGVControl.AgvSpeed.Middle) v_spd = arDev.Narumi.eMoveSpd.Middle;
|
||||||
|
else if (predict.MoveSpeed == AGVControl.AgvSpeed.High) v_spd = arDev.Narumi.eMoveSpd.High;
|
||||||
|
else if (predict.MoveSpeed == AGVControl.AgvSpeed.Low) v_spd = arDev.Narumi.eMoveSpd.Low;
|
||||||
|
|
||||||
|
//이동셋팅을 해준다
|
||||||
|
PUB.AGV.AGVMoveSet(new arDev.Narumi.BunkiData
|
||||||
|
{
|
||||||
|
Bunki = v_bunki,
|
||||||
|
Direction = v_dir,
|
||||||
|
PBSSensor = 1,
|
||||||
|
Speed = v_spd,
|
||||||
|
});
|
||||||
|
|
||||||
|
if (predict.MoveSpeed == AGVControl.AgvSpeed.MarkStop)
|
||||||
|
{
|
||||||
|
PUB.AGV.AGVMoveStop("Predict", arDev.Narumi.eStopOpt.Stop);
|
||||||
|
}
|
||||||
|
VAR.TIME.Update(eVarTime.SendGotoCommand);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
//정지상태라면 이동 명령을 전달한다
|
||||||
|
if (PUB.AGV.system1.agv_run == false)
|
||||||
|
{
|
||||||
|
if (VAR.TIME.RUN(eVarTime.SendGotoCommand).TotalSeconds > CommandInterval)
|
||||||
|
{
|
||||||
|
PUB.Speak("AGV Start");
|
||||||
|
|
||||||
|
arDev.Narumi.eRunOpt v_dir = arDev.Narumi.eRunOpt.Backward;
|
||||||
|
if (predict.Direction == AGVControl.AgvDir.Forward) v_dir = arDev.Narumi.eRunOpt.Forward;
|
||||||
|
else if (predict.Direction == AGVControl.AgvDir.Backward) v_dir = arDev.Narumi.eRunOpt.Backward;
|
||||||
|
|
||||||
|
PUB.AGV.AGVMoveRun(v_dir);
|
||||||
|
VAR.TIME.Update(eVarTime.SendGotoCommand);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//예측이 업데이트되지 않으면 오류 처리해야한다
|
||||||
|
if (BeforePredictIdx == -1) BeforePredictIdx = (int)predict.Idx;
|
||||||
|
else if (BeforePredictIdx != predict.Idx) //이전사용한 IDX와 다르다면 예측이 실행된 경우이다
|
||||||
|
BeforePredictIdx = (int)predict.Idx;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//5초이상 예측값이 업데이트되지 않으면 오류 처리한다.
|
||||||
|
var tsPredict = DateTime.Now - predict.CreateTime;
|
||||||
|
if (tsPredict.TotalSeconds > 5)
|
||||||
|
{
|
||||||
|
PUB.XBE.SendError(ENIGProtocol.AGVErrorCode.PredictFix, Lang.예측값이계산되지않아이동을중단합니다);
|
||||||
|
PUB.Speak(Lang.예측값이계산되지않아이동을중단합니다);
|
||||||
|
PUB.sm.SetNewRunStep(ERunStep.READY);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
else if (PUB.sm.RunStepSeq == idx++)
|
||||||
|
{
|
||||||
|
if (predict.ReasonCode == AGVControl.AGVActionReasonCode.Arrived)
|
||||||
|
{
|
||||||
|
PUB.Speak(Lang.목적지이동이완료되었습니다);
|
||||||
|
PUB.sm.SetNewRunStep(ERunStep.READY);
|
||||||
|
PUB.sm.UpdateRunStepSeq();
|
||||||
|
}
|
||||||
|
else if (predict.ReasonCode == AGVControl.AGVActionReasonCode.NeedTurnMove ||
|
||||||
|
predict.ReasonCode == AGVControl.AGVActionReasonCode.NeedTurnPoint)
|
||||||
|
{
|
||||||
|
//턴을 해야하는 경우이다
|
||||||
|
//좌턴을 기본으로 진행하며, 좌턴이동 후 마크스탑을 입력한다
|
||||||
|
if (GotoTurnStep == 0)
|
||||||
|
{
|
||||||
|
//턴을 한적이 없으므로 턴을 먼저 진행한다
|
||||||
|
arDev.Narumi.eMoveDir moveDir = arDev.Narumi.eMoveDir.Backward;
|
||||||
|
if (predict.Direction == AGVControl.AgvDir.Forward) moveDir = arDev.Narumi.eMoveDir.Forward;
|
||||||
|
if (PUB.AGV.data.Sts != 'L' || PUB.AGV.data.Speed != 'L' || PUB.AGV.data.Direction != moveDir.ToString()[0])
|
||||||
|
{
|
||||||
|
//셋팅이 다르다면 3초간격으로 전송한다
|
||||||
|
var tsTurnSet = DateTime.Now - GotoTurnSetTime;
|
||||||
|
if (tsTurnSet.TotalSeconds > 3)
|
||||||
|
{
|
||||||
|
PUB.AGV.AGVMoveSet(new arDev.Narumi.BunkiData
|
||||||
|
{
|
||||||
|
Bunki = arDev.Narumi.eBunki.Left,
|
||||||
|
Direction = moveDir,
|
||||||
|
PBSSensor = 1,
|
||||||
|
Speed = arDev.Narumi.eMoveSpd.Low,
|
||||||
|
});
|
||||||
|
GotoTurnSetTime = DateTime.Now;
|
||||||
|
PUB.log.Add("Turn Bunki Set");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
PUB.mapctl.Manager.agv.CurrentRFID.TurnOK = false;
|
||||||
|
PUB.mapctl.Manager.agv.CurrentRFID.TurnStart = DateTime.Now;
|
||||||
|
PUB.sm.UpdateRunStepSeq(); //셋팅이 맞으니 다음스텝으로 진행한다
|
||||||
|
GotoTurnStep += 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else PUB.sm.UpdateRunStepSeq();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
else if (PUB.sm.RunStepSeq == idx++)
|
||||||
|
{
|
||||||
|
//턴이완료되길 기다린다.
|
||||||
|
if (predict.ReasonCode == AGVControl.AGVActionReasonCode.NeedTurnMove ||
|
||||||
|
predict.ReasonCode == AGVControl.AGVActionReasonCode.NeedTurnPoint)
|
||||||
|
{
|
||||||
|
//(최소5초는 기다리고 판단한다)
|
||||||
|
if (stepTime.TotalSeconds < 5) return false;
|
||||||
|
|
||||||
|
//최대30초는 기다려준다
|
||||||
|
if (stepTime.TotalSeconds > 30)
|
||||||
|
{
|
||||||
|
var ermsg = "Turn Timeout(30sec)";
|
||||||
|
PUB.log.AddE(ermsg);
|
||||||
|
PUB.XBE.SendError(ENIGProtocol.AGVErrorCode.TurnTimeout, ermsg);
|
||||||
|
PUB.sm.SetNewRunStep(ERunStep.READY);
|
||||||
|
}
|
||||||
|
|
||||||
|
//모션이 멈추었다면 턴이완료된것이다.
|
||||||
|
if (PUB.AGV.system1.agv_stop)
|
||||||
|
{
|
||||||
|
if (PUB.AGV.system1.Mark1_check == false && PUB.AGV.system1.Mark2_check == false)
|
||||||
|
{
|
||||||
|
PUB.log.AddE($"Turn 완료이나 Mark 센서가 확인되지 않았습니다");
|
||||||
|
}
|
||||||
|
GotoTurnStep += 1;
|
||||||
|
PUB.sm.UpdateRunStepSeq();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//아직 이동중이므로 대기한다
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else PUB.sm.UpdateRunStepSeq(); //기타사항은 다음으로 넘어간다
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
else if (PUB.sm.RunStepSeq == idx++)
|
||||||
|
{
|
||||||
|
if (predict.ReasonCode == AGVControl.AGVActionReasonCode.NeedTurnMove ||
|
||||||
|
predict.ReasonCode == AGVControl.AGVActionReasonCode.NeedTurnPoint)
|
||||||
|
{
|
||||||
|
if (GotoTurnStep < 2)
|
||||||
|
{
|
||||||
|
PUB.XBE.SendError(ENIGProtocol.AGVErrorCode.TurnError, "턴시퀀스 완료 실패");
|
||||||
|
PUB.log.AddE($"턴완료시퀀스가 2가아닙니다. 대기 상태로 강제 전환합니다");
|
||||||
|
PUB.sm.SetNewRunStep(ERunStep.READY);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
PUB.log.AddI("Turn Complete");
|
||||||
|
}
|
||||||
|
|
||||||
|
//방향전환용 턴이라면 이동기록을 추가해서 방향이 맞도록 처리해주자
|
||||||
|
if (predict.ReasonCode == AGVControl.AGVActionReasonCode.NeedTurnMove)
|
||||||
|
{
|
||||||
|
var rfid = PUB.mapctl.Manager.agv.CurrentRFID;
|
||||||
|
var lastHistory = PUB.mapctl.Manager.agv.MovementHistory.Last();
|
||||||
|
//원래방향에서 반대로 처리한다
|
||||||
|
var revDir = lastHistory.Direction == AGVControl.AgvDir.Backward ? AGVControl.AgvDir.Forward : AGVControl.AgvDir.Backward;
|
||||||
|
PUB.mapctl.Manager.agv.AddToMovementHistory(rfid.Value, rfid.Location, revDir);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//이동용 RFID에서 턴명령이 들어있는경우였다
|
||||||
|
PUB.mapctl.Manager.agv.CurrentRFID.TurnEnd = DateTime.Now;
|
||||||
|
PUB.mapctl.Manager.agv.CurrentRFID.TurnOK = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
PUB.sm.UpdateRunStepSeq();
|
||||||
|
}
|
||||||
|
else PUB.sm.UpdateRunStepSeq();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//좌턴이동명령 전송
|
||||||
|
|
||||||
|
//마크스탑전송
|
||||||
|
|
||||||
|
//마크스탑이 확인되면 나머지는 경로예측에 맡긴다
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -53,15 +53,33 @@ namespace Project
|
|||||||
var chg_stop = PUB.AGV.system1.GetChanged(arDev.Narumi.SystemFlag1.eflag.agv_stop);
|
var chg_stop = PUB.AGV.system1.GetChanged(arDev.Narumi.SystemFlag1.eflag.agv_stop);
|
||||||
//if (chg_run && PUB.AGV.system1.agv_run) PUB.Speak("이동을 시작 합니다");
|
//if (chg_run && PUB.AGV.system1.agv_run) PUB.Speak("이동을 시작 합니다");
|
||||||
VAR.BOOL[eVarBool.AGVDIR_UP] = PUB.AGV.data.Direction == 'B';
|
VAR.BOOL[eVarBool.AGVDIR_UP] = PUB.AGV.data.Direction == 'B';
|
||||||
// PUB.AGV.signal.mark_sensor = PUB.AGV.signal.mark_sensor;
|
|
||||||
VAR.BOOL[eVarBool.AGV_ERROR] = PUB.AGV.error.Value > 0;
|
VAR.BOOL[eVarBool.AGV_ERROR] = PUB.AGV.error.Value > 0;
|
||||||
VAR.BOOL[eVarBool.EMERGENCY] = PUB.AGV.error.Emergency;
|
VAR.BOOL[eVarBool.EMERGENCY] = PUB.AGV.error.Emergency;
|
||||||
|
|
||||||
//모터방향 입력
|
//모터방향 입력
|
||||||
if (PUB.AGV.data.Direction == 'B')
|
if (PUB.AGV.data.Direction == 'B')
|
||||||
PUB.mapctl.Manager.agv.CurrentMOTDirection = AGVControl.Direction.Backward;
|
PUB.mapctl.Manager.agv.Current_Motor_Direction = AGVControl.AgvDir.Backward;
|
||||||
else
|
else
|
||||||
PUB.mapctl.Manager.agv.CurrentMOTDirection = AGVControl.Direction.Forward;
|
PUB.mapctl.Manager.agv.Current_Motor_Direction = AGVControl.AgvDir.Forward;
|
||||||
|
|
||||||
|
//현재 속도
|
||||||
|
if (PUB.AGV.data.Speed == 'H')
|
||||||
|
PUB.mapctl.Manager.agv.CurrentSpeed = AGVControl.AgvSpeed.High;
|
||||||
|
else if (PUB.AGV.data.Speed == 'M')
|
||||||
|
PUB.mapctl.Manager.agv.CurrentSpeed = AGVControl.AgvSpeed.Middle;
|
||||||
|
else if (PUB.AGV.data.Speed == 'L')
|
||||||
|
PUB.mapctl.Manager.agv.CurrentSpeed = AGVControl.AgvSpeed.Low;
|
||||||
|
else if (PUB.AGV.data.Speed == 'S')
|
||||||
|
PUB.mapctl.Manager.agv.CurrentSpeed = AGVControl.AgvSpeed.MarkStop;
|
||||||
|
|
||||||
|
//이동방향
|
||||||
|
if (PUB.AGV.data.Sts == 'S')
|
||||||
|
PUB.mapctl.Manager.agv.CurrentSTS = AGVControl.AgvSts.Straight;
|
||||||
|
else if (PUB.AGV.data.Sts == 'L')
|
||||||
|
PUB.mapctl.Manager.agv.CurrentSTS = AGVControl.AgvSts.Left;
|
||||||
|
else if (PUB.AGV.data.Sts == 'R')
|
||||||
|
PUB.mapctl.Manager.agv.CurrentSTS = AGVControl.AgvSts.Right;
|
||||||
|
|
||||||
|
|
||||||
PUB.mapctl.Manager.agv.IsMoving = PUB.AGV.system1.agv_run;
|
PUB.mapctl.Manager.agv.IsMoving = PUB.AGV.system1.agv_run;
|
||||||
PUB.mapctl.Manager.agv.IsMarkCheck = PUB.AGV.system1.Mark1_check || PUB.AGV.system1.Mark2_check;
|
PUB.mapctl.Manager.agv.IsMarkCheck = PUB.AGV.system1.Mark1_check || PUB.AGV.system1.Mark2_check;
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ namespace Project
|
|||||||
{
|
{
|
||||||
var data = e.ReceivedPacket.Data;
|
var data = e.ReceivedPacket.Data;
|
||||||
var dataStr = System.Text.Encoding.Default.GetString(data);
|
var dataStr = System.Text.Encoding.Default.GetString(data);
|
||||||
var cmd = (ENIGProtocol.AGVCommands)e.ReceivedPacket.Command;
|
var cmd = (ENIGProtocol.AGVCommandHE)e.ReceivedPacket.Command;
|
||||||
var TargetID = 0;
|
var TargetID = 0;
|
||||||
if (dataStr.Length >= 2)
|
if (dataStr.Length >= 2)
|
||||||
{
|
{
|
||||||
@@ -47,7 +47,7 @@ namespace Project
|
|||||||
switch (cmd)
|
switch (cmd)
|
||||||
{
|
{
|
||||||
|
|
||||||
case ENIGProtocol.AGVCommands.SetCurrent: //Set Current Position
|
case ENIGProtocol.AGVCommandHE.SetCurrent: //Set Current Position
|
||||||
|
|
||||||
if (dataStr.Length == 6)
|
if (dataStr.Length == 6)
|
||||||
{
|
{
|
||||||
@@ -76,7 +76,7 @@ namespace Project
|
|||||||
else PUB.log.AddE($"Position Param Error:{dataStr}");
|
else PUB.log.AddE($"Position Param Error:{dataStr}");
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case ENIGProtocol.AGVCommands.Goto: //move to tag
|
case ENIGProtocol.AGVCommandHE.Goto: //move to tag
|
||||||
if (uint.TryParse(dataStr, out uint tagno2))
|
if (uint.TryParse(dataStr, out uint tagno2))
|
||||||
{
|
{
|
||||||
var currPos = PUB.mapctl.Manager.agv.CurrentRFID;///.AGVMoveToRFID(;
|
var currPos = PUB.mapctl.Manager.agv.CurrentRFID;///.AGVMoveToRFID(;
|
||||||
@@ -87,14 +87,14 @@ namespace Project
|
|||||||
}
|
}
|
||||||
else PUB.log.AddE($"Path Param Error :{dataStr}");
|
else PUB.log.AddE($"Path Param Error :{dataStr}");
|
||||||
break;
|
break;
|
||||||
case ENIGProtocol.AGVCommands.Stop: //stop
|
case ENIGProtocol.AGVCommandHE.Stop: //stop
|
||||||
PUB.AGV.AGVMoveStop("xbee");
|
PUB.AGV.AGVMoveStop("xbee");
|
||||||
break;
|
break;
|
||||||
case ENIGProtocol.AGVCommands.Reset: //Error Reset
|
case ENIGProtocol.AGVCommandHE.Reset: //Error Reset
|
||||||
PUB.AGV.AGVErrorReset();
|
PUB.AGV.AGVErrorReset();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ENIGProtocol.AGVCommands.Manual: //Manual Move (Direction, speed, runtime)
|
case ENIGProtocol.AGVCommandHE.Manual: //Manual Move (Direction, speed, runtime)
|
||||||
var Direction = data[0]; //0=back, 1=forward, 2=left, 3=right
|
var Direction = data[0]; //0=back, 1=forward, 2=left, 3=right
|
||||||
var Speed = data[1]; //0=slow, 1=normal, 2=fast
|
var Speed = data[1]; //0=slow, 1=normal, 2=fast
|
||||||
var Runtime = data[2]; // running seconds
|
var Runtime = data[2]; // running seconds
|
||||||
@@ -113,13 +113,13 @@ namespace Project
|
|||||||
|
|
||||||
PUB.AGV.AGVMoveManual(opt, spd, arDev.Narumi.Sensor.PBSOn);
|
PUB.AGV.AGVMoveManual(opt, spd, arDev.Narumi.Sensor.PBSOn);
|
||||||
break;
|
break;
|
||||||
case ENIGProtocol.AGVCommands.MarkStop: //Set MarkStop
|
case ENIGProtocol.AGVCommandHE.MarkStop: //Set MarkStop
|
||||||
var MarkStop = data[0]; //0=off, 1=on
|
var MarkStop = data[0]; //0=off, 1=on
|
||||||
|
|
||||||
//마크센서에서 멈추게 한다
|
//마크센서에서 멈추게 한다
|
||||||
PUB.AGV.AGVMoveStop("Xbee", arDev.Narumi.eStopOpt.MarkStop);
|
PUB.AGV.AGVMoveStop("Xbee", arDev.Narumi.eStopOpt.MarkStop);
|
||||||
break;
|
break;
|
||||||
case ENIGProtocol.AGVCommands.LiftControl: //Lift Control
|
case ENIGProtocol.AGVCommandHE.LiftControl: //Lift Control
|
||||||
var LiftCommand = data[0]; //0=stop, 1=up, 2=down
|
var LiftCommand = data[0]; //0=stop, 1=up, 2=down
|
||||||
arDev.Narumi.LiftCommand LCmd = arDev.Narumi.LiftCommand.STP;
|
arDev.Narumi.LiftCommand LCmd = arDev.Narumi.LiftCommand.STP;
|
||||||
if (LiftCommand == 1) LCmd = arDev.Narumi.LiftCommand.UP;
|
if (LiftCommand == 1) LCmd = arDev.Narumi.LiftCommand.UP;
|
||||||
|
|||||||
@@ -83,6 +83,24 @@ namespace Project.StateMachine
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
GODOWN,
|
GODOWN,
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 목적지로 이동합니다
|
||||||
|
/// </summary>
|
||||||
|
GOTO,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 전진방향으로 마크스탑진행
|
||||||
|
/// </summary>
|
||||||
|
MARKSTOPF,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 후진방향으로 마크스탑진행
|
||||||
|
/// </summary>
|
||||||
|
MARKSTROPB,
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -7,8 +7,26 @@ namespace arDev
|
|||||||
|
|
||||||
public class AgvData
|
public class AgvData
|
||||||
{
|
{
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// S: Straight
|
||||||
|
/// L: Left
|
||||||
|
/// R: Right
|
||||||
|
/// </summary>
|
||||||
public char Sts { get; set; }
|
public char Sts { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// H : High
|
||||||
|
/// M : Middle
|
||||||
|
/// L : Low
|
||||||
|
/// S : Mark Stop
|
||||||
|
/// </summary>
|
||||||
public char Speed { get; set; }
|
public char Speed { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// F : Front
|
||||||
|
/// B : Back
|
||||||
|
/// </summary>
|
||||||
public char Direction { get; set; }
|
public char Direction { get; set; }
|
||||||
|
|
||||||
public int guidesensor { get; set; }
|
public int guidesensor { get; set; }
|
||||||
|
|||||||
@@ -712,13 +712,13 @@ namespace AGVControl
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="rfidTagNo">RFID TagNo</param>
|
/// <param name="rfidTagNo">RFID TagNo</param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public bool SetCurrentPosition(UInt16 rfidTagNo)
|
public bool SetCurrentPosition(ushort rfidTagNo)
|
||||||
{
|
{
|
||||||
var rfidPoint = Manager.FindRFIDPoint(rfidTagNo);
|
var rfidPoint = Manager.FindRFIDPoint(rfidTagNo);
|
||||||
if (rfidPoint != null)
|
if (rfidPoint != null)
|
||||||
{
|
{
|
||||||
// 이동 경로에 추가 (위치 업데이트보다 먼저)
|
// 이동 경로에 추가 (위치 업데이트보다 먼저)
|
||||||
Manager.agv.AddToMovementHistory(rfidTagNo, rfidPoint.Location, Manager.agv.CurrentMOTDirection);
|
Manager.agv.AddToMovementHistory(rfidTagNo, rfidPoint.Location, Manager.agv.Current_Motor_Direction);
|
||||||
|
|
||||||
// AGV 위치 업데이트
|
// AGV 위치 업데이트
|
||||||
Manager.agv.CurrentRFID = rfidPoint;
|
Manager.agv.CurrentRFID = rfidPoint;
|
||||||
@@ -1053,7 +1053,7 @@ namespace AGVControl
|
|||||||
// 고정방향이 있으면 테두리 색상 표시
|
// 고정방향이 있으면 테두리 색상 표시
|
||||||
if (rfid.FixedDirection.HasValue)
|
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))
|
using (var pen = new Pen(borderColor, 2))
|
||||||
{
|
{
|
||||||
g.DrawEllipse(pen, rfid.Bounds.Expand(5, 5));
|
g.DrawEllipse(pen, rfid.Bounds.Expand(5, 5));
|
||||||
@@ -1098,7 +1098,7 @@ namespace AGVControl
|
|||||||
RFIDPoint TargetPT = null;
|
RFIDPoint TargetPT = null;
|
||||||
|
|
||||||
//뒤로이동하는경우라면 이전위치에 리프트가 있다.
|
//뒤로이동하는경우라면 이전위치에 리프트가 있다.
|
||||||
if (lstpt.Direction == Direction.Backward)
|
if (lstpt.Direction == AgvDir.Backward)
|
||||||
{
|
{
|
||||||
TargetPT = prept;
|
TargetPT = prept;
|
||||||
}
|
}
|
||||||
@@ -1134,7 +1134,7 @@ namespace AGVControl
|
|||||||
g.DrawEllipse(circlePen, circleRect);
|
g.DrawEllipse(circlePen, circleRect);
|
||||||
|
|
||||||
//motor direction
|
//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);
|
var strsize = g.MeasureString(str, this.Font);
|
||||||
g.DrawString(str, this.Font, Brushes.White, circleRect, new StringFormat
|
g.DrawString(str, this.Font, Brushes.White, circleRect, new StringFormat
|
||||||
{
|
{
|
||||||
@@ -1430,7 +1430,7 @@ namespace AGVControl
|
|||||||
if (connection.MoveDirectionP != null)
|
if (connection.MoveDirectionP != null)
|
||||||
{
|
{
|
||||||
// if (DriveMethod.isEmpty() == false) DriveMethod += "|";
|
// if (DriveMethod.isEmpty() == false) DriveMethod += "|";
|
||||||
DriveMethod += ((AgvRunDirection)connection.MoveDirectionP).ToString()[0];
|
DriveMethod += ((AgvSts)connection.MoveDirectionP).ToString()[0];
|
||||||
}
|
}
|
||||||
else DriveMethod += nulChar;
|
else DriveMethod += nulChar;
|
||||||
if (connection.MoveSpeedP != null)
|
if (connection.MoveSpeedP != null)
|
||||||
@@ -1442,7 +1442,7 @@ namespace AGVControl
|
|||||||
if (connection.LiftDirectionP != null)
|
if (connection.LiftDirectionP != null)
|
||||||
{
|
{
|
||||||
//if (DriveMethod.isEmpty() == false) DriveMethod += "|";
|
//if (DriveMethod.isEmpty() == false) DriveMethod += "|";
|
||||||
DriveMethod += ((AgvRunDirection)connection.LiftDirectionP).ToString()[0];
|
DriveMethod += ((AgvSts)connection.LiftDirectionP).ToString()[0];
|
||||||
}
|
}
|
||||||
else DriveMethod += nulChar;
|
else DriveMethod += nulChar;
|
||||||
|
|
||||||
@@ -1482,7 +1482,7 @@ namespace AGVControl
|
|||||||
if (connection.MoveDirectionN != null)
|
if (connection.MoveDirectionN != null)
|
||||||
{
|
{
|
||||||
//if (DriveMethod.isEmpty() == false) DriveMethod += "|";
|
//if (DriveMethod.isEmpty() == false) DriveMethod += "|";
|
||||||
DriveMethod += ((AgvRunDirection)connection.MoveDirectionN).ToString()[0];
|
DriveMethod += ((AgvSts)connection.MoveDirectionN).ToString()[0];
|
||||||
}
|
}
|
||||||
else DriveMethod += nulChar;
|
else DriveMethod += nulChar;
|
||||||
if (connection.MoveSpeedN != null)
|
if (connection.MoveSpeedN != null)
|
||||||
@@ -1494,7 +1494,7 @@ namespace AGVControl
|
|||||||
if (connection.LiftDirectionN != null)
|
if (connection.LiftDirectionN != null)
|
||||||
{
|
{
|
||||||
//if (DriveMethod.isEmpty() == false) DriveMethod += "|";
|
//if (DriveMethod.isEmpty() == false) DriveMethod += "|";
|
||||||
DriveMethod += ((AgvRunDirection)connection.LiftDirectionN).ToString()[0];
|
DriveMethod += ((AgvSts)connection.LiftDirectionN).ToString()[0];
|
||||||
}
|
}
|
||||||
else DriveMethod += nulChar;
|
else DriveMethod += nulChar;
|
||||||
|
|
||||||
@@ -1779,7 +1779,7 @@ namespace AGVControl
|
|||||||
rfidPoint.IsRotatable = isRotatable;
|
rfidPoint.IsRotatable = isRotatable;
|
||||||
}
|
}
|
||||||
if (rfidParts.Length >= 5 && !string.IsNullOrEmpty(rfidParts[4]))
|
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)
|
if (rfidParts.Length >= 6)
|
||||||
{
|
{
|
||||||
bool isTerminal;
|
bool isTerminal;
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ namespace AGVControl
|
|||||||
PredictResult = CreatePrediction("이전 작업이 완료되지 않았습니다",
|
PredictResult = CreatePrediction("이전 작업이 완료되지 않았습니다",
|
||||||
AGVActionReasonCode.busy,
|
AGVActionReasonCode.busy,
|
||||||
AGVMoveState.Stop,
|
AGVMoveState.Stop,
|
||||||
agv.CurrentMOTDirection, false);
|
agv.Current_Motor_Direction, false);
|
||||||
return PredictResult;
|
return PredictResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -80,9 +80,9 @@ namespace AGVControl
|
|||||||
PredictResult = CreatePrediction("AGV 위치 미확정(처음 기동)",
|
PredictResult = CreatePrediction("AGV 위치 미확정(처음 기동)",
|
||||||
AGVActionReasonCode.NoPosition,
|
AGVActionReasonCode.NoPosition,
|
||||||
AGVMoveState.Run,
|
AGVMoveState.Run,
|
||||||
Direction.Backward, true,
|
AgvDir.Backward, true,
|
||||||
moveSpeed: AgvSpeed.Low,
|
moveSpeed: AgvSpeed.Low,
|
||||||
moveDiv: AgvRunDirection.Straight);
|
moveDiv: AgvSts.Straight);
|
||||||
return PredictResult;
|
return PredictResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -92,9 +92,9 @@ namespace AGVControl
|
|||||||
PredictResult = CreatePrediction("AGV이동방향 알수없음",
|
PredictResult = CreatePrediction("AGV이동방향 알수없음",
|
||||||
AGVActionReasonCode.NoDirection,
|
AGVActionReasonCode.NoDirection,
|
||||||
AGVMoveState.Run,
|
AGVMoveState.Run,
|
||||||
Direction.Backward, true,
|
AgvDir.Backward, true,
|
||||||
moveSpeed: AgvSpeed.Low,
|
moveSpeed: AgvSpeed.Low,
|
||||||
moveDiv: AgvRunDirection.Straight);
|
moveDiv: AgvSts.Straight);
|
||||||
return PredictResult;
|
return PredictResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -107,7 +107,7 @@ namespace AGVControl
|
|||||||
PredictResult = CreatePrediction("경로 없음 또는 현재 위치 미확정",
|
PredictResult = CreatePrediction("경로 없음 또는 현재 위치 미확정",
|
||||||
AGVActionReasonCode.NoPath,
|
AGVActionReasonCode.NoPath,
|
||||||
AGVMoveState.Stop,
|
AGVMoveState.Stop,
|
||||||
agv.CurrentMOTDirection, true);
|
agv.Current_Motor_Direction, true);
|
||||||
return PredictResult;
|
return PredictResult;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -120,7 +120,7 @@ namespace AGVControl
|
|||||||
PredictResult = CreatePrediction("목적지 경로 예측 실패",
|
PredictResult = CreatePrediction("목적지 경로 예측 실패",
|
||||||
AGVActionReasonCode.Unknown,
|
AGVActionReasonCode.Unknown,
|
||||||
AGVMoveState.Stop,
|
AGVMoveState.Stop,
|
||||||
agv.CurrentMOTDirection, true,
|
agv.Current_Motor_Direction, true,
|
||||||
nextRFID: agv.TargetRFID);
|
nextRFID: agv.TargetRFID);
|
||||||
return PredictResult;
|
return PredictResult;
|
||||||
}
|
}
|
||||||
@@ -140,12 +140,10 @@ namespace AGVControl
|
|||||||
PredictResult = CreatePrediction("현재 위치가 경로에 없음",
|
PredictResult = CreatePrediction("현재 위치가 경로에 없음",
|
||||||
AGVActionReasonCode.NotOnPath,
|
AGVActionReasonCode.NotOnPath,
|
||||||
AGVMoveState.Stop,
|
AGVMoveState.Stop,
|
||||||
agv.CurrentMOTDirection, true);
|
agv.Current_Motor_Direction, true);
|
||||||
return PredictResult;
|
return PredictResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// 4. 목적지 도달 전, 회전이 필요한경우인가?
|
// 4. 목적지 도달 전, 회전이 필요한경우인가?
|
||||||
// 목적지 RFID 정보
|
// 목적지 RFID 정보
|
||||||
var destRFID = agv.MainPath.Last();
|
var destRFID = agv.MainPath.Last();
|
||||||
@@ -163,7 +161,7 @@ namespace AGVControl
|
|||||||
if (IsLiftDir == false)
|
if (IsLiftDir == false)
|
||||||
{
|
{
|
||||||
AgvSpeed? agv_spd = null;
|
AgvSpeed? agv_spd = null;
|
||||||
AgvRunDirection? agv_dir = null;
|
AgvSts? agv_dir = null;
|
||||||
|
|
||||||
//회전가능한 위치로 이동을 해야한다
|
//회전가능한 위치로 이동을 해야한다
|
||||||
|
|
||||||
@@ -174,7 +172,7 @@ namespace AGVControl
|
|||||||
PredictResult = CreatePrediction("회전 가능한 위치가 없습니다",
|
PredictResult = CreatePrediction("회전 가능한 위치가 없습니다",
|
||||||
AGVActionReasonCode.NoTurnPoint,
|
AGVActionReasonCode.NoTurnPoint,
|
||||||
AGVMoveState.Stop,
|
AGVMoveState.Stop,
|
||||||
agv.CurrentMOTDirection, true);
|
agv.Current_Motor_Direction, true);
|
||||||
return PredictResult;
|
return PredictResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -195,7 +193,7 @@ namespace AGVControl
|
|||||||
PredictResult = CreatePrediction("회전 위치까지의 경로를 계산할 수 없습니다",
|
PredictResult = CreatePrediction("회전 위치까지의 경로를 계산할 수 없습니다",
|
||||||
AGVActionReasonCode.PathCalcError,
|
AGVActionReasonCode.PathCalcError,
|
||||||
AGVMoveState.Stop,
|
AGVMoveState.Stop,
|
||||||
agv.CurrentMOTDirection, true,
|
agv.Current_Motor_Direction, true,
|
||||||
nextRFID: nearTurnPoint);
|
nextRFID: nearTurnPoint);
|
||||||
return PredictResult;
|
return PredictResult;
|
||||||
}
|
}
|
||||||
@@ -205,7 +203,7 @@ namespace AGVControl
|
|||||||
//현재 모터방향을 확인하여 대상까지 이동하도록 해야한다
|
//현재 모터방향을 확인하여 대상까지 이동하도록 해야한다
|
||||||
var curidx = agv.SubPath.FindIndex(t => t.Value == curPT.Value);
|
var curidx = agv.SubPath.FindIndex(t => t.Value == curPT.Value);
|
||||||
var preidx = agv.SubPath.FindIndex(t => t.Value == PrePT.Value);
|
var preidx = agv.SubPath.FindIndex(t => t.Value == PrePT.Value);
|
||||||
Direction newdirection = agv.CurrentMOTDirection;
|
AgvDir newdirection = agv.Current_Motor_Direction;
|
||||||
string message = "턴위치로 이동중";
|
string message = "턴위치로 이동중";
|
||||||
|
|
||||||
|
|
||||||
@@ -213,13 +211,11 @@ namespace AGVControl
|
|||||||
if (preidx > curidx)
|
if (preidx > curidx)
|
||||||
{
|
{
|
||||||
//지정경로를 거꾸로 이동하고 있다
|
//지정경로를 거꾸로 이동하고 있다
|
||||||
if (agv.CurrentMOTDirection == Direction.Forward)
|
if (agv.Current_Motor_Direction == AgvDir.Forward)
|
||||||
newdirection = Direction.Backward;
|
newdirection = AgvDir.Backward;
|
||||||
else
|
else
|
||||||
newdirection = Direction.Forward;
|
newdirection = AgvDir.Forward;
|
||||||
message += "(방향전환)";
|
message += "(방향전환)";
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//도로정보를 확인하여 속도와 분기명령을 실행한다
|
//도로정보를 확인하여 속도와 분기명령을 실행한다
|
||||||
@@ -242,10 +238,10 @@ namespace AGVControl
|
|||||||
agv_dir = roadinfo2.dir;
|
agv_dir = roadinfo2.dir;
|
||||||
|
|
||||||
|
|
||||||
PredictResult = CreatePrediction("턴 완료 대기",
|
PredictResult = CreatePrediction("턴(이동) 완료 대기",
|
||||||
AGVActionReasonCode.NeedTurn,
|
AGVActionReasonCode.NeedTurnMove,
|
||||||
AGVMoveState.Stop,
|
AGVMoveState.Stop,
|
||||||
agv.CurrentMOTDirection, true,
|
agv.Current_Motor_Direction, true,
|
||||||
moveSpeed: agv_spd,
|
moveSpeed: agv_spd,
|
||||||
moveDiv: agv_dir,
|
moveDiv: agv_dir,
|
||||||
nextRFID: nearTurnPoint);
|
nextRFID: nearTurnPoint);
|
||||||
@@ -256,21 +252,53 @@ namespace AGVControl
|
|||||||
if (agv.SubPath != null && agv.SubPath.Any())
|
if (agv.SubPath != null && agv.SubPath.Any())
|
||||||
agv.SubPath.Clear();
|
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. 목적지위치까지 이동이 완료되지 않았다면 계속 이동을 하게한다
|
//3. 목적지위치까지 이동이 완료되지 않았다면 계속 이동을 하게한다
|
||||||
if (agv.CurrentRFID.Value != destRFID.Value)
|
if (agv.CurrentRFID.Value != destRFID.Value)
|
||||||
{
|
{
|
||||||
//현재 모터방향을 확인하여 대상까지 이동하도록 해야한다
|
//현재 모터방향을 확인하여 대상까지 이동하도록 해야한다
|
||||||
var curidx = agv.MainPath.FindIndex(t => t.Value == curPT.Value);
|
var curidx = agv.MainPath.FindIndex(t => t.Value == curPT.Value);
|
||||||
var preidx = agv.MainPath.FindIndex(t => t.Value == PrePT.Value);
|
var preidx = agv.MainPath.FindIndex(t => t.Value == PrePT.Value);
|
||||||
Direction newdirection = agv.CurrentMOTDirection;
|
AgvDir newdirection = agv.Current_Motor_Direction;
|
||||||
string message = "목적지 이동중";
|
string message = "목적지 이동중";
|
||||||
if (preidx > curidx)
|
if (preidx > curidx)
|
||||||
{
|
{
|
||||||
//지정경로를 거꾸로 이동하고 있다
|
//지정경로를 거꾸로 이동하고 있다
|
||||||
if (agv.CurrentMOTDirection == Direction.Forward)
|
if (agv.Current_Motor_Direction == AgvDir.Forward)
|
||||||
newdirection = Direction.Backward;
|
newdirection = AgvDir.Backward;
|
||||||
else
|
else
|
||||||
newdirection = Direction.Forward;
|
newdirection = AgvDir.Forward;
|
||||||
message += "(방향전환)";
|
message += "(방향전환)";
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -294,7 +322,7 @@ namespace AGVControl
|
|||||||
PredictResult = CreatePrediction("경로의 마지막 지점(목적지 도달)",
|
PredictResult = CreatePrediction("경로의 마지막 지점(목적지 도달)",
|
||||||
AGVActionReasonCode.Arrived,
|
AGVActionReasonCode.Arrived,
|
||||||
AGVMoveState.Stop,
|
AGVMoveState.Stop,
|
||||||
agv.CurrentMOTDirection, true,
|
agv.Current_Motor_Direction, true,
|
||||||
nextRFID: destRFID);
|
nextRFID: destRFID);
|
||||||
return PredictResult;
|
return PredictResult;
|
||||||
}
|
}
|
||||||
@@ -304,7 +332,7 @@ namespace AGVControl
|
|||||||
PredictResult = CreatePrediction($"ERR:{ex.Message}",
|
PredictResult = CreatePrediction($"ERR:{ex.Message}",
|
||||||
AGVActionReasonCode.Unknown,
|
AGVActionReasonCode.Unknown,
|
||||||
AGVMoveState.Stop,
|
AGVMoveState.Stop,
|
||||||
agv.CurrentMOTDirection, true);
|
agv.Current_Motor_Direction, true);
|
||||||
return PredictResult;
|
return PredictResult;
|
||||||
}
|
}
|
||||||
finally
|
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;
|
AgvSpeed? agv_spd = null;
|
||||||
AgvRunDirection? agv_div = null;
|
AgvSts? agv_div = null;
|
||||||
RFIDConnection info = null;
|
RFIDConnection info = null;
|
||||||
|
|
||||||
var nextpt = paths.Skip(paths.FindIndex(t => t.Value == curPT.Value) + 1).FirstOrDefault();
|
var nextpt = paths.Skip(paths.FindIndex(t => t.Value == curPT.Value) + 1).FirstOrDefault();
|
||||||
@@ -504,7 +532,7 @@ namespace AGVControl
|
|||||||
var lstpt = agv.MovementHistory.Last();
|
var lstpt = agv.MovementHistory.Last();
|
||||||
|
|
||||||
//뒤로이동하는경우라면 이전위치에 리프트가 있다.
|
//뒤로이동하는경우라면 이전위치에 리프트가 있다.
|
||||||
if (lstpt.Direction == Direction.Backward)
|
if (lstpt.Direction == AgvDir.Backward)
|
||||||
{
|
{
|
||||||
TargetPT = prept;
|
TargetPT = prept;
|
||||||
}
|
}
|
||||||
@@ -566,9 +594,9 @@ namespace AGVControl
|
|||||||
string reason,
|
string reason,
|
||||||
AGVActionReasonCode reasonCode,
|
AGVActionReasonCode reasonCode,
|
||||||
AGVMoveState moveState,
|
AGVMoveState moveState,
|
||||||
Direction direction, bool IDXUpdate = true,
|
AgvDir direction, bool IDXUpdate = true,
|
||||||
AgvSpeed? moveSpeed = null,
|
AgvSpeed? moveSpeed = null,
|
||||||
AgvRunDirection? moveDiv = null,
|
AgvSts? moveDiv = null,
|
||||||
RFIDPoint nextRFID = null
|
RFIDPoint nextRFID = null
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
@@ -581,7 +609,8 @@ namespace AGVControl
|
|||||||
Direction = direction,
|
Direction = direction,
|
||||||
MoveSpeed = moveSpeed,
|
MoveSpeed = moveSpeed,
|
||||||
MoveDiv = moveDiv,
|
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);
|
newPrediction.Changed = IsPredictionChanged(newPrediction);
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ namespace AGVControl.Models
|
|||||||
|
|
||||||
public class movehistorydata : RFIDPoint
|
public class movehistorydata : RFIDPoint
|
||||||
{
|
{
|
||||||
public Direction Direction { get; set; }
|
public AgvDir Direction { get; set; }
|
||||||
|
|
||||||
public override string ToString()
|
public override string ToString()
|
||||||
{
|
{
|
||||||
@@ -58,22 +58,37 @@ namespace AGVControl.Models
|
|||||||
public double BatteryTemp2 { get; set; } = 0;
|
public double BatteryTemp2 { get; set; } = 0;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// AGV
|
/// AGV Speed
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Direction CurrentAGVDirection { get; set; }
|
public AgvSpeed CurrentSpeed { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// AGV모터 방향
|
/// AGV STS
|
||||||
/// 외부에서 값이 상시 업데이트 됩니다.
|
|
||||||
/// </summary>
|
/// </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>
|
||||||
/// 현재위치가 수산되면 목적지까지의 방향값이 계산됩니다.
|
/// 현재위치가 수산되면 목적지까지의 방향값이 계산됩니다.
|
||||||
/// </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; }
|
public bool IsMoving { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// AGV.System1.Mark1_Check | Mark2_Check
|
||||||
|
/// </summary>
|
||||||
public bool IsMarkCheck { get; set; }
|
public bool IsMarkCheck { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 이동대상과 AGV의 머리방향이 일치하는지?
|
||||||
|
/// </summary>
|
||||||
public bool IsTargetDirectionMatch { get; set; }
|
public bool IsTargetDirectionMatch { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -104,13 +119,13 @@ namespace AGVControl.Models
|
|||||||
CurrentRFID = new RFIDPoint();
|
CurrentRFID = new RFIDPoint();
|
||||||
TargetRFID = new RFIDPoint();
|
TargetRFID = new RFIDPoint();
|
||||||
|
|
||||||
TargetDirection = Direction.Forward;
|
TargetDirection = AgvDir.Forward;
|
||||||
// BodyAngle = null;
|
// BodyAngle = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// 이동 경로에 새로운 RFID 추가
|
// 이동 경로에 새로운 RFID 추가
|
||||||
public void AddToMovementHistory(UInt16 rfidValue, Point position, Direction direction)
|
public void AddToMovementHistory(UInt16 rfidValue, Point position, AgvDir direction)
|
||||||
{
|
{
|
||||||
// 중복 RFID가 연속으로 들어오는 경우 무시
|
// 중복 RFID가 연속으로 들어오는 경우 무시
|
||||||
if (MovementHistory.Count > 0 && MovementHistory.Last().Value == rfidValue)
|
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)
|
if (connections == null || connections.Count == 0)
|
||||||
return null;
|
return null;
|
||||||
@@ -150,16 +165,16 @@ namespace AGVControl.Models
|
|||||||
// 연결 방향에 따라 실제 이동 방향 결정
|
// 연결 방향에 따라 실제 이동 방향 결정
|
||||||
if (connection.P1.Value == previousRFID && connection.P2.Value == currentRFID)
|
if (connection.P1.Value == previousRFID && connection.P2.Value == currentRFID)
|
||||||
{
|
{
|
||||||
return Direction.Forward; // Start -> End 방향으로 이동
|
return AgvDir.Forward; // Start -> End 방향으로 이동
|
||||||
}
|
}
|
||||||
else
|
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)
|
if (MovementHistory.Count < 2 || connections == null)
|
||||||
return true; // 검증 불가능한 경우
|
return true; // 검증 불가능한 경우
|
||||||
@@ -180,7 +195,7 @@ namespace AGVControl.Models
|
|||||||
if (actualDirection.Value != expectedDirection)
|
if (actualDirection.Value != expectedDirection)
|
||||||
{
|
{
|
||||||
// AGV 모터 방향을 실제 이동 방향으로 정정
|
// AGV 모터 방향을 실제 이동 방향으로 정정
|
||||||
CurrentAGVDirection = actualDirection.Value;
|
//CurrentAGVDirection = actualDirection.Value;
|
||||||
TargetDirection = actualDirection.Value;
|
TargetDirection = actualDirection.Value;
|
||||||
|
|
||||||
return false; // 정정됨을 알림
|
return false; // 정정됨을 알림
|
||||||
@@ -190,7 +205,7 @@ namespace AGVControl.Models
|
|||||||
}
|
}
|
||||||
|
|
||||||
// RFID 순서 기반 실제 이동 방향 계산 (기존 메서드 - 호환성 유지)
|
// RFID 순서 기반 실제 이동 방향 계산 (기존 메서드 - 호환성 유지)
|
||||||
public Direction? CalculateActualDirectionByRFID()
|
public AgvDir? CalculateActualDirectionByRFID()
|
||||||
{
|
{
|
||||||
if (MovementHistory.Count < 2)
|
if (MovementHistory.Count < 2)
|
||||||
return null;
|
return null;
|
||||||
@@ -206,11 +221,11 @@ namespace AGVControl.Models
|
|||||||
// RFID 값의 증가/감소로 방향 판단
|
// RFID 값의 증가/감소로 방향 판단
|
||||||
if (currentRFID.Value > prevRFID.Value)
|
if (currentRFID.Value > prevRFID.Value)
|
||||||
{
|
{
|
||||||
return Direction.Forward; // RFID 값이 증가하면 전진
|
return AgvDir.Forward; // RFID 값이 증가하면 전진
|
||||||
}
|
}
|
||||||
else if (currentRFID.Value < prevRFID.Value)
|
else if (currentRFID.Value < prevRFID.Value)
|
||||||
{
|
{
|
||||||
return Direction.Backward; // RFID 값이 감소하면 후진
|
return AgvDir.Backward; // RFID 값이 감소하면 후진
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -5,15 +5,16 @@ namespace AGVControl
|
|||||||
{
|
{
|
||||||
public class AGVActionPrediction
|
public class AGVActionPrediction
|
||||||
{
|
{
|
||||||
public Direction Direction { get; set; }
|
public AgvDir Direction { get; set; }
|
||||||
public RFIDPoint NextRFID { get; set; }
|
public RFIDPoint NextRFID { get; set; }
|
||||||
public string Reason { get; set; }
|
public string Reason { get; set; }
|
||||||
public AGVActionReasonCode ReasonCode { get; set; }
|
public AGVActionReasonCode ReasonCode { get; set; }
|
||||||
public AGVMoveState MoveState { get; set; } // RUN 또는 STOP
|
public AGVMoveState MoveState { get; set; } // RUN 또는 STOP
|
||||||
public AgvSpeed? MoveSpeed { get; set; }
|
public AgvSpeed? MoveSpeed { get; set; }
|
||||||
public AgvRunDirection? MoveDiv { get; set; }
|
public AgvSts? MoveDiv { get; set; }
|
||||||
public UInt32 Idx { get; set; }
|
public UInt32 Idx { get; set; }
|
||||||
public bool Changed { get; set; }
|
public bool Changed { get; set; }
|
||||||
|
public DateTime CreateTime { get; set; }
|
||||||
|
|
||||||
// override object.Equals
|
// override object.Equals
|
||||||
public bool Equals(AGVActionPrediction obj)
|
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>)
|
/// 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>
|
/// <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>
|
/// </summary>
|
||||||
public Direction? LiftDirection { get; set; }
|
public AgvDir? LiftDirection { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// AGV<47>̵<EFBFBD><CCB5><EFBFBD> <20>ӵ<EFBFBD> (high, middle, low)
|
/// AGV<47>̵<EFBFBD><CCB5><EFBFBD> <20>ӵ<EFBFBD> (high, middle, low)
|
||||||
@@ -43,7 +43,7 @@ namespace AGVControl.Models
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// AGV<47>̵<EFBFBD><CCB5><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>(<28>ºб<C2BA>, <20><><EFBFBD><EFBFBD>, <20><><EFBFBD>б<EFBFBD>)
|
/// AGV<47>̵<EFBFBD><CCB5><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>(<28>ºб<C2BA>, <20><><EFBFBD><EFBFBD>, <20><><EFBFBD>б<EFBFBD>)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public AgvRunDirection? MoveDirection { get; set; }
|
public AgvSts? MoveDirection { get; set; }
|
||||||
|
|
||||||
public RoadInformation()
|
public RoadInformation()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -28,8 +28,8 @@ namespace AGVControl
|
|||||||
/// AGV의 이동방향(리프트방향)
|
/// AGV의 이동방향(리프트방향)
|
||||||
/// 목적지 방향과의 일치를 위해 해당 방향을 설정할 수 있따
|
/// 목적지 방향과의 일치를 위해 해당 방향을 설정할 수 있따
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Direction? LiftDirectionP { get; set; }
|
public AgvDir? LiftDirectionP { get; set; }
|
||||||
public Direction? LiftDirectionN { get; set; }
|
public AgvDir? LiftDirectionN { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// AGV이동시 속도 (high, middle, low)
|
/// AGV이동시 속도 (high, middle, low)
|
||||||
@@ -40,8 +40,8 @@ namespace AGVControl
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// AGV이동시 방향모드(좌분기, 전진, 우분기)
|
/// AGV이동시 방향모드(좌분기, 전진, 우분기)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public AgvRunDirection? MoveDirectionP { get; set; }
|
public AgvSts? MoveDirectionP { get; set; }
|
||||||
public AgvRunDirection? MoveDirectionN { get; set; }
|
public AgvSts? MoveDirectionN { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 파일저장 및 불러오기시 사용하는 문자열로 반환
|
/// 파일저장 및 불러오기시 사용하는 문자열로 반환
|
||||||
@@ -112,38 +112,38 @@ namespace AGVControl
|
|||||||
this.EnableP = StrP[0] == "1";
|
this.EnableP = StrP[0] == "1";
|
||||||
|
|
||||||
if (StrP[1].isEmpty()) LiftDirectionP = null;
|
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;
|
if (StrP[2].isEmpty()) MoveSpeedP = null;
|
||||||
else MoveSpeedP = (AgvSpeed)int.Parse(StrP[2]);
|
else MoveSpeedP = (AgvSpeed)int.Parse(StrP[2]);
|
||||||
|
|
||||||
if (StrP[3].isEmpty()) MoveDirectionP = null;
|
if (StrP[3].isEmpty()) MoveDirectionP = null;
|
||||||
else MoveDirectionP = (AgvRunDirection)int.Parse(StrP[3]);
|
else MoveDirectionP = (AgvSts)int.Parse(StrP[3]);
|
||||||
|
|
||||||
//Negative
|
//Negative
|
||||||
this.EnableN = StrN[0] == "1";
|
this.EnableN = StrN[0] == "1";
|
||||||
|
|
||||||
if (StrN[1].isEmpty()) LiftDirectionN = null;
|
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;
|
if (StrN[2].isEmpty()) MoveSpeedN = null;
|
||||||
else MoveSpeedN = (AgvSpeed)int.Parse(StrN[2]);
|
else MoveSpeedN = (AgvSpeed)int.Parse(StrN[2]);
|
||||||
|
|
||||||
if (StrN[3].isEmpty()) MoveDirectionN = null;
|
if (StrN[3].isEmpty()) MoveDirectionN = null;
|
||||||
else MoveDirectionN = (AgvRunDirection)int.Parse(StrN[3]);
|
else MoveDirectionN = (AgvSts)int.Parse(StrN[3]);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
this.EnableP = buf[6] == "1";
|
this.EnableP = buf[6] == "1";
|
||||||
|
|
||||||
if (buf[7].isEmpty()) LiftDirectionP = null;
|
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;
|
if (buf[8].isEmpty()) MoveSpeedP = null;
|
||||||
else MoveSpeedP = (AgvSpeed)int.Parse(buf[8]);
|
else MoveSpeedP = (AgvSpeed)int.Parse(buf[8]);
|
||||||
|
|
||||||
if (buf[9].isEmpty()) MoveDirectionP = null;
|
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.EnableN = this.EnableP;
|
||||||
this.LiftDirectionN = this.LiftDirectionP;
|
this.LiftDirectionN = this.LiftDirectionP;
|
||||||
|
|||||||
@@ -7,12 +7,18 @@ namespace AGVControl.Models
|
|||||||
public class RFIDPoint
|
public class RFIDPoint
|
||||||
{
|
{
|
||||||
public Point Location { get; set; }
|
public Point Location { get; set; }
|
||||||
public uint Value { get; set; }
|
public ushort Value { get; set; }
|
||||||
public string NextRFID { get; set; } // 다음 RFID 포인트의 값
|
public string NextRFID { get; set; } // 다음 RFID 포인트의 값
|
||||||
public bool IsBidirectional { get; set; } // 양방향 연결 여부
|
public bool IsBidirectional { get; set; } // 양방향 연결 여부
|
||||||
public bool IsRotatable { 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 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)]
|
[Browsable(false)]
|
||||||
public RectangleF Bounds { get; set; }
|
public RectangleF Bounds { get; set; }
|
||||||
@@ -20,6 +26,10 @@ namespace AGVControl.Models
|
|||||||
{
|
{
|
||||||
this.Location = Point.Empty;
|
this.Location = Point.Empty;
|
||||||
this.Value = 0;
|
this.Value = 0;
|
||||||
|
TurnStop = false;
|
||||||
|
TurnOK = false;
|
||||||
|
TurnStart = new DateTime(1982, 11, 23);
|
||||||
|
TurnEnd = new DateTime(1982, 11, 23);
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool IsEmpty
|
public bool IsEmpty
|
||||||
|
|||||||
@@ -6,31 +6,42 @@ using System.Threading.Tasks;
|
|||||||
|
|
||||||
namespace AGVControl
|
namespace AGVControl
|
||||||
{
|
{
|
||||||
public enum Direction
|
/// <summary>
|
||||||
|
/// 실제 AGV컨트롤러의 STS값에는 F,B의 값이 들어있고
|
||||||
|
/// 아래 항목은 해당 문자의 ASCII코드값이다 첫자를 byte로 변경하고 변환하면 된다
|
||||||
|
/// </summary>
|
||||||
|
public enum AgvDir : byte
|
||||||
{
|
{
|
||||||
Forward = 0,
|
Forward = 0x46,
|
||||||
Backward = 1,
|
Backward = 0x42,
|
||||||
Stop = 2
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public enum AGVMoveState
|
public enum AGVMoveState
|
||||||
{
|
{
|
||||||
Stop = 0,
|
Stop = 0,
|
||||||
Run
|
Run
|
||||||
}
|
}
|
||||||
public enum AgvSpeed
|
|
||||||
|
/// <summary>
|
||||||
|
/// 실제 AGV컨트롤러의 STS값에는 H,L,M,S의 값이 들어있고
|
||||||
|
/// 아래 항목은 해당 문자의 ASCII코드값이다 첫자를 byte로 변경하고 변환하면 된다
|
||||||
|
/// </summary>
|
||||||
|
public enum AgvSpeed : byte
|
||||||
{
|
{
|
||||||
High,
|
High = 0x48,
|
||||||
Middle,
|
Middle = 0x4D,
|
||||||
Low,
|
Low = 0x4C,
|
||||||
|
MarkStop = 0x53,
|
||||||
}
|
}
|
||||||
public enum AgvRunDirection
|
|
||||||
|
/// <summary>
|
||||||
|
/// STS : S,L,R
|
||||||
|
/// </summary>
|
||||||
|
public enum AgvSts : byte
|
||||||
{
|
{
|
||||||
Straight,
|
Straight = 0x53,
|
||||||
Left,
|
Left = 0x4c,
|
||||||
Right,
|
Right = 0x052,
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum AGVActionReasonCode
|
public enum AGVActionReasonCode
|
||||||
@@ -41,11 +52,21 @@ namespace AGVControl
|
|||||||
NotOnPath, // 현재 위치가 경로에 없음
|
NotOnPath, // 현재 위치가 경로에 없음
|
||||||
Arrived, // 경로의 마지막 지점(목적지 도달)
|
Arrived, // 경로의 마지막 지점(목적지 도달)
|
||||||
Normal, // 정상(다음 RFID 있음)
|
Normal, // 정상(다음 RFID 있음)
|
||||||
NeedTurn,
|
|
||||||
|
/// <summary>
|
||||||
|
/// 방향전환을 위한 턴이다
|
||||||
|
/// </summary>
|
||||||
|
NeedTurnMove,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 지정된 RFID위치에서 TURN이 요청되었다
|
||||||
|
/// </summary>
|
||||||
|
NeedTurnPoint,
|
||||||
NoTurnPoint,
|
NoTurnPoint,
|
||||||
PathCalcError,
|
PathCalcError,
|
||||||
NoDirection,
|
NoDirection,
|
||||||
MoveForTurn,
|
MoveForTurn,
|
||||||
busy,
|
busy,
|
||||||
|
WaitForMarkStop,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -191,6 +191,9 @@ namespace COMM
|
|||||||
BatWarnTime,
|
BatWarnTime,
|
||||||
IdleStopTime,
|
IdleStopTime,
|
||||||
StatusReporttime,
|
StatusReporttime,
|
||||||
|
|
||||||
|
CheckGotoTargetSet,
|
||||||
|
SendGotoCommand,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user