Commit d311146a LN

压紧轴回原点增加自动重复运动功能

1 个父辈 2d7428e5
...@@ -75,7 +75,10 @@ ...@@ -75,7 +75,10 @@
FA开头的二维码,默认为7*32 FA开头的二维码,默认为7*32
20190606
进入IO界面需要一直读取测高值。
压紧轴回原点增加自动重复运动功能。
......
...@@ -37,10 +37,10 @@ ...@@ -37,10 +37,10 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="CodeLibrary"> <Reference Include="CodeLibrary">
<HintPath>..\..\dll\CodeLibrary.dll</HintPath> <HintPath>..\..\..\RC32-SZBOSCH-ACSingleStore\dll\CodeLibrary.dll</HintPath>
</Reference> </Reference>
<Reference Include="halcondotnet"> <Reference Include="halcondotnet">
<HintPath>C:\Program Files\MVTec\HALCON-12.0\bin\dotnet35\halcondotnet.dll</HintPath> <HintPath>..\..\..\RC32-SZBOSCH-ACSingleStore\dll\halcondotnet.dll</HintPath>
</Reference> </Reference>
<Reference Include="log4net, Version=1.2.15.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL"> <Reference Include="log4net, Version=1.2.15.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion> <SpecificVersion>False</SpecificVersion>
......
...@@ -309,16 +309,28 @@ namespace OnlineStore.DeviceLibrary ...@@ -309,16 +309,28 @@ namespace OnlineStore.DeviceLibrary
} }
return false; return false;
} }
public static bool IsHomeMoveEnd(int slvAddr, DateTime time, out string msg)
{ //public static bool IsHomeMoveEnd(int slvAddr, DateTime time, out string msg)
ShuoKeInfo shuokeInfo = GetStatus(slvAddr); //{
msg = " IsInMove【" + shuokeInfo.IsInMove + "】Org【" + shuokeInfo.Org + "】"; // ShuoKeInfo shuokeInfo = GetStatus(slvAddr);
if (shuokeInfo.IsInMove .Equals(0) && shuokeInfo.Org.Equals(0)&&shuokeInfo.UpdateTime>time) // msg = " IsInMove【" + shuokeInfo.IsInMove + "】Org【" + shuokeInfo.Org + "】";
{ // if (shuokeInfo.IsInMove .Equals(0) && shuokeInfo.Org.Equals(0)&&shuokeInfo.UpdateTime>time)
return true; // {
} // return true;
return false; // }
} // //如果是运动结束状态,但原点未到达,直接重新开始运动
// else if (shuokeInfo.IsInMove.Equals(0) && shuokeInfo.Org.Equals(1) && shuokeInfo.UpdateTime > time)
// {
// TimeSpan span = DateTime.Now - lastRHomeTime;
// if (span.TotalSeconds > 3)
// {
// LogUtil.error("【" + PortName + "】已经停止运动但不在原点,重新回原点");
// lastRHomeTime = DateTime.Now;
// HomeMove(slvAddr);
// }
// }
// return false;
//}
#endregion #endregion
...@@ -343,7 +355,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -343,7 +355,7 @@ namespace OnlineStore.DeviceLibrary
} }
// <param name="homeType">0=反方向,1=正方向</param> // <param name="homeType">0=反方向,1=正方向</param>
public static void HomeMove(int slvAddr, byte homeType) public static void HomeMove(int slvAddr, byte homeType=1)
{ {
string fangx = homeType.Equals(0) ? "反方向" : "正方向"; string fangx = homeType.Equals(0) ? "反方向" : "正方向";
LogUtil.info("压紧轴原点返回:" + fangx); LogUtil.info("压紧轴原点返回:" + fangx);
......
using HalconDotNet; 
using OnlineStore.Common; using OnlineStore.Common;
using OnlineStore.LoadCSVLibrary; using OnlineStore.LoadCSVLibrary;
using System; using System;
......
...@@ -209,7 +209,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -209,7 +209,7 @@ namespace OnlineStore.DeviceLibrary
Alarm(StoreAlarmType.IoSingleTimeOut, "", WarnMsg, StoreMove.MoveType); Alarm(StoreAlarmType.IoSingleTimeOut, "", WarnMsg, StoreMove.MoveType);
} }
} }
private static DateTime lastComRHomeTime = DateTime.Now;
private bool ShuoKeIsEnd(WaitResultInfo wait, out string msg) private bool ShuoKeIsEnd(WaitResultInfo wait, out string msg)
{ {
//bool result = false; //bool result = false;
...@@ -217,7 +217,25 @@ namespace OnlineStore.DeviceLibrary ...@@ -217,7 +217,25 @@ namespace OnlineStore.DeviceLibrary
if (wait.IsHomeMove) if (wait.IsHomeMove)
{ {
return ShuoKeControls.IsHomeMoveEnd(wait.SlvAddr, StoreMove.LastSetpTime, out msg); //return ShuoKeControls.IsHomeMoveEnd(wait.SlvAddr, StoreMove.LastSetpTime, out msg);
ShuoKeInfo shuokeInfo = ShuoKeControls.GetStatus(wait.SlvAddr);
msg = " IsInMove【" + shuokeInfo.IsInMove + "】Org【" + shuokeInfo.Org + "】";
if (shuokeInfo.IsInMove.Equals(0) && shuokeInfo.Org.Equals(0) )
{
return true;
}
//如果是运动结束状态,但原点未到达,直接重新开始运动
else if (shuokeInfo.IsInMove.Equals(0) && shuokeInfo.Org.Equals(1) )
{
TimeSpan span = DateTime.Now - lastComRHomeTime;
if (span.TotalSeconds > 3 && (StoreMove.CanWhileCount > 0))
{
lastComRHomeTime = DateTime.Now;
StoreMove.CanWhileCount--;
LogUtil.error("压紧轴 已经停止运动但不在原点,重新回原点,剩余重新运动次数" + StoreMove.CanWhileCount);
ShuoKeControls.HomeMove(wait.SlvAddr);
}
}
} }
else else
{ {
......
using CodeLibrary; using CodeLibrary;
using HalconDotNet;
using OnlineStore.Common; using OnlineStore.Common;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
...@@ -164,7 +163,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -164,7 +163,7 @@ namespace OnlineStore.DeviceLibrary
LogUtil.debug(" 摄像机【" + cameraName + "】获取图片完成"); LogUtil.debug(" 摄像机【" + cameraName + "】获取图片完成");
System.Threading.Thread.Sleep(1); System.Threading.Thread.Sleep(1);
HObject ho_Image = HDCodeHelper.Bitmap2HObjectBpp24(bitmap); HalconDotNet.HObject ho_Image = HDCodeHelper.Bitmap2HObjectBpp24(bitmap);
LogUtil.debug(" 摄像机【" + cameraName + "】转换图片完成,开始扫码"); LogUtil.debug(" 摄像机【" + cameraName + "】转换图片完成,开始扫码");
List<CodeInfo> cc = new List<CodeInfo>(); List<CodeInfo> cc = new List<CodeInfo>();
foreach (string codeType in codeTypeList) foreach (string codeType in codeTypeList)
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!