|
@@ -241,6 +241,43 @@ namespace TeamAAS_VP.ViewModels.Product
|
|
|
get { return _precisionResult; }
|
|
get { return _precisionResult; }
|
|
|
set { SetProperty(ref _precisionResult, value); }
|
|
set { SetProperty(ref _precisionResult, value); }
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ private int _ADelay = 300;
|
|
|
|
|
+ /// <summary>
|
|
|
|
|
+ /// A点延时时间
|
|
|
|
|
+ /// </summary>
|
|
|
|
|
+ public int ADelay
|
|
|
|
|
+ {
|
|
|
|
|
+ get { return _ADelay; }
|
|
|
|
|
+ set { SetProperty(ref _ADelay, value); }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ private int _BDelay = 500;
|
|
|
|
|
+ /// <summary>
|
|
|
|
|
+ /// B点延时时间
|
|
|
|
|
+ /// </summary>
|
|
|
|
|
+ public int BDelay
|
|
|
|
|
+ {
|
|
|
|
|
+ get { return _BDelay; }
|
|
|
|
|
+ set { SetProperty(ref _BDelay, value); }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ private bool _IsTakePhoto = true;
|
|
|
|
|
+ /// <summary>
|
|
|
|
|
+ /// 是否启用拍照
|
|
|
|
|
+ /// </summary>
|
|
|
|
|
+ public bool IsTakePhoto
|
|
|
|
|
+ {
|
|
|
|
|
+ get { return _IsTakePhoto; }
|
|
|
|
|
+ set { SetProperty(ref _IsTakePhoto, value); }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ private int _ProIndex;
|
|
|
|
|
+ public int ProIndex
|
|
|
|
|
+ {
|
|
|
|
|
+ get { return _ProIndex; }
|
|
|
|
|
+ set { SetProperty(ref _ProIndex, value); }
|
|
|
|
|
+ }
|
|
|
#endregion
|
|
#endregion
|
|
|
|
|
|
|
|
#region 命令
|
|
#region 命令
|
|
@@ -385,7 +422,7 @@ namespace TeamAAS_VP.ViewModels.Product
|
|
|
SendTaskMessage("机器人移动到A点失败!");
|
|
SendTaskMessage("机器人移动到A点失败!");
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
- await Task.Delay(200);
|
|
|
|
|
|
|
+ await Task.Delay(ADelay);
|
|
|
|
|
|
|
|
//移动机器人至B点
|
|
//移动机器人至B点
|
|
|
isSuccess1 = await Robot.CalibMotionAsync(PointB, null);
|
|
isSuccess1 = await Robot.CalibMotionAsync(PointB, null);
|
|
@@ -394,9 +431,13 @@ namespace TeamAAS_VP.ViewModels.Product
|
|
|
SendTaskMessage("机器人移动到B点失败!");
|
|
SendTaskMessage("机器人移动到B点失败!");
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
- await Task.Delay(300);
|
|
|
|
|
- //相机拍照并处理
|
|
|
|
|
- (bool isSuccess, double pixelX, double pixelY, double angleU, double transformX, double transformY) = await ExecutePhotoEx(CurrentProgress);
|
|
|
|
|
|
|
+ await Task.Delay(BDelay);
|
|
|
|
|
+
|
|
|
|
|
+ if (IsTakePhoto)
|
|
|
|
|
+ {
|
|
|
|
|
+ //相机拍照并处理
|
|
|
|
|
+ (bool isSuccess, double pixelX, double pixelY, double angleU, double transformX, double transformY) = await ExecutePhotoEx(CurrentProgress);
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
CycleTime = DateTime.Now.Subtract(startTime).TotalSeconds;
|
|
CycleTime = DateTime.Now.Subtract(startTime).TotalSeconds;
|
|
|
}
|
|
}
|
|
@@ -435,6 +476,18 @@ namespace TeamAAS_VP.ViewModels.Product
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ if (Robot == null || !Robot.IsConnected)
|
|
|
|
|
+ {
|
|
|
|
|
+ SendTaskMessage("机器人未连接,无法示教!");
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if (Camera == null || !Camera.IsConnected)
|
|
|
|
|
+ {
|
|
|
|
|
+ SendTaskMessage("相机未连接,无法示教!");
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
//为机器人设置移动速度
|
|
//为机器人设置移动速度
|
|
|
await Robot.CalibParameAsync(new PickInfo(), MoveSpeed, 0, false, 0, 0);
|
|
await Robot.CalibParameAsync(new PickInfo(), MoveSpeed, 0, false, 0, 0);
|
|
|
|
|
|
|
@@ -454,7 +507,7 @@ namespace TeamAAS_VP.ViewModels.Product
|
|
|
SendTaskMessage("机器人移动到A点失败!");
|
|
SendTaskMessage("机器人移动到A点失败!");
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
- await Task.Delay(200);
|
|
|
|
|
|
|
+ await Task.Delay(ADelay);
|
|
|
if (_cts.Token.IsCancellationRequested)
|
|
if (_cts.Token.IsCancellationRequested)
|
|
|
{
|
|
{
|
|
|
Message = "测试已取消!";
|
|
Message = "测试已取消!";
|
|
@@ -468,30 +521,41 @@ namespace TeamAAS_VP.ViewModels.Product
|
|
|
SendTaskMessage("机器人移动到B点失败!");
|
|
SendTaskMessage("机器人移动到B点失败!");
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
- await Task.Delay(300);
|
|
|
|
|
|
|
+ await Task.Delay(BDelay);
|
|
|
if (_cts.Token.IsCancellationRequested)
|
|
if (_cts.Token.IsCancellationRequested)
|
|
|
{
|
|
{
|
|
|
Message = "测试已取消!";
|
|
Message = "测试已取消!";
|
|
|
break;
|
|
break;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- //相机拍照并处理
|
|
|
|
|
- (bool isSuccess, double pixelX, double pixelY, double angleU, double transformX, double transformY) = await ExecutePhotoEx(CurrentProgress);
|
|
|
|
|
- CycleTime = DateTime.Now.Subtract(startTime).TotalSeconds;
|
|
|
|
|
-
|
|
|
|
|
- if (isSuccess)
|
|
|
|
|
|
|
+ if (IsTakePhoto)
|
|
|
{
|
|
{
|
|
|
- SuccessCount++;
|
|
|
|
|
|
|
+ //相机拍照并处理
|
|
|
|
|
+ (bool isSuccess, double pixelX, double pixelY, double angleU, double transformX, double transformY) = await ExecutePhotoEx(CurrentProgress);
|
|
|
|
|
+
|
|
|
|
|
+ CycleTime = DateTime.Now.Subtract(startTime).TotalSeconds;
|
|
|
|
|
+
|
|
|
|
|
+ if (isSuccess)
|
|
|
|
|
+ {
|
|
|
|
|
+ SuccessCount++;
|
|
|
|
|
+ }
|
|
|
|
|
+ else
|
|
|
|
|
+ {
|
|
|
|
|
+ FailCount++;
|
|
|
|
|
+ }
|
|
|
|
|
+ TestResults.Add(new DynamicTestResult(CurrentProgress, isSuccess, PointB, CycleTime, pixelX, pixelY, angleU, transformX, transformY));
|
|
|
|
|
+ OnTestResultAdded();
|
|
|
|
|
+
|
|
|
|
|
+ CurrentProgress++;
|
|
|
|
|
+ SuccessRate = (double)SuccessCount / CurrentProgress * 100;
|
|
|
}
|
|
}
|
|
|
else
|
|
else
|
|
|
{
|
|
{
|
|
|
- FailCount++;
|
|
|
|
|
|
|
+ CycleTime = DateTime.Now.Subtract(startTime).TotalSeconds;
|
|
|
|
|
+ SuccessCount++;
|
|
|
|
|
+ CurrentProgress++;
|
|
|
|
|
+ SuccessRate = (double)SuccessCount / CurrentProgress * 100;
|
|
|
}
|
|
}
|
|
|
- TestResults.Add(new DynamicTestResult(CurrentProgress, isSuccess, PointB, CycleTime, pixelX, pixelY, angleU, transformX, transformY));
|
|
|
|
|
- OnTestResultAdded();
|
|
|
|
|
-
|
|
|
|
|
- CurrentProgress++;
|
|
|
|
|
- SuccessRate = (double)SuccessCount / CurrentProgress * 100;
|
|
|
|
|
SendTaskMessage($"测试进行中... {CurrentProgress}/{RepeatCount}");
|
|
SendTaskMessage($"测试进行中... {CurrentProgress}/{RepeatCount}");
|
|
|
}
|
|
}
|
|
|
if (CurrentProgress >= RepeatCount)
|
|
if (CurrentProgress >= RepeatCount)
|