|
|
@ -0,0 +1,161 @@
|
|
|
|
|
|
|
|
using Rs.Camera;
|
|
|
|
|
|
|
|
using Rs.Framework;
|
|
|
|
|
|
|
|
using Rs.Motion.GugaoEcat;
|
|
|
|
|
|
|
|
using Rs.Motion.GugaoPulse;
|
|
|
|
|
|
|
|
using Rs.Motion;
|
|
|
|
|
|
|
|
using Rs.MotionPlat.Flow;
|
|
|
|
|
|
|
|
using System;
|
|
|
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
|
|
using System.Linq;
|
|
|
|
|
|
|
|
using System.Text;
|
|
|
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
|
|
using Rs.Motion.Base;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
namespace Rs.MotionPlat.Commom
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
public class Ops
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
public static void Init()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
#region 初始化固高卡
|
|
|
|
|
|
|
|
ErrorCode errCode = GugaoPulseCardManager.Instance.Init();
|
|
|
|
|
|
|
|
if (errCode > ErrorCode.Ok)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
MessageQueue.Instance.Warn("Gugao motion card load fail");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#region 初始化ztm卡
|
|
|
|
|
|
|
|
errCode = ZtmCardManager.Instance.Init();
|
|
|
|
|
|
|
|
if (errCode > ErrorCode.Ok)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
MessageQueue.Instance.Warn("ZTM motion card load fail");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
MessageQueue.Instance.Insert("ZTM motion card load ok");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
#region 初始化IO
|
|
|
|
|
|
|
|
IoManager.Instance.Init();
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#region 链接相机
|
|
|
|
|
|
|
|
//链接相机
|
|
|
|
|
|
|
|
ECameraErrorCode ceCode = HikCamera.Instance.Init();
|
|
|
|
|
|
|
|
if (ceCode > ECameraErrorCode.Ok)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
MessageQueue.Instance.Warn(ceCode.ToString());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
MessageQueue.Instance.Insert("Camera load ok!");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int ret = HikCamera.Instance.SetReverseX("upCamera", EDir.Y, true);
|
|
|
|
|
|
|
|
ret += HikCamera.Instance.SetReverseX("upCamera", EDir.X, true);
|
|
|
|
|
|
|
|
if (ret != 0)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
MessageQueue.Instance.Warn("Camera init error");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
ret = 0;
|
|
|
|
|
|
|
|
ret = HikCamera.Instance.SetReverseX("downCamera", EDir.X, true);
|
|
|
|
|
|
|
|
ret += HikCamera.Instance.SetReverseX("downCamera", EDir.Y, false);
|
|
|
|
|
|
|
|
if (ret != 0)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
MessageQueue.Instance.Warn("Camera init error");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ret = HikCamera.Instance.StartGrab("upCamera");
|
|
|
|
|
|
|
|
if (ret != 0)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
MessageQueue.Instance.Warn("Camera init error");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
ret = HikCamera.Instance.StartGrab("downCamera");
|
|
|
|
|
|
|
|
if (ret != 0)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
MessageQueue.Instance.Warn("Camera init error");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SafeControl.Instance.Init();
|
|
|
|
|
|
|
|
NozzleManager.Init();
|
|
|
|
|
|
|
|
TestCenter.Instance.Init();
|
|
|
|
|
|
|
|
MachineManage.Instance.InitializeState = EInitializeState.Initialized;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static bool IsStop(params string[] axies)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
foreach (var axisname in axies)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (!IsStop(AxisControl.GetAxis(axisname)))
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
public static bool IsStop(params IAxis[] axies)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
foreach (var axis in axies)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
axis.IsStop(out bool bStop);
|
|
|
|
|
|
|
|
if (!bStop)
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static bool IsHomed(params string[] axies)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
foreach (var axisname in axies)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (!IsHomed(AxisControl.GetAxis(axisname)))
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static bool IsHomed(params IAxis[] axies)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
foreach (var axis in axies)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (axis.HomeStatus != EHomeStatus.Finished)
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static void On(string ioName)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
IoManager.Instance.WriteOut(ioName, 1);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static void Off(string ioName)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
IoManager.Instance.WriteOut(ioName, 0);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static bool IsOn(string ioName)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return IoManager.Instance.ReadIn(ioName) == 1;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static bool IsOff(string ioName)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return IoManager.Instance.ReadIn(ioName) == 0;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static bool IsOutOn(string ioName)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return IoManager.Instance.ReadOut(ioName) == 1;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static bool IsOutOff(string ioName)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return IoManager.Instance.ReadOut(ioName) == 0;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|