|
|
@@ -1139,6 +1139,7 @@ namespace TeamAAS_VP.Core
|
|
|
}
|
|
|
if (visionResult.IsSucceed)
|
|
|
{
|
|
|
+
|
|
|
float toolX = (float)(visionResult.X - currentPosition.X);
|
|
|
float toolY = (float)(visionResult.Y - currentPosition.Y);
|
|
|
|
|
|
@@ -1149,6 +1150,11 @@ namespace TeamAAS_VP.Core
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
+ if (isDryMode)
|
|
|
+ {
|
|
|
+ await plc.WriteNodeAsync(addressConfig.Out_DownCameraStatus.Address, (Int16)1);
|
|
|
+ return;
|
|
|
+ }
|
|
|
await plc.WriteNodeAsync(addressConfig.Out_DownCameraStatus.Address, (Int16)2);
|
|
|
return;
|
|
|
}
|
|
|
@@ -1202,6 +1208,11 @@ namespace TeamAAS_VP.Core
|
|
|
}
|
|
|
else if (downCameraNum == 2)
|
|
|
{
|
|
|
+ if (isDryMode)
|
|
|
+ {
|
|
|
+ await plc.WriteNodeAsync(addressConfig.Out_DownCameraStatus.Address, (Int16)1);
|
|
|
+ return;
|
|
|
+ }
|
|
|
//如果下相机2的流程id为空,则表示只有一个下相机
|
|
|
if (currentProduct.FixedUpCamera2ProcedureId == Guid.Empty)
|
|
|
{
|
|
|
@@ -1399,6 +1410,11 @@ namespace TeamAAS_VP.Core
|
|
|
// 执行视觉任务
|
|
|
var _cts = new CancellationTokenSource();
|
|
|
var visionResult = await _remoteCommandService.ExecutePhotoGetSinglePoint(process, null, new double[] { currentPosition.X, currentPosition.Y, currentPosition.U }, _cts.Token);
|
|
|
+ if (isDryMode)
|
|
|
+ {
|
|
|
+ await plc.WriteNodeAsync(addressConfig.Out_UpCameraPickStatus.Address, (Int16)1);
|
|
|
+ return;
|
|
|
+ }
|
|
|
if (visionResult.IsSucceed)
|
|
|
{
|
|
|
currentProduct.PickPoints[0].X_Position = (float)visionResult.X;
|
|
|
@@ -1437,6 +1453,11 @@ namespace TeamAAS_VP.Core
|
|
|
var task1 = _remoteCommandService.ExecutePhotoGetSinglePoint(process1, null, new double[] { currentPosition.X, currentPosition.Y, currentPosition.U }, _cts.Token);
|
|
|
var task2 = _remoteCommandService.ExecutePhotoGetSinglePoint(process2, null, new double[] { currentPosition.X, currentPosition.Y, currentPosition.U }, _cts.Token);
|
|
|
var visionResults = await Task.WhenAll(task1, task2);
|
|
|
+ if (isDryMode)
|
|
|
+ {
|
|
|
+ await plc.WriteNodeAsync(addressConfig.Out_UpCameraPickStatus.Address, (Int16)1);
|
|
|
+ return;
|
|
|
+ }
|
|
|
if (visionResults[0].IsSucceed && visionResults[1].IsSucceed)
|
|
|
{
|
|
|
float tool1X = (float)(visionResults[0].X - visionResults[0].X);
|
|
|
@@ -1521,6 +1542,7 @@ namespace TeamAAS_VP.Core
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
+
|
|
|
await plc.WriteNodeAsync(addressConfig.Out_UpCameraPutStatus.Address, (Int16)2);
|
|
|
return;
|
|
|
}
|
|
|
@@ -1587,7 +1609,11 @@ namespace TeamAAS_VP.Core
|
|
|
//相机的编号
|
|
|
//Int16 cameraIndex = plc.ReadNode<Int16>(addressConfig.Out_UPCameracheckNum.Address);
|
|
|
|
|
|
-
|
|
|
+ if (isDryMode)
|
|
|
+ {
|
|
|
+ await plc.WriteNodeAsync(addressConfig.Out_UPCameracheckStatus.Address, (Int16)1);
|
|
|
+ return;
|
|
|
+ }
|
|
|
|
|
|
await plc.WriteNodeAsync(addressConfig.Out_UPCameracheckStatus.Address, (Int16)1);
|
|
|
}
|
|
|
@@ -1609,7 +1635,11 @@ namespace TeamAAS_VP.Core
|
|
|
//相机的编号
|
|
|
//Int16 cameraIndex = plc.ReadNode<Int16>(addressConfig.In_FixedCameraPickNum.Address);
|
|
|
|
|
|
-
|
|
|
+ if (isDryMode)
|
|
|
+ {
|
|
|
+ await plc.WriteNodeAsync(addressConfig.Out_FixedCameraPickStatus.Address, (Int16)1);
|
|
|
+ return;
|
|
|
+ }
|
|
|
|
|
|
await plc.WriteNodeAsync(addressConfig.Out_FixedCameraPickStatus.Address, (Int16)1);
|
|
|
}
|
|
|
@@ -1665,6 +1695,11 @@ namespace TeamAAS_VP.Core
|
|
|
var task4 = _remoteCommandService.ExecutePhotoGetSinglePoint(process4, null, null, _cts.Token);
|
|
|
|
|
|
var visionResults = await Task.WhenAll(task1, task2, task3, task4);
|
|
|
+ if (isDryMode)
|
|
|
+ {
|
|
|
+ await plc.WriteNodeAsync(addressConfig.Out_FixedCameraPutStatus.Address, (Int16)1);
|
|
|
+ return;
|
|
|
+ }
|
|
|
if (visionResults[0].IsSucceed && visionResults[1].IsSucceed && visionResults[2].IsSucceed && visionResults[3].IsSucceed)
|
|
|
{
|
|
|
Vector<double> p1=Vector<double>.Build.Dense(new double[] { visionResults[0].X, visionResults[0].Y });
|
|
|
@@ -1679,11 +1714,6 @@ namespace TeamAAS_VP.Core
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- if (isDryMode)
|
|
|
- {
|
|
|
- await plc.WriteNodeAsync(addressConfig.Out_FixedCameracheckStatus.Address, (Int16)1);
|
|
|
- return;
|
|
|
- }
|
|
|
await plc.WriteNodeAsync(addressConfig.Out_FixedCameraPutStatus.Address, (Int16)2);
|
|
|
return;
|
|
|
}
|
|
|
@@ -1743,6 +1773,11 @@ namespace TeamAAS_VP.Core
|
|
|
var task4 = _remoteCommandService.ExecutePhotoGetSinglePoint(process4, null, null, _cts.Token);
|
|
|
|
|
|
var visionResults = await Task.WhenAll(task1, task2, task3, task4);
|
|
|
+ if (isDryMode)
|
|
|
+ {
|
|
|
+ await plc.WriteNodeAsync(addressConfig.Out_FixedCameracheckStatus.Address, (Int16)1);
|
|
|
+ return;
|
|
|
+ }
|
|
|
if (visionResults[0].IsSucceed && visionResults[1].IsSucceed && visionResults[2].IsSucceed && visionResults[3].IsSucceed)
|
|
|
{
|
|
|
Vector<double> p1 = Vector<double>.Build.Dense(new double[] { visionResults[0].X, visionResults[0].Y });
|
|
|
@@ -1757,11 +1792,7 @@ namespace TeamAAS_VP.Core
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- if (isDryMode)
|
|
|
- {
|
|
|
- await plc.WriteNodeAsync(addressConfig.Out_FixedCameracheckStatus.Address, (Int16)1);
|
|
|
- return;
|
|
|
- }
|
|
|
+
|
|
|
await plc.WriteNodeAsync(addressConfig.Out_FixedCameracheckStatus.Address, (Int16)2);
|
|
|
return;
|
|
|
}
|