|
@@ -1,4 +1,5 @@
|
|
|
-using Cognex.VisionPro;
|
|
|
|
|
|
|
+using Basler.Pylon;
|
|
|
|
|
+using Cognex.VisionPro;
|
|
|
using Cognex.VisionPro.ToolBlock;
|
|
using Cognex.VisionPro.ToolBlock;
|
|
|
using CSScripting;
|
|
using CSScripting;
|
|
|
using MathNet.Numerics.Distributions;
|
|
using MathNet.Numerics.Distributions;
|
|
@@ -1008,14 +1009,14 @@ namespace TeamAAS_VP.Core
|
|
|
await item.WriteToPlcAddress(addressConfig.Out_ScrewCamera, plc);
|
|
await item.WriteToPlcAddress(addressConfig.Out_ScrewCamera, plc);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- if (current.ScrewPoints != null && current.ScrewPoints.Count > 0)
|
|
|
|
|
- {
|
|
|
|
|
- foreach (var item in current.ScrewPoints)
|
|
|
|
|
- {
|
|
|
|
|
- await item.WriteToPlcAddress(addressConfig.Out_Screw, plc);
|
|
|
|
|
- }
|
|
|
|
|
- await plc.WriteNodeAsync(addressConfig.Out_WorkNum.Address, (Int16)current.ScrewPoints.Count);
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ //if (current.ScrewPoints != null && current.ScrewPoints.Count > 0)
|
|
|
|
|
+ //{
|
|
|
|
|
+ // foreach (var item in current.ScrewPoints)
|
|
|
|
|
+ // {
|
|
|
|
|
+ // await item.WriteToPlcAddress(addressConfig.Out_Screw, plc);
|
|
|
|
|
+ // }
|
|
|
|
|
+ // await plc.WriteNodeAsync(addressConfig.Out_WorkNum.Address, (Int16)current.ScrewPoints.Count);
|
|
|
|
|
+ //}
|
|
|
if (current.CheckCameraPoints != null && current.CheckCameraPoints.Count > 0)
|
|
if (current.CheckCameraPoints != null && current.CheckCameraPoints.Count > 0)
|
|
|
{
|
|
{
|
|
|
foreach (var item in current.CheckCameraPoints)
|
|
foreach (var item in current.CheckCameraPoints)
|
|
@@ -1046,6 +1047,10 @@ namespace TeamAAS_VP.Core
|
|
|
if (plc == null || !plc.IsConnected) return;
|
|
if (plc == null || !plc.IsConnected) return;
|
|
|
// 获取当前产品
|
|
// 获取当前产品
|
|
|
var currentProduct = _productService.GetCurrentProduct();
|
|
var currentProduct = _productService.GetCurrentProduct();
|
|
|
|
|
+ if (currentProduct==null)
|
|
|
|
|
+ {
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
// 触发下相机拍照
|
|
// 触发下相机拍照
|
|
|
if (addressConfig.In_DowmCameraExe.Address.Contains(tuple.nodeId))
|
|
if (addressConfig.In_DowmCameraExe.Address.Contains(tuple.nodeId))
|
|
@@ -1057,6 +1062,7 @@ namespace TeamAAS_VP.Core
|
|
|
SendTaskMessage($"触发下相机拍照...", MessageLevel.Debug);
|
|
SendTaskMessage($"触发下相机拍照...", MessageLevel.Debug);
|
|
|
//相机的编号
|
|
//相机的编号
|
|
|
Int16 cameraIndex = plc.ReadNode<Int16>(addressConfig.In_DowmCameraNum.Address);
|
|
Int16 cameraIndex = plc.ReadNode<Int16>(addressConfig.In_DowmCameraNum.Address);
|
|
|
|
|
+ SendTaskMessage($"编号:{cameraIndex}", MessageLevel.Info);
|
|
|
|
|
|
|
|
// 获取流程
|
|
// 获取流程
|
|
|
var process = _productService.GetCurrentProductProcedureModelById(currentProduct.FixedUpCamera1ProcedureId);
|
|
var process = _productService.GetCurrentProductProcedureModelById(currentProduct.FixedUpCamera1ProcedureId);
|
|
@@ -1135,6 +1141,7 @@ namespace TeamAAS_VP.Core
|
|
|
SendTaskMessage($"触发上相机锁附/组装拍照...", MessageLevel.Debug);
|
|
SendTaskMessage($"触发上相机锁附/组装拍照...", MessageLevel.Debug);
|
|
|
//相机的编号
|
|
//相机的编号
|
|
|
Int16 cameraIndex = plc.ReadNode<Int16>(addressConfig.In_UpCameraPutNum.Address);
|
|
Int16 cameraIndex = plc.ReadNode<Int16>(addressConfig.In_UpCameraPutNum.Address);
|
|
|
|
|
+ SendTaskMessage($"编号:{cameraIndex}", MessageLevel.Info);
|
|
|
|
|
|
|
|
// 获取流程
|
|
// 获取流程
|
|
|
var process = _productService.GetCurrentProductProcedureModelById(currentProduct.MoveDownCameraLockPhotoProcedureId);
|
|
var process = _productService.GetCurrentProductProcedureModelById(currentProduct.MoveDownCameraLockPhotoProcedureId);
|
|
@@ -1273,8 +1280,8 @@ namespace TeamAAS_VP.Core
|
|
|
{
|
|
{
|
|
|
SendTaskMessage($"收到开始锁付信号...", MessageLevel.Debug);
|
|
SendTaskMessage($"收到开始锁付信号...", MessageLevel.Debug);
|
|
|
//位置编号
|
|
//位置编号
|
|
|
- //Int16 positionIndex = plc.ReadNode<Int16>(addressConfig.In_ProductNum.Address);
|
|
|
|
|
-
|
|
|
|
|
|
|
+ Int16 positionIndex = plc.ReadNode<Int16>(addressConfig.In_ProductNum.Address);
|
|
|
|
|
+ SendTaskMessage($"编号:{positionIndex}", MessageLevel.Info);
|
|
|
}
|
|
}
|
|
|
else
|
|
else
|
|
|
{
|
|
{
|
|
@@ -1293,6 +1300,7 @@ namespace TeamAAS_VP.Core
|
|
|
SendTaskMessage($"收到停止锁付信号...", MessageLevel.Debug);
|
|
SendTaskMessage($"收到停止锁付信号...", MessageLevel.Debug);
|
|
|
//位置编号
|
|
//位置编号
|
|
|
Int16 positionIndex = plc.ReadNode<Int16>(addressConfig.In_ProductNum.Address);
|
|
Int16 positionIndex = plc.ReadNode<Int16>(addressConfig.In_ProductNum.Address);
|
|
|
|
|
+ SendTaskMessage($"编号:{positionIndex}", MessageLevel.Info);
|
|
|
//获取当前锁付点
|
|
//获取当前锁付点
|
|
|
var screwPoint = currentProduct.ScrewPoints.FirstOrDefault(p=>p.Number== positionIndex);
|
|
var screwPoint = currentProduct.ScrewPoints.FirstOrDefault(p=>p.Number== positionIndex);
|
|
|
//获取当前的机器人点位
|
|
//获取当前的机器人点位
|
|
@@ -1364,12 +1372,13 @@ namespace TeamAAS_VP.Core
|
|
|
|
|
|
|
|
for (int i = 0; i < currentProduct.ScrewPoints.Count; i++)
|
|
for (int i = 0; i < currentProduct.ScrewPoints.Count; i++)
|
|
|
{
|
|
{
|
|
|
- var localPoint = new PointF(currentProduct.ScrewCameraPoints[i].X_Position, currentProduct.ScrewCameraPoints[i].Y_Position);
|
|
|
|
|
|
|
+ var localPoint = new PointF(currentProduct.ScrewPoints[i].X_Position, currentProduct.ScrewPoints[i].Y_Position);
|
|
|
var worldPoint= local.ToOldCoord(localPoint.X, localPoint.Y);
|
|
var worldPoint= local.ToOldCoord(localPoint.X, localPoint.Y);
|
|
|
- var point = currentProduct.ScrewCameraPoints[i].Clone();
|
|
|
|
|
|
|
+ var point = currentProduct.ScrewPoints[i].Clone();
|
|
|
point.X_Position = (float)worldPoint[0];
|
|
point.X_Position = (float)worldPoint[0];
|
|
|
point.Y_Position = (float)worldPoint[1];
|
|
point.Y_Position = (float)worldPoint[1];
|
|
|
- await point.WriteToPlcAddress(addressConfig.Out_ScrewCamera, plc);
|
|
|
|
|
|
|
+ SendTaskMessage($"点:{i},{point.X_Position:F3},{point.Y_Position:F4}", MessageLevel.Info);
|
|
|
|
|
+ await point.WriteToPlcAddress(addressConfig.Out_Screw, plc);
|
|
|
}
|
|
}
|
|
|
await plc.WriteNodeAsync(addressConfig.Out_WorkNum.Address, (Int16)currentProduct.ScrewPoints.Count);
|
|
await plc.WriteNodeAsync(addressConfig.Out_WorkNum.Address, (Int16)currentProduct.ScrewPoints.Count);
|
|
|
}
|
|
}
|