1、增加和视觉软件通信的日志

Eight
lhiven 5 months ago
parent d8d7f01c97
commit 25c6794d2d

@ -115,35 +115,41 @@ namespace Rs.MotionPlat.Flow.SubFlow
logInfo = $"{GetClassName()} 通知相机拍照"; logInfo = $"{GetClassName()} 通知相机拍照";
MessageQueue.Instance.Insert(logInfo); MessageQueue.Instance.Insert(logInfo);
Thread.Sleep(GlobalVar.FixtureTakePicDelaytime); Thread.Sleep(GlobalVar.FixtureTakePicDelaytime);
VisionHelper.fixtureDumpProductVision.ClearQueue(); if(VisionHelper.fixtureDumpProductVision.ClearQueue())
UpCameraHelper.Grab();
//AxisControl.LoadY2.ComparePulse(1, false);//开始拍照
if(GlobalVar.RunSpace)
{ {
flowStep = EFixturePlaceFlowStep.; UpCameraHelper.Grab();
} //AxisControl.LoadY2.ComparePulse(1, false);//开始拍照
else if (GlobalVar.RunSpace)
{
vr = VisionHelper.Grab(EVisionScene.FixtureDumpProduct,$"M{curFixture.Index};");
if(vr!=null && vr.Result)
{ {
curFixture.PlaceProductOffsetX = vr.OffsetX;
curFixture.PlaceProductOffsetY = vr.OffsetY;
flowStep = EFixturePlaceFlowStep.; flowStep = EFixturePlaceFlowStep.;
} }
else else
{ {
AlarmEntity alarmEntity = AlarmCollection.Get(AlarmConstID.).Transform(curFixture.Index); vr = VisionHelper.Grab(EVisionScene.FixtureDumpProduct, $"M{curFixture.Index};");
if(alarmEntity!=null) if (vr != null && vr.Result)
{ {
Msgbox.ShowDialog(alarmEntity, EButtonType.Retry,true); curFixture.PlaceProductOffsetX = vr.OffsetX;
curFixture.PlaceProductOffsetY = vr.OffsetY;
flowStep = EFixturePlaceFlowStep.;
} }
else else
{ {
Msg.ShowError("翻译文件中未找到 治具放料定位失败"); AlarmEntity alarmEntity = AlarmCollection.Get(AlarmConstID.).Transform(curFixture.Index);
if (alarmEntity != null)
{
Msgbox.ShowDialog(alarmEntity, EButtonType.Retry, true);
}
else
{
Msg.ShowError("翻译文件中未找到 治具放料定位失败");
}
} }
} }
} }
else
{
Msgbox.Show("send C to vision fail", EButtonType.Recheck);
}
break; break;
case EFixturePlaceFlowStep.: case EFixturePlaceFlowStep.:
if (curNozzle != null) if (curNozzle != null)

@ -159,44 +159,50 @@ namespace Rs.MotionPlat.Flow.SubFlow
} }
break; break;
case EStockPlaceFlowStep.: case EStockPlaceFlowStep.:
VisionHelper.trayLocationVision.ClearQueue(); if(VisionHelper.trayLocationVision.ClearQueue())
UpCameraHelper.Grab();
VisionResult vr = VisionHelper.Grab(Vision.EVisionScene.TrayLocation);
if((vr!=null && vr.Result) || GlobalVar.RunSpace)
{ {
if(GlobalVar.RunSpace) UpCameraHelper.Grab();
VisionResult vr = VisionHelper.Grab(Vision.EVisionScene.TrayLocation);
if ((vr != null && vr.Result) || GlobalVar.RunSpace)
{ {
flowStep = EStockPlaceFlowStep.; if (GlobalVar.RunSpace)
}
else
{
curNozzle = NozzleManager.GetNozzle(nozzleIndex);
slotOffsetX = vr.OffsetX;
slotOffsetY = vr.OffsetY;
string sn = "";
if (curNozzle != null && curNozzle.Product != null && !string.IsNullOrEmpty(curNozzle.Product.SN))
{
sn = curNozzle.Product.SN;
}
string title = "index,sn,offsetx,offsety,time\r\n";
string content = $"{slotIndex},{sn},{slotOffsetX},{slotOffsetY},{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss fff")}\r\n";
string dataDir = $"d://data/placestock//{DateTime.Now.ToString("yyyy-MM-dd")}";
if (!Directory.Exists(dataDir))
{ {
Directory.CreateDirectory(dataDir); flowStep = EStockPlaceFlowStep.;
} }
string dataFilePath = $"{dataDir}//{GlobalVar.LotName}_{trayType}.csv"; else
if (!File.Exists(dataFilePath))
{ {
File.AppendAllText(dataFilePath, title); curNozzle = NozzleManager.GetNozzle(nozzleIndex);
slotOffsetX = vr.OffsetX;
slotOffsetY = vr.OffsetY;
string sn = "";
if (curNozzle != null && curNozzle.Product != null && !string.IsNullOrEmpty(curNozzle.Product.SN))
{
sn = curNozzle.Product.SN;
}
string title = "index,sn,offsetx,offsety,time\r\n";
string content = $"{slotIndex},{sn},{slotOffsetX},{slotOffsetY},{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss fff")}\r\n";
string dataDir = $"d://data/placestock//{DateTime.Now.ToString("yyyy-MM-dd")}";
if (!Directory.Exists(dataDir))
{
Directory.CreateDirectory(dataDir);
}
string dataFilePath = $"{dataDir}//{GlobalVar.LotName}_{trayType}.csv";
if (!File.Exists(dataFilePath))
{
File.AppendAllText(dataFilePath, title);
}
File.AppendAllText(dataFilePath, content);
flowStep = EStockPlaceFlowStep.;
} }
File.AppendAllText(dataFilePath, content); }
flowStep = EStockPlaceFlowStep.; else
{
Msgbox.ShowTipDialog(EButtonType.Retry, "stock slot location fail", "", true);
} }
} }
else else
{ {
Msgbox.ShowTipDialog(EButtonType.Retry, "stock slot location fail", "", true); Msgbox.Show("send C to vision fail", EButtonType.Recheck);
} }
break; break;
case EStockPlaceFlowStep.: case EStockPlaceFlowStep.:

@ -31,6 +31,6 @@ using System.Runtime.InteropServices;
// //
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值 //可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
//通过使用 "*",如下所示: //通过使用 "*",如下所示:
[assembly: AssemblyVersion("1.20.24.33")] [assembly: AssemblyVersion("1.20.25.01")]
//[assembly: AssemblyVersion("1.0.0.0")] //[assembly: AssemblyVersion("1.0.0.0")]
//[assembly: AssemblyFileVersion("1.0.0.0")] //[assembly: AssemblyFileVersion("1.0.0.0")]

@ -23,7 +23,7 @@ namespace Rs.MotionPlat.Vision
else else
{ {
string data = Encoding.ASCII.GetString(reciveBuffer.ToArray()); string data = Encoding.ASCII.GetString(reciveBuffer.ToArray());
MessageQueue.Instance.Insert(data); MessageQueue.Instance.Insert($" >>> {data}");
if (data == "M,0") if (data == "M,0")
{ {
MessageQueue.Instance.Insert("视觉收到拍照指令"); MessageQueue.Instance.Insert("视觉收到拍照指令");
@ -31,7 +31,6 @@ namespace Rs.MotionPlat.Vision
else if (data == "C,0") else if (data == "C,0")
{ {
visionGrabEvent.Set(); visionGrabEvent.Set();
MessageQueue.Instance.Insert($" >>> {data}");
} }
else else
{ {

Loading…
Cancel
Save