1
This commit is contained in:
parent
7d0d8998d3
commit
2898e2015c
@ -2840,7 +2840,7 @@ namespace ViewModel
|
||||
CurrXizui.State.StatusBackground = ColorStr.Yellow;
|
||||
bl = true;
|
||||
}
|
||||
else if (CurrBox != null && !ZhiTongMode && NextStationReceive.RequestCache == false && MyFlow.RunTime.AddSeconds(1)<DateTime.Now) //直通模式不测试
|
||||
else if (CurrBox != null && !ZhiTongMode && (OnlyMe || NextStationReceive.RequestCache == false) && MyFlow.RunTime.AddSeconds(1)<DateTime.Now) //直通模式不测试
|
||||
{
|
||||
MyFlow.RunStep++;
|
||||
MyFlow.RunTime = DateTime.Now;
|
||||
@ -3077,8 +3077,8 @@ namespace ViewModel
|
||||
TempPoint = Coper(CurrBox.PutProPoint1);
|
||||
|
||||
//下视觉定位补偿
|
||||
TempPoint.PointX += CurrXizui.OfficeX;
|
||||
TempPoint.PointY -= CurrXizui.OfficeY;
|
||||
TempPoint.PointX -= CurrXizui.OfficeX;
|
||||
TempPoint.PointY += CurrXizui.OfficeY;
|
||||
TempPoint.PointU -= CurrXizui.OfficeU;
|
||||
MyFlow.RunStep++;
|
||||
MyFlow.RunTime = DateTime.Now;
|
||||
@ -3260,7 +3260,7 @@ namespace ViewModel
|
||||
break;
|
||||
case GengralProcessEnum.Step8:
|
||||
//真空检知有,无料不检查真空
|
||||
if (CurrXizui.VacuumCheck.LightUp || CurrBox.State.StatusBackground == ColorStr.White || CurrentMachine.RunningMode)
|
||||
if ((CurrXizui.VacuumCheck.LightUp && MyFlow.RunTime.AddMilliseconds(500)< DateTime.Now) || CurrBox.State.StatusBackground == ColorStr.White || CurrentMachine.RunningMode)
|
||||
{
|
||||
CurrXizui.QiGang.Switchs = false; //气缸上升
|
||||
|
||||
@ -3280,35 +3280,32 @@ namespace ViewModel
|
||||
MyFlow.RunTime = DateTime.Now;
|
||||
}
|
||||
break;
|
||||
|
||||
case GengralProcessEnum.Step9:
|
||||
////气缸上升到位
|
||||
//if (CurrXizui.QiGangUp.LightUp)
|
||||
//{
|
||||
//二次检查真空
|
||||
if (CurrXizui.VacuumCheck.LightUp || CurrBox.State.StatusBackground == ColorStr.White || CurrentMachine.RunningMode)
|
||||
{
|
||||
MyFlow.RunStep++;
|
||||
MyFlow.RunTime = DateTime.Now;
|
||||
|
||||
|
||||
}
|
||||
else if (TimeOutValidation(MyFlow.RunTime, 3000, CurrXizui.VacuumCheck.InputMeaning + "异常"))
|
||||
{
|
||||
CurrXizui.QiGang.Switchs = false; //气缸上升
|
||||
MyFlow.RunStep = GengralProcessEnum.Step6;
|
||||
MyFlow.RunTime = DateTime.Now;
|
||||
}
|
||||
//}
|
||||
//else if (TimeOutValidation(MyFlow.RunTime, 3000, CurrXizui.QiGangUp.InputMeaning + "超时"))
|
||||
//{
|
||||
// CurrXizui.QiGang.Switchs = false; //气缸上升
|
||||
// MyFlow.RunTime = DateTime.Now;
|
||||
//}
|
||||
break;
|
||||
case GengralProcessEnum.Step10:
|
||||
//机器人到位
|
||||
if (Robot.RcvShowInfo.Contains("runpointok"))
|
||||
{
|
||||
MyFlow.RunStep++;
|
||||
MyFlow.RunTime = DateTime.Now;
|
||||
}
|
||||
else if (TimeOutValidation(MyFlow.RunTime, 10000, "机器人到位超时"))
|
||||
{
|
||||
Robot.RunRobotPoint(TempPoint);
|
||||
MyFlow.RunTime = DateTime.Now;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case GengralProcessEnum.Step10:
|
||||
////气缸上升到位
|
||||
//if (CurrXizui.QiGangUp.LightUp)
|
||||
//{
|
||||
//二次检查真空
|
||||
if (CurrXizui.VacuumCheck.LightUp || CurrBox.State.StatusBackground == ColorStr.White || CurrentMachine.RunningMode)
|
||||
{
|
||||
|
||||
|
||||
|
||||
//测试盒状态赋值给吸嘴后清空测试盒状态
|
||||
if (CurrBox.State.StatusBackground == ColorStr.Green)
|
||||
{
|
||||
@ -3323,12 +3320,20 @@ namespace ViewModel
|
||||
MyFlow.RunStep = GengralProcessEnum.End;
|
||||
MyFlow.RunTime = DateTime.Now;
|
||||
bl = true;
|
||||
|
||||
}
|
||||
else if (TimeOutValidation(MyFlow.RunTime, 10000, "机器人到位超时"))
|
||||
else if (TimeOutValidation(MyFlow.RunTime, 3000, CurrXizui.VacuumCheck.InputMeaning + "异常"))
|
||||
{
|
||||
Robot.RunRobotPoint(TempPoint);
|
||||
CurrXizui.QiGang.Switchs = false; //气缸上升
|
||||
MyFlow.RunStep = GengralProcessEnum.Step6;
|
||||
MyFlow.RunTime = DateTime.Now;
|
||||
}
|
||||
//}
|
||||
//else if (TimeOutValidation(MyFlow.RunTime, 3000, CurrXizui.QiGangUp.InputMeaning + "超时"))
|
||||
//{
|
||||
// CurrXizui.QiGang.Switchs = false; //气缸上升
|
||||
// MyFlow.RunTime = DateTime.Now;
|
||||
//}
|
||||
break;
|
||||
}
|
||||
|
||||
@ -3504,27 +3509,27 @@ namespace ViewModel
|
||||
/// </summary>
|
||||
public void CheckXizui()
|
||||
{
|
||||
if (RunStatu == RunStatuEnum.Normal)
|
||||
{
|
||||
if (XizuiLabelPaperList != null)
|
||||
{
|
||||
foreach (var item in XizuiLabelPaperList)
|
||||
{
|
||||
//运行中,产品掉落,报警提示
|
||||
if (item.State.StatusBackground != ColorStr.White && item.State.StatusBackground != ColorStr.Red && item.VacuumSwitch.Switchs && !item.VacuumCheck.LightUp)
|
||||
{
|
||||
if (item.CheckVacuumTime.AddMilliseconds(1000) <= DateTime.Now)
|
||||
{
|
||||
ExcepStop("吸嘴" + item.Number + "产品掉落,请检查");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
item.CheckVacuumTime = DateTime.Now;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//if (RunStatu == RunStatuEnum.Normal)
|
||||
//{
|
||||
// if (XizuiLabelPaperList != null)
|
||||
// {
|
||||
// foreach (var item in XizuiLabelPaperList)
|
||||
// {
|
||||
// //运行中,产品掉落,报警提示
|
||||
// if (item.State.StatusBackground != ColorStr.White && item.State.StatusBackground != ColorStr.Red && item.VacuumSwitch.Switchs && !item.VacuumCheck.LightUp)
|
||||
// {
|
||||
// if (item.CheckVacuumTime.AddMilliseconds(1000) <= DateTime.Now)
|
||||
// {
|
||||
// ExcepStop("吸嘴" + item.Number + "产品掉落,请检查");
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// item.CheckVacuumTime = DateTime.Now;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
@ -1,29 +1,20 @@
|
||||
using Community;
|
||||
using DAL;
|
||||
using HalconDotNet;
|
||||
using MahApps.Metro.Controls.Dialogs;
|
||||
using Microsoft.Win32;
|
||||
using Model;
|
||||
using Model.Vision;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Imaging;
|
||||
using System.Runtime.InteropServices;
|
||||
using Model;
|
||||
using DAL;
|
||||
using System.IO;
|
||||
using System.Windows;
|
||||
using System.Transactions;
|
||||
using System.Collections.ObjectModel;
|
||||
using Microsoft.Win32;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Windows;
|
||||
using System.Windows.Threading;
|
||||
using Model.Vision;
|
||||
using MahApps.Metro;
|
||||
using MahApps.Metro.Controls.Dialogs;
|
||||
using Views.Vision;
|
||||
using System.Reflection;
|
||||
using ViewModel.Robots;
|
||||
using System.Windows.Controls;
|
||||
using Views.Vision;
|
||||
|
||||
namespace ViewModel.Vision
|
||||
{
|
||||
@ -276,7 +267,7 @@ namespace ViewModel.Vision
|
||||
PassagewayBrightness3 = value.PassagewayBrightness3;
|
||||
PassagewayBrightness4 = value.PassagewayBrightness4;
|
||||
SelectCodeTypeID = value.MyROI.CodeTypeID;
|
||||
SelectCodeStr= value.MyROI.CodeStr;
|
||||
SelectCodeStr = value.MyROI.CodeStr;
|
||||
this.RaisePropertyChanged("SelectModel");
|
||||
|
||||
}
|
||||
@ -310,7 +301,7 @@ namespace ViewModel.Vision
|
||||
/// 加载本地图像
|
||||
/// </summary>
|
||||
public DelegateCommand LoadingImageCommand { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 相机校正
|
||||
/// </summary>
|
||||
@ -605,7 +596,7 @@ namespace ViewModel.Vision
|
||||
|
||||
this.RoiShapeSelectCommand = new DelegateCommand();
|
||||
this.RoiShapeSelectCommand.ExecuteAction = new Action<object>(RoiShapeSelect);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -616,7 +607,7 @@ namespace ViewModel.Vision
|
||||
private void RoiShapeSelect(object obj)
|
||||
{
|
||||
string str = obj.ToString();
|
||||
DrawRoiShape= (DrawRoiEmn)Enum.Parse(typeof(DrawRoiEmn), str);
|
||||
DrawRoiShape = (DrawRoiEmn)Enum.Parse(typeof(DrawRoiEmn), str);
|
||||
|
||||
}
|
||||
|
||||
@ -1146,7 +1137,7 @@ namespace ViewModel.Vision
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
#region 获取图片
|
||||
/// <summary>
|
||||
/// 获取单张图片
|
||||
@ -1440,7 +1431,7 @@ namespace ViewModel.Vision
|
||||
ShowText("请绘制ROI!单个ROI绘制完成单击右键后,继续绘制单击左键,结束单击右键", "green");
|
||||
|
||||
#region 2、绘制模型区域
|
||||
|
||||
|
||||
SetColored("blue");
|
||||
SetDraw("margin");
|
||||
|
||||
@ -1462,7 +1453,7 @@ namespace ViewModel.Vision
|
||||
RM.MyROI.hv_Column = hv_Column;
|
||||
RM.MyROI.hv_Radius = hv_Radius;
|
||||
RM.MyROI.ho_OutlineROI = ho_Rectangle;
|
||||
|
||||
|
||||
break;
|
||||
case DrawRoiEmn.R1:
|
||||
//画一个矩形 获取起点坐标和终点坐标
|
||||
@ -1746,13 +1737,13 @@ namespace ViewModel.Vision
|
||||
HOperatorSet.GenEmptyObj(out ho_ModelContours);
|
||||
HOperatorSet.GenEmptyObj(out ho_TransContours);
|
||||
HOperatorSet.GenEmptyObj(out ho_ImageROI);
|
||||
|
||||
|
||||
//1,获取图像
|
||||
if (!GetImage(RM))
|
||||
{
|
||||
return pipeiOK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//去畸变
|
||||
// DeDistortion();
|
||||
@ -1770,7 +1761,7 @@ namespace ViewModel.Vision
|
||||
HOperatorSet.ReduceDomain(Ho_Image, RM.ho_RectangleModel, out ho_ImageReduced);
|
||||
//识别图像特征
|
||||
HOperatorSet.FindShapeModel(ho_ImageReduced, RM.MyROI.hv_ModelID, (new HTuple(0)).TupleRad(), (new HTuple(360)).TupleRad(), RM.MyROI.RecognitionCoefficient, 1, 0.5, (new HTuple("least_squares")).TupleConcat("max_deformation 5"), 0, 0.9, out hv_Row, out hv_Column, out hv_Angle, out hv_Score);
|
||||
|
||||
|
||||
//HOperatorSet.FindShapeModel(ho_ImageReduced, RM.MyROI.hv_ModelID, (new HTuple(0)).TupleRad(), (new HTuple(360)).TupleRad(), RM.MyROI.RecognitionCoefficient, 1, 0.5, "least_squares", 0, 0.9, out hv_Row, out hv_Column, out hv_Angle, out hv_Score);
|
||||
|
||||
if (hv_Score == null || hv_Score.TupleLength() <= 0)
|
||||
@ -1848,8 +1839,8 @@ namespace ViewModel.Vision
|
||||
HOperatorSet.AffineTransPoint2d(RM.hv_JiuDianCalibrationPar, (HTuple)RM.MyROI.ModelFeaturePiont.PixelRow, (HTuple)RM.MyROI.ModelFeaturePiont.PixelColumn, out PixelRow, out PixelColumn);
|
||||
HOperatorSet.AffineTransPoint2d(RM.hv_JiuDianCalibrationPar, (HTuple)RM.MyROI.ModelFeaturePiont.hv_RefRow, (HTuple)RM.MyROI.ModelFeaturePiont.hv_RefColumn, out hv_RefRow, out hv_RefColumn);
|
||||
|
||||
RM.MyROI.ModelFeaturePiont.DeviationX = Convert.ToDecimal((double)(hv_RefColumn - PixelColumn));
|
||||
RM.MyROI.ModelFeaturePiont.DeviationY = Convert.ToDecimal((double)hv_RefRow - (double)PixelRow);
|
||||
RM.MyROI.ModelFeaturePiont.DeviationX = Convert.ToDecimal((double)(PixelColumn - hv_RefColumn));
|
||||
RM.MyROI.ModelFeaturePiont.DeviationY = Convert.ToDecimal((double)(PixelRow - hv_RefRow));
|
||||
|
||||
|
||||
|
||||
@ -1864,7 +1855,7 @@ namespace ViewModel.Vision
|
||||
ShowText("像素坐标" + "X:" + Math.Round(x, 4) + ",Y:" + Math.Round(y, 4) + ",U:" + Math.Round(RM.MyROI.ModelFeaturePiont.AngleU, 4), "green");
|
||||
|
||||
}
|
||||
|
||||
|
||||
pipeiOK = true;
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user