..
This commit is contained in:
@@ -1,47 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Net.NetworkInformation;
|
||||
using System.Runtime.Serialization.Formatters.Binary;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using System.Management;
|
||||
using COMM;
|
||||
|
||||
namespace Project
|
||||
{
|
||||
public static partial class UTIL
|
||||
{
|
||||
public static string GetResultCodeMessage(eResult err)
|
||||
{
|
||||
return err.ToString().ToUpper();
|
||||
}
|
||||
|
||||
|
||||
public static string GetErrorMessage(eECode err, params object[] values)
|
||||
{
|
||||
switch (err)
|
||||
{
|
||||
case eECode.NOTALLOWUP:
|
||||
return "상차 허용 위치가 아닙니다";
|
||||
case eECode.AGVCONN:
|
||||
return Lang.AGV연결실패;
|
||||
case eECode.PLCCONN:
|
||||
return Lang.PLC통신실패;
|
||||
|
||||
default:
|
||||
return err.ToString();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -35,7 +35,7 @@ namespace Project
|
||||
}
|
||||
}
|
||||
|
||||
ePosition ParsePosition(int tag, out string dirBW)
|
||||
ePosition ParsePosition(uint tag, out string dirBW)
|
||||
{
|
||||
var tagstr = tag.ToString();
|
||||
var tagno = tagstr.Substring(0, tagstr.Length - 1);
|
||||
|
||||
@@ -115,7 +115,7 @@ namespace Project
|
||||
if (System.Diagnostics.Debugger.IsAttached == false)
|
||||
{
|
||||
PUB.Speak(Lang.자동재부팅을실행합니다);
|
||||
Util.SystemReboot(5, true);
|
||||
PUB.SystemReboot(5, true);
|
||||
}
|
||||
else PUB.setting.SetAutoModeOn = true;
|
||||
|
||||
|
||||
115
Cs_HMI/Project/StateMachine/_Xbee.cs
Normal file
115
Cs_HMI/Project/StateMachine/_Xbee.cs
Normal file
@@ -0,0 +1,115 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using AR;
|
||||
using arDev;
|
||||
using COMM;
|
||||
|
||||
namespace Project
|
||||
{
|
||||
public partial class fMain
|
||||
{
|
||||
|
||||
private void XBE_ProtocReceived(object sender, ENIG.EEProtocol.DataEventArgs e)
|
||||
{
|
||||
//TODO : 기능 처리필요 (XBee 메세지 데이터처리)
|
||||
//PUB.CheckManualChargeMode() : 수동충전확인
|
||||
//VAR.BOOL[eVarBool.FLAG_AUTORUN] : 자동실행
|
||||
//PUB.Speak("현재 위치는 QA 입니다.") : 음성출력
|
||||
|
||||
//ACS 수신 데이터 처리(타 장비는 확인하지 않는다)
|
||||
if (e.ReceivedPacket.ID == 0)
|
||||
{
|
||||
var data = e.ReceivedPacket.Data;
|
||||
var dataStr = System.Text.Encoding.Default.GetString(data);
|
||||
var cmd = (ENIGProtocol.AGVCommands)e.ReceivedPacket.Command;
|
||||
switch (cmd)
|
||||
{
|
||||
|
||||
case ENIGProtocol.AGVCommands.SetCurrent: //Set Current Position
|
||||
|
||||
if (uint.TryParse(dataStr, out uint tagno))
|
||||
{
|
||||
if (PUB.mapctl.SetCurrentPosition(tagno) == true)
|
||||
{
|
||||
PUB.log.AddI($"Set Position:{tagno}");
|
||||
}
|
||||
else PUB.log.AddE($"Position Error:{tagno}");
|
||||
}
|
||||
else PUB.log.AddE($"Position Param Error:{dataStr}");
|
||||
break;
|
||||
case ENIGProtocol.AGVCommands.Goto: //move to tag
|
||||
if (uint.TryParse(dataStr, out uint tagno2))
|
||||
{
|
||||
var currPos = PUB.mapctl.agv.CurrentRFID;///.AGVMoveToRFID(;
|
||||
if (currPos == 0) currPos = 10;
|
||||
var pathRlt = PUB.mapctl.CalculatePath(currPos,tagno2);
|
||||
if (pathRlt.Success == true)
|
||||
{
|
||||
PUB.log.AddI($"New Target:{tagno2}");
|
||||
}
|
||||
else PUB.log.AddE($"Path Error {pathRlt.Message} : {tagno2}");
|
||||
}
|
||||
else PUB.log.AddE($"Path Param Error :{dataStr}");
|
||||
break;
|
||||
case ENIGProtocol.AGVCommands.Stop: //stop
|
||||
PUB.AGV.AGVMoveStop("xbee");
|
||||
break;
|
||||
case ENIGProtocol.AGVCommands.Reset: //Error Reset
|
||||
PUB.AGV.AGVErrorReset();
|
||||
break;
|
||||
|
||||
case ENIGProtocol.AGVCommands.Manual: //Manual Move (Direction, speed, runtime)
|
||||
var Direction = data[0]; //0=back, 1=forward, 2=left, 3=right
|
||||
var Speed = data[1]; //0=slow, 1=normal, 2=fast
|
||||
var Runtime = data[2]; // running seconds
|
||||
|
||||
arDev.Narumi.ManulOpt opt = arDev.Narumi.ManulOpt.BS;
|
||||
arDev.Narumi.Speed spd = arDev.Narumi.Speed.Low;
|
||||
if (Speed == 1) spd = arDev.Narumi.Speed.Mid;
|
||||
else if (Speed == 2) spd = arDev.Narumi.Speed.High;
|
||||
|
||||
//0.자동모드가 아니라면 실행하지 않는다
|
||||
//1.입력된 파라미터로 AGV를 이동한다
|
||||
if (Direction == 0) opt = arDev.Narumi.ManulOpt.BS;
|
||||
else if (Direction == 1) opt = arDev.Narumi.ManulOpt.FS;
|
||||
else if (Direction == 2) opt = arDev.Narumi.ManulOpt.LT;
|
||||
else if (Direction == 3) opt = arDev.Narumi.ManulOpt.RT;
|
||||
|
||||
PUB.AGV.AGVMoveManual(opt, spd, arDev.Narumi.Sensor.PBSOn);
|
||||
break;
|
||||
case ENIGProtocol.AGVCommands.MarkStop: //Set MarkStop
|
||||
var MarkStop = data[0]; //0=off, 1=on
|
||||
|
||||
//마크센서에서 멈추게 한다
|
||||
PUB.AGV.AGVMoveStop("Xbee", arDev.Narumi.eStopOpt.MarkStop);
|
||||
break;
|
||||
case ENIGProtocol.AGVCommands.LiftControl: //Lift Control
|
||||
var LiftCommand = data[0]; //0=stop, 1=up, 2=down
|
||||
arDev.Narumi.LiftCommand LCmd = arDev.Narumi.LiftCommand.STP;
|
||||
if (LiftCommand == 1) LCmd = arDev.Narumi.LiftCommand.UP;
|
||||
else if (LiftCommand == 2) LCmd = arDev.Narumi.LiftCommand.DN;
|
||||
|
||||
//리프트제어
|
||||
PUB.AGV.LiftControl(LCmd);
|
||||
break;
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void XBE_MessageReceived(object sender, Device.Xbee.MessageArgs e)
|
||||
{
|
||||
if (e.IsError) PUB.log.AddE(e.Message);
|
||||
else PUB.log.Add(e.Message);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user