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

Eight
lhiven 5 months ago
parent d8d7f01c97
commit 25c6794d2d

@ -115,35 +115,41 @@ namespace Rs.MotionPlat.Flow.SubFlow
logInfo = $"{GetClassName()} 通知相机拍照";
MessageQueue.Instance.Insert(logInfo);
Thread.Sleep(GlobalVar.FixtureTakePicDelaytime);
VisionHelper.fixtureDumpProductVision.ClearQueue();
UpCameraHelper.Grab();
//AxisControl.LoadY2.ComparePulse(1, false);//开始拍照
if(GlobalVar.RunSpace)
if(VisionHelper.fixtureDumpProductVision.ClearQueue())
{
flowStep = EFixturePlaceFlowStep.;
}
else
{
vr = VisionHelper.Grab(EVisionScene.FixtureDumpProduct,$"M{curFixture.Index};");
if(vr!=null && vr.Result)
UpCameraHelper.Grab();
//AxisControl.LoadY2.ComparePulse(1, false);//开始拍照
if (GlobalVar.RunSpace)
{
curFixture.PlaceProductOffsetX = vr.OffsetX;
curFixture.PlaceProductOffsetY = vr.OffsetY;
flowStep = EFixturePlaceFlowStep.;
}
else
{
AlarmEntity alarmEntity = AlarmCollection.Get(AlarmConstID.).Transform(curFixture.Index);
if(alarmEntity!=null)
vr = VisionHelper.Grab(EVisionScene.FixtureDumpProduct, $"M{curFixture.Index};");
if (vr != null && vr.Result)
{
Msgbox.ShowDialog(alarmEntity, EButtonType.Retry,true);
curFixture.PlaceProductOffsetX = vr.OffsetX;
curFixture.PlaceProductOffsetY = vr.OffsetY;
flowStep = EFixturePlaceFlowStep.;
}
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;
case EFixturePlaceFlowStep.:
if (curNozzle != null)

@ -159,44 +159,50 @@ namespace Rs.MotionPlat.Flow.SubFlow
}
break;
case EStockPlaceFlowStep.:
VisionHelper.trayLocationVision.ClearQueue();
UpCameraHelper.Grab();
VisionResult vr = VisionHelper.Grab(Vision.EVisionScene.TrayLocation);
if((vr!=null && vr.Result) || GlobalVar.RunSpace)
if(VisionHelper.trayLocationVision.ClearQueue())
{
if(GlobalVar.RunSpace)
UpCameraHelper.Grab();
VisionResult vr = VisionHelper.Grab(Vision.EVisionScene.TrayLocation);
if ((vr != null && vr.Result) || GlobalVar.RunSpace)
{
flowStep = EStockPlaceFlowStep.;
}
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))
if (GlobalVar.RunSpace)
{
Directory.CreateDirectory(dataDir);
flowStep = EStockPlaceFlowStep.;
}
string dataFilePath = $"{dataDir}//{GlobalVar.LotName}_{trayType}.csv";
if (!File.Exists(dataFilePath))
else
{
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
{
Msgbox.ShowTipDialog(EButtonType.Retry, "stock slot location fail", "", true);
Msgbox.Show("send C to vision fail", EButtonType.Recheck);
}
break;
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: AssemblyFileVersion("1.0.0.0")]

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

Loading…
Cancel
Save